[PATCH 1/3] stkutil: display text attributes as html
Andrzej Zaborowski
andrew.zaborowski at intel.com
Thu Jul 1 15:47:36 PDT 2010
On 2 July 2010 00:35, Denis Kenzior <denkenz at gmail.com> wrote:
> Hi Andrew,
>
> On 07/01/2010 05:10 PM, Andrzej Zaborowski wrote:
>> Hi
>>
>> On 1 July 2010 18:30, Denis Kenzior <denkenz at gmail.com> wrote:
>>>> +char *stk_text_to_html(char *text, int text_len,
>>>> + const unsigned char *attrs, int attrs_len)
>>>> +{
>>>> + GString *string = g_string_sized_new(text_len + 1);
>>>> + int formats[257]; /* maximum number of chars in text + 1 */
>>>> + int pos = 0, i, j, attr, prev_attr;
>>>> + guint8 start, end, code, color, len, align;
>>>> +
>>>> + /* we will need formatting at the position beyond the last char */
>>>> + for (i = 0; i <= text_len; i++)
>>>> + formats[i] = STK_TEXT_FORMAT_INIT;
>>>> +
>>>
>>> Please note that the same formatting can be used for EMS messages
>>> (23.040). These messages have a fairly large max-len (255 segments *
>>> ~153 characters) I'd like to have this function useable for EMS
>>> messages as well.
>>
>> It would have a different signature because as far as I understand a
>> separate array of attributes is sent in each segment (the start/len
>> fields can't address more than 256 characters anyway). So that
>> function can be a wrapper around this function.
>>
>
> It depends actually. I'd like to avoid writing a separate EMS
> concatenator, and re-use sms_decode_text. This means that if possible,
> I'd like this function to work on arbitrary length strings. The text
> attributes can be massaged pretty easily without knowing what's inside
> the SMS message.
My point is that it won't work on a message longer than 256 bytes
anyway, because you would need to either change how the attribute
start byte is coded, or supplement each attribute with information
about which segment it relates to.
Regards,
Andrew
More information about the ofono
mailing list