×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    49

    inbox --> content cut after ~263 chars

    Hello,

    If want to read the content of an message.
    Code:
    import inbox
    
    box=inbox.Inbox(inbox.ESent)
    messages=box.sms_messages()
    
    print box.content(1051660)
    But if the content is longer than 263 the message gets cut.
    Is there a way to display messages, which are longer than 263 chars?

  2. #2
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,777

    Re: inbox --> content cut after ~263 chars

    Hello Lukas Hetzenecker

    Well Yeah there is a solution to this problem.

    You can find the code at http://croozeus.googlepages.com/phase3

    Hope it helps,
    Pankaj Nathani
    www.croozeus.com

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    7

    Re: inbox --> content cut after ~263 chars

    I've got the same problem - the message get cut after ~256 characters.
    I use:
    Code:
    i = inbox.Inbox()
    mes = i.sms_messages()  # all message ID's
    for m in mes:
    	sms_text=i.content(m)
    	req.write(sms_text)
    req is http request handler and I think that the problem isn't there.

    What I do wrong? I search http://croozeus.googlepages.com/phase3 and found nothing different from my code.

  4. #4
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,777

    Re: inbox --> content cut after ~263 chars

    Quote Originally Posted by trapi View Post
    I've got the same problem - the message get cut after ~256 characters.
    I use:
    Code:
    i = inbox.Inbox()
    mes = i.sms_messages()  # all message ID's
    for m in mes:
    	sms_text=i.content(m)
    	req.write(sms_text)
    req is http request handler and I think that the problem isn't there.

    What I do wrong? I search http://croozeus.googlepages.com/phase3 and found nothing different from my code.
    Hello trapi and Welcome to the Forum

    That link was meant to read contents of the inbox.That wont help you.
    Have you tried to exploit the ctypes module? I think that may help you here.Try storing the text of a SMS (Longer then 263 characters in a long string or something like that.You can find other datatypes here http://docs.python.org/lib/node454.html

    Hope that Helps

    Regards
    Pankaj Nathani
    www.croozeus.com

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    7

    Re: inbox --> content cut after ~263 chars

    That link was meant to read contents of the inbox.That wont help you.
    Have you tried to exploit the ctypes module? I think that may help you here.Try storing the text of a SMS (Longer then 263 characters in a long string or something like that.You can find other datatypes here http://docs.python.org/lib/node454.html
    Could you gimme more detailed example?
    I tried import ctypes but it's not a module of python for s60.

    What's more - when I try sms_len=len(i.content(m)) it also shows no more than 256. So it's something wrong with inbox module I guess..

  6. #6
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,777

    Re: inbox --> content cut after ~263 chars

    Quote Originally Posted by trapi View Post
    Could you gimme more detailed example?
    I tried import ctypes but it's not a module of python for s60.

    What's more - when I try sms_len=len(i.content(m)) it also shows no more than 256. So it's something wrong with inbox module I guess..
    Hello trapi

    Yes i came to know that ctypes wasnt available in S60 when i tried my code on the device.Also referred to jplauril's comments in a post

    Question:Jplauril, would it be possible to have something like ctypes on symbian as well?
    Ctypes make calling native dll much easier, no need to create an extension for interface.

    Answer:Unfortunately using ctypes would be quite problematic. All interesting Symbian API's are C++ and ctypes is built with C in mind. To create C++ objects to pass as parameters you would need to parse the headers with a real C++ compiler and this would be much more complicated than for C. An additional inconvenience is that Symbian DLL's don't include function names, just ordinals, so you would have to pregenerate the naming information for the SDK libraries beforehand.
    Here is link to that thread http://discussion.forum.nokia.com/fo...ad.php?t=67187
    So unfortunately we have to find an other alternative to your problem
    Pankaj Nathani
    www.croozeus.com

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    7

    Re: inbox --> content cut after ~263 chars

    I looked into PyS60 source and in ext/inbox/inboxadapter.cpp is a function GetMessageL and there are these lines:
    Code:
    // Check length because message is read to limited size TBuf
    if (length >= KMessageBodySize) 
    {
      message.Append(richText->Read(0, KMessageBodySize -1));
    }
    else 
    {
    	message.Append(richText->Read(0, length));
    }
    And in ext/inbox/inbox.h the constant KMessageBodySize is set to 512.
    I think that this is the problem, but I don't know why the size of const on my python i 256.I also don't know why it's 512, it's only about 3 smses which is not so many..

  8. #8
    Regular Contributor
    Join Date
    Oct 2007
    Posts
    67

    Re: inbox --> content cut after ~263 chars

    Quote Originally Posted by trapi View Post
    I don't know why the size of const on my python is 256..
    Perhaps it *is* 512 and the data read there is unicode?

  9. #9
    Registered User
    Join Date
    Mar 2003
    Posts
    7

    Re: inbox --> content cut after ~263 chars

    Perhaps it *is* 512 and the data read there is unicode?
    You are probably right. Thanks for that idea. When I get to know how to compile the python for s60 source I will inform you about the results.

  10. #10
    Regular Contributor
    Join Date
    Oct 2007
    Posts
    67

    Re: inbox --> content cut after ~263 chars

    You can do with the following installed (on windows):

    - activeperl (from www.activestate.com)
    - python (from www.python.org)
    - S60 3rd Edition SDK for Symbian OS, Maintenance Release
    - Sensor API Plugin for S60 3rd Ed. SDK for Symbian OS
    - Extensions Plugin for 3rd Ed. SDK for Symbian OS
    - CSL ARM Toolchain (arm-symbianelf) 2005-Q1C (bundled with S60 3rd Ed. SDK)

    And finally you'll have to find some tool compatible with standard 'patch' to apply some diffs to the S60 include files needed to compile PyS60. Seems to exist for windows too but i've used a nearby BSD box for that :-/

    With the above installed it gets as easy as
    - cd to PyS60 source directory
    - python setup.py configure <your config preferences given here>
    - python setup.py build_device
    - python setup.py bdist_sis SIGN_CERT=xxx.cer SIGN_KEY=xxx.key SIGN_PASS=whatever

    You may want to create a batchfile to specify your options to the configure command.
    If you want to create a package with the same uids as the nokia signed sis files, you need the following there (white space added for readability)

    PYS60_UID_S60=0x2000b1a0
    PYS60_UID_CORE=0x2000b1a1
    PYS60_UID_APPMGR=0x2000b1a2
    PYS60_UID_RECOG=0x2000b1a3
    PYS60_UID_APPMGR_WRAPPER=0x2000b1a4
    PYS60_UID_SCRIPTSHELL=0x2000b1a5
    PYS60_UID_LAUNCHER=0x2000b1a6
    PYS60_UID_PYREPL=0x2000b1a9

    Best regards,

    Niels

    Oh yes there were two other do's:
    - use the good old SUBST dos command to map a driveletter to the dir where the S60 SDK gets installed (that is, the one containing the EPOC directory)
    - set EPOCROOT=\
    - cd to your subst'ed drive to do the build

    :-)
    Last edited by nlsp; 2007-11-01 at 21:09. Reason: added notes about SUBST and EPOCROOT

  11. #11
    Registered User
    Join Date
    Mar 2003
    Posts
    7

    Re: inbox --> content cut after ~263 chars

    Thanks a lot. I've done all that stuff with compiling, patching, signing etc. and I faced with another problem - I'd selfsigned the file, installed it and then when I opened mymobileserver it couldn't load the module mod_python.
    Do you think that when I signed the file with certificate and give the ID's that you wrote the python compiled by me will be a 100% substitute for Nokia's Python?
    Integration with mymobileserver is very importat for me but I also want to have an ability of fetching long text messages..

  12. #12
    Regular Contributor
    Join Date
    Oct 2007
    Posts
    67

    Re: inbox --> content cut after ~263 chars

    That's a tricky one. I didn't do anything with mobile webserver, so can only guess. General rule for capabilities on a dll is they should have the union of all capabilities assigned to all executables that load them. Some post mentioned the officially nokia signed python has more capabilites than a devcert is able to sign (i didn't check that). I guess mod_python depends on the python_222.dll and is loaded by the webserver executable, so if the error is -46 i would check capabilities down that chain.

    Did you sign with a self-signed cert or with a devcert from symbiansigned?

  13. #13
    Regular Contributor
    Join Date
    Oct 2007
    Posts
    67

    Re: inbox --> content cut after ~263 chars

    Update:

    Quote Originally Posted by trapi View Post
    Do you think that when I signed the file with certificate and give the ID's that you wrote the python compiled by me will be a 100% substitute for Nokia's Python?
    No. In the Nokia package:

    Capabilities 0xff7be (ALL-TCB-DRM-AllFiles)

    In my devcert-signed GCCE compiled package:

    Capabilities 0xff1b4 (ALL-TCB-CommDD-MultimediaDD-DRM-DiskAdmin-NetworkControl-AllFiles)

  14. #14
    Registered User
    Join Date
    Mar 2003
    Posts
    7

    Re: inbox --> content cut after ~263 chars

    I guess mod_python depends on the python_222.dll and is loaded by the webserver executable, so if the error is -46 i would check capabilities down that chain
    There is apache-like error (message from stdout: 'loading module mod_python failed' or sth like that).

    So the solution is use nokia's python with cutted messages or self-compiled python without mobile webserver..

  15. #15
    Regular Contributor
    Join Date
    Oct 2007
    Posts
    67

    Re: inbox --> content cut after ~263 chars

    Quote Originally Posted by trapi View Post
    There is apache-like error (message from stdout: 'loading module mod_python failed' or sth like that).

    So the solution is use nokia's python with cutted messages or self-compiled python without mobile webserver..
    Or compile mobile webserver with a self-compiled python package?

Similar Threads

  1. Audio Input Stream on N80
    By tkaihock in forum Symbian Media (Closed)
    Replies: 9
    Last Post: 2006-06-30, 09:15
  2. Has Nokia broken 7650 J2ME in v4.39?
    By LongSteve in forum Mobile Java General
    Replies: 6
    Last Post: 2003-06-03, 17:05
  3. Replies: 5
    Last Post: 2003-02-07, 11:25
  4. Incorrect order parts of MMS (if parts qnty > 5)
    By marianwitkowski in forum General Messaging
    Replies: 1
    Last Post: 2002-08-29, 04:36
  5. 7650 and MS Bluetooth Transceiver
    By damnedi in forum Bluetooth Technology
    Replies: 1
    Last Post: 1970-01-01, 02:00

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •