# Finally it might have a 'ref' and a 'part' which is a tuple (this,max)
# This is only used when storing the message to link it up with
# a partner
-#
+#
# SMSstore
# This represents a collection of messages in a directory (one file per month)
# and provides lists of 'NEW' and 'DRAFT' messages.
# setstate(SMSmesg, NEW|DRAFT|None)
# update the 'new' and 'draft' lists or container, or not container, this
# message.
-#
+#
#
import os, fcntl, re, time, urllib
def format_ltime(tm):
return time.strftime("%Y%m%d-%H%M%S", tm[0:6]+(0,0,0)) + ("%+03d" % tm[6])
-
class SMSmesg:
def __init__(self, **a):
if len(a) == 1 and 'line' in a:
return a+b
self.text = reduce(reduce_pair, self.parts)
-
def set_corresponent(self):
if len(self.correspondents) == 1:
self.correspondent = self.correspondents[0]
return r[1:]
else:
return '-'
-
class SMSstore:
def __init__(self, dir):
sms.parts[i] = orig.parts[i]
else:
orig = None
-
+
m = time.strftime("%Y%m", time.gmtime(sms.stamp))
try:
f = open(self.dirname + '/' + m, "r+")
if complete:
sms.reduce_parts()
sms.parts = None
-
+
fcntl.lockf(f, fcntl.LOCK_EX)
l = self.load_month(f)
while sms.stamp in l:
self.files.append(f)
self.files.sort()
self.files.reverse()
-
+
def lookup(self, lasttime = None, state = None):
if lasttime == None:
lasttime = int(time.time())
self.newmesg.append(tm)
self.newmesg.sort()
self.newmesg.reverse()
-
-