Re: Making memo length a phone specific item

"Roger Binns" <[email protected]>
Newsgroups gmane.comp.mobile.bitpim.devel
Message-ID <004201c50cd8$7a1a2450$3501a8c0@rogersqyvr14d3>
> So -- what are the steps to do this the right way so that it can modified
> with something simple such as MAX_MEMO_LENGTH=xx in each phone's source?
> 
> Any pointers would be appreciated.

Yes, the first thing you do is point it out to whoever looks after
that manufacturer :-)

You can see what I did in the commit.

The value becomes a module level parameter:

 MEMOLENGTH=65

Then the specific field is altered to use this:

 * STRING {'raiseonunterminatedread': False, 'sizeinbytes': MEMOLENGTH} memo

That step wasn't totally necessary (I could leave the 65 hard coded on
the above line), but it is generally a bad idea to duplicate information
(it would be quite hard to tell if they are out of sync, and things could
get very wierd if some of the code was cut and pasted for a new phone module).

This had to be done for all modules for the manufacturer.  Finally the piece
of code that was doing the truncation was altered to look at self.protocolclass
which points to the p_ module for the actual selected phone model.

 # memo (-1 is to leave space for null terminator - not all software puts it 
 # in, but we do)
 e['memo']=helper.makeone(helper.getmemos(entry.get('memos', []), 0, 1, 
                          self.protocolclass.MEMOLENGTH-1), "")

Roger



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.