Touchup for /dtmf implementation

This commit is contained in:
Alexander Cherniuk 2010-03-18 08:17:48 +02:00
parent 48b2bfd700
commit 46a3094466
1 changed files with 2 additions and 3 deletions

View File

@ -173,13 +173,12 @@ class StandardChatCommands(CommandContainer):
gajim.connections[self.account].sendPing(self.contact) gajim.connections[self.account].sendPing(self.contact)
@command @command
@documentation(_("Sends DTMF events through an open audio session")) @documentation(_("Send DTMF events through an open audio session"))
def dtmf(self, events): def dtmf(self, events):
if not self.audio_sid: if not self.audio_sid:
raise CommandError(_("There is no open audio session with this contact")) raise CommandError(_("There is no open audio session with this contact"))
# Valid values for DTMF tones are *, # or a number # Valid values for DTMF tones are *, # or a number
events = [event for event in events events = filter(lambda e: e in ('*', '#') or e.isdigit (), events)
if event in ('*', '#') or event.isdigit()]
if events: if events:
session = gajim.connections[self.account].get_jingle_session( session = gajim.connections[self.account].get_jingle_session(
self.contact.get_full_jid(), self.audio_sid) self.contact.get_full_jid(), self.audio_sid)