From 60fa155c8146e8d80f08594b436fdd204abb2a5f Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 5 Jan 2010 22:15:08 -0600 Subject: [PATCH] Clean up and adding of an sms command to the debug prompt --- src/channel/debug_prompt.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/channel/debug_prompt.py b/src/channel/debug_prompt.py index 3352c2a..bc0ea38 100644 --- a/src/channel/debug_prompt.py +++ b/src/channel/debug_prompt.py @@ -49,7 +49,7 @@ class DebugPromptChannel(telepathy.server.ChannelTypeText, cmd.Cmd): finally: self.stdin, self.stdout = oldStdin, oldStdout - self._report_new_message(currentStdout.getvalue().strip()) + self._report_new_message(currentStdout.getvalue()) @gtk_toolbox.log_exception(_moduleLogger) def Close(self): @@ -68,7 +68,7 @@ class DebugPromptChannel(telepathy.server.ChannelTypeText, cmd.Cmd): timestamp = int(time.time()) type = telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL - self.Received(currentReceivedId, timestamp, self._otherHandle, type, 0, message) + self.Received(currentReceivedId, timestamp, self._otherHandle, type, 0, message.strip()) self._nextRecievedId += 1 @@ -154,7 +154,7 @@ class DebugPromptChannel(telepathy.server.ChannelTypeText, cmd.Cmd): def do_call(self, args): if len(args) != 1: - self._report_new_message("No arguments supported") + self._report_new_message("Must specify the phone number and only the phone nunber") return try: @@ -162,3 +162,15 @@ class DebugPromptChannel(telepathy.server.ChannelTypeText, cmd.Cmd): self._conn.session.backend.call(number) except Exception, e: self._report_new_message(str(e)) + + def do_send_sms(self, args): + if 1 < len(args): + self._report_new_message("Must specify the phone number and then message") + return + + try: + number = args[0] + message = " ".join(args[1:]) + self._conn.session.backend.send_sms(number, message) + except Exception, e: + self._report_new_message(str(e)) -- 1.7.9.5