Skip to content

Instantly share code, notes, and snippets.

@rgaudin
Created August 21, 2009 12:24
Show Gist options
  • Save rgaudin/171942 to your computer and use it in GitHub Desktop.
Save rgaudin/171942 to your computer and use it in GitHub Desktop.
diff --git a/lib/rapidsms/message.py b/lib/rapidsms/message.py
index 6d55978..186e36b 100644
--- a/lib/rapidsms/message.py
+++ b/lib/rapidsms/message.py
@@ -55,7 +55,15 @@ class Message(object):
def send(self):
"""Send this message via self.connection.backend, returning
True if the message was sent successfully."""
- return self.connection.backend.router.outgoing(self)
+ # apply idswitch function if exists
+ try:
+ xc = copy.copy(self.connection)
+ m = Message(connection=xc, text=self.text, person=self.person, date=self.date)
+ m.connection.identity = self.idswitch(m)
+ return m.connection.backend.router.outgoing(m)
+ except AttributeError:
+ pass
+ return self.connection.backend.router.outgoing(self)
def flush_responses (self):
"""Sends all responses added to this message (via the
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment