Thread: MMS application
View Single Post
Posts: 17 | Thanked: 17 times | Joined on Jan 2011
#5
In case anybody is interested, I changed the code a bit to write the mms text content to a a file in /home/user/MyDocs.

I added this to fmmsd.py, at the beginning:

Code:
import datetime
mms_logfile = '/home/user/MyDocs/mms.txt'
And then, at the beginning of HandleWAPPush:

Code:
        try:
            s_header = ''
            for x in header:
                if (x >= 32 and x <= 126) or x in [10, 13]:
                    s_header += chr(x)
            s_payload = ''
            for x in payload:
                if (x >= 32 and x <= 126) or x in [10, 13]:
                    s_payload += chr(x)
            log_datetime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M')
            f = open(mms_logfile, 'a')
            f.write('--- %s ---\nHeader:\n%s\nPayload:\n%s\n---\n' % (log_datetime, s_header, s_payload))
            f.close()
        except Exception, error:
            log.exception('Could not write mms log to %s: %s\n' % (mms_logfile, error))
I am kind of interested in rewriting the whole thing in C, but it would take a lot of effort. Has anybody else thought about this?
 

The Following User Says Thank You to lameventanas For This Useful Post: