There is no Canonical copyright here.
[wammu.git] / Wammu / Message.py
blob82bc612b92c41736e5a9fcfef3be153562637509
1 # -*- coding: UTF-8 -*-
2 # vim: expandtab sw=4 ts=4 sts=4:
3 '''
4 Wammu - Phone manager
5 Message reader
6 '''
7 __author__ = 'Michal Čihař'
8 __email__ = 'michal@cihar.com'
9 __license__ = '''
10 Copyright © 2003 - 2009 Michal Čihař
12 This program is free software; you can redistribute it and/or modify it
13 under the terms of the GNU General Public License version 2 as published by
14 the Free Software Foundation.
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 more details.
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 '''
26 import Wammu.Reader
27 import Wammu.Utils
28 import Wammu
29 if Wammu.gammu_error == None:
30 import gammu
32 class GetMessage(Wammu.Reader.Reader):
33 def GetStatus(self):
34 status = self.sm.GetSMSStatus()
35 return status['SIMUsed'] + status['PhoneUsed'] + status['TemplatesUsed']
37 def GetNextStart(self):
38 return self.sm.GetNextSMS(Start = True, Folder = 0)
40 def GetNext(self, location):
41 return self.sm.GetNextSMS(Location = location, Folder = 0)
43 def Get(self, location):
44 return self.sm.GetSMS(Location = location, Folder = 0)
46 def Parse(self, value):
47 return
49 def Send(self, data):
50 res = Wammu.Utils.ProcessMessages(data, True)
51 self.SendData(['message', 'Read'], res['read'], False)
52 self.SendData(['message', 'UnRead'], res['unread'], False)
53 self.SendData(['message', 'Sent'], res['sent'], False)
54 self.SendData(['message', 'UnSent'], res['unsent'])