chiark
/
gitweb
/
~ianmdlvl
/
post-pizza-notify.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
segfaults!
[post-pizza-notify.git]
/
viasms
diff --git
a/viasms
b/viasms
index 1efd4be9abce36f639be0e8e8a72fc3a231a5780..45ead0aa42b23fc74c7de15a0aca707a348c28b3 100755
(executable)
--- a/
viasms
+++ b/
viasms
@@
-4,18
+4,44
@@
import gammu
import sys
sm = gammu.StateMachine();
import sys
sm = gammu.StateMachine();
+sm.ReadConfig();
sm.Init();
rcpt = sys.argv[0]
msg = sys.argv[1]
sm.Init();
rcpt = sys.argv[0]
msg = sys.argv[1]
+folders = sm.GetSMSFolders()
+
+folder = -1
+for i in range(0, len(folders)):
+ f = folders[i]
+ if f['Inbox']: continue
+ if f['Memory'] != 'ME': continue
+ assert(folder == -1)
+ folder = i
+
+assert(folder >= 0)
+
message = {
'Text': ('post-pizza: '+msg),
'SMSC': { 'Location': 1 },
message = {
'Text': ('post-pizza: '+msg),
'SMSC': { 'Location': 1 },
+ 'Folder': folder,
'Number': rcpt,
'Number': rcpt,
+ 'Type': 'Submit',
+ 'Coding': 'Default_No_Compression',
+ 'State': 'UnSent',
}
}
-(folder,loc) = sm.AddSMS(message)
+print "add:"
+
+(fol,loc) = sm.AddSMS(message)
+
+print `fol, loc`
+
+sm.SendSavedSMS(fol,loc)
+
+print "sent"
+
+sm.DeleteSMS(fol,loc)
-sm.SendSavedSMS(folder,loc)
-sm.DeleteSMS(folder,loc)
+print "deleted"