Hello again Chris,

I've partly rewrote the parser, solved the encoding problem. But I need to use the class function IConverter::Convert(iconv.h), hence I modified it to public. If you would like to keep it private, I could copy this function to SMS parser. Another thing, is it appropriate to include the errno header? I simulated the creation of an iconv_t variable in iconv.cc.

But however, I think that there should be some improvement on Barry's iconv, since BlackBerry doesn't entirely use WINDOWS-1252 as its charset(not even in contacts with non-Latin names, don't know what they use), maybe it should be the programmers to decide what encoding to convert from, and the users to decide what encoding to convert to. And since UCS-2 is rarely used in computer, I ignored the ic's indication of what encoding to convert to and chose UTF-8.

On the Encoding issue, the value of Encoding is taken straightly from BlackBerry as other variables, and I think this may be a part of SMS protocol(which I know nothing about), the best solution maybe leaving it public so that the developers can make use of it. So I left it unchanged. Encoding can be VCard, if someone using a phone with a different manufacturer(say, Nokia) send you a contact card, it's in this encoding(more appropriately, format.) Given access to this value, developers could develop a program that convert this message to VCard.
        - Does the Encoding need to be public?  It looks like technical
                details that the parser class should handle automatically.
                I suppose if it is a read-only item, through a member
                function, that's ok.
And then, timestamps. The two timestamps are taken directly from BlackBerry, accurate to milliseconds, I don't want to lose data, some developers may also be interested in this. Hence I wrote two functions returning time_t for developers to get timestamps, and added comment where they are declared.
        - Timestamps should be in time_t by default.  The parser class
                should do the conversion as it is reading/writing from
                the device.  The application programmer should be able
                to look at the class and know immediately what to do
                with a time_t.  He won't know what to do with a uint64_t. :-)
Size checks and Encoding value assignment refined. :-)
        - be careful with the sizes... when parsing, check that the data
                exists before actually accessing it.  I added some size
                checks to the parser, but it's a good thing to keep in mind.
                In general we should never trust data from external sources,
                including data from the Blackberry.

        - the Encoding value is taken straight from the Blackberry and
                passed through to the API without change.  This has been
                done elsewhere in the code, but with comments.  The thing
                we have to watch for is that the Blackberry might change,
                but our API should not.  See r_contact.cc for my attempt
                at doing this with functions, with the enums there.
                Another clean way to do it is to do what you did with
                MessageStatus, and set the value through if statements.
                That way, if the Blackberry changes, we can update the code
                without changing the enum API for applications that depend
                on it.
And there's one thing I'm curious about, that how could a programmer using libbarry write records back to BlackBerry using this parser? I thought that the parsers are only for reading records from BlackBerry?
                Remember that the goal is to expose this data to applications,
                so that apps can write SMS records back into the device
                if appropriate.

Still don't know how to submit a patch through Git…. So again, attached them here.

Best Regards,
Ryan Li

Attachment: patch.tar.gz
Description: GNU Zip compressed data

------------------------------------------------------------------------------
_______________________________________________
Barry-devel mailing list
Barry-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/barry-devel

Reply via email to