blob: 570ef964ec64251722cebeaa4b749ab38796e90d [file] [log] [blame]
Pau Espin Pedrol996651a2017-05-30 15:13:29 +02001# osmo_gsm_tester: DBUS client to talk to ofono
2#
3# Copyright (C) 2016-2017 by sysmocom - s.f.m.c. GmbH
4#
5# Author: Neels Hofmeyr <neels@hofmeyr.de>
6#
7# This program is free software: you can redistribute it and/or modify
Harald Welte27205342017-06-03 09:51:45 +02008# it under the terms of the GNU General Public License as
Pau Espin Pedrol996651a2017-05-30 15:13:29 +02009# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Harald Welte27205342017-06-03 09:51:45 +020015# GNU General Public License for more details.
Pau Espin Pedrol996651a2017-05-30 15:13:29 +020016#
Harald Welte27205342017-06-03 09:51:45 +020017# You should have received a copy of the GNU General Public License
Pau Espin Pedrol996651a2017-05-30 15:13:29 +020018# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20class Sms:
21 _last_sms_idx = 0
22 msg = None
23
24 def __init__(self, from_msisdn=None, to_msisdn=None, *tokens):
25 Sms._last_sms_idx += 1
26 msgs = ['message nr. %d' % Sms._last_sms_idx]
27 msgs.extend(tokens)
28 if from_msisdn:
29 msgs.append('from %s' % from_msisdn)
30 if to_msisdn:
31 msgs.append('to %s' % to_msisdn)
32 self.msg = ', '.join(msgs)
33
34 def __str__(self):
35 return self.msg
36
37 def __repr__(self):
38 return repr(self.msg)
39
40 def __eq__(self, other):
41 if isinstance(other, Sms):
42 return self.msg == other.msg
Neels Hofmeyrb3b31042017-05-31 20:38:56 +020043 return self.msg == other
Pau Espin Pedrol996651a2017-05-30 15:13:29 +020044
45 def matches(self, msg):
46 return self.msg == msg
47
48# vim: expandtab tabstop=4 shiftwidth=4