Commit 096f8869 authored by Jonathan Schleifer's avatar Jonathan Schleifer

Merge changes from default branch into osx_newbuildsys branch.

parents b60e1142 306519f6
......@@ -30,6 +30,9 @@ class BaseError(Exception):
super(BaseError, self).__init__()
def __str__(self):
return self.message
class DefinitionError(BaseError):
"""
Used to indicate errors occured on command definition.
......
......@@ -128,6 +128,35 @@ class StandardCommonCommands(CommandContainer):
self.echo(formatted)
@command(raw=True, empty=True)
@documentation(_("""
Set current the status
Status can be given as one of the following values: online, away,
chat, xa, dnd.
"""))
def status(self, status, message):
if status not in ('online', 'away', 'chat', 'xa', 'dnd'):
raise CommandError("Invalid status given")
for connection in gajim.connections.itervalues():
connection.change_status(status, message)
@command(raw=True, empty=True)
@documentation(_("Set the current status to away"))
def away(self, message):
if not message:
message = _("Away")
for connection in gajim.connections.itervalues():
connection.change_status('away', message)
@command('back', raw=True, empty=True)
@documentation(_("Set the current status to online"))
def online(self, message):
if not message:
message = _("Available")
for connection in gajim.connections.itervalues():
connection.change_status('online', message)
class StandardChatCommands(CommandContainer):
"""
This command container contains standard command which are unique to a chat.
......
......@@ -1309,8 +1309,8 @@ class Connection(CommonConnection, ConnectionHandlers):
def _on_xmpp_ping_answer(self, iq_obj):
id_ = unicode(iq_obj.getAttr('id'))
if id_ == self.awaiting_xmpp_ping_id:
self.awaiting_xmpp_ping_id = None
assert id_ == self.awaiting_xmpp_ping_id
self.awaiting_xmpp_ping_id = None
def sendPing(self, pingTo=None):
"""
......@@ -2226,6 +2226,7 @@ class Connection(CommonConnection, ConnectionHandlers):
def check_pingalive(self):
if self.awaiting_xmpp_ping_id:
# We haven't got the pong in time, disco and reconnect
log.warn("No reply received for keepalive ping. Reconnecting.")
self._disconnectedReconnCB()
def _reconnect_alarm(self):
......
......@@ -981,8 +981,6 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream,
self.dispatch('ENTITY_TIME', (jid_stripped, resource, ''))
self.entity_time_ids.remove(id_)
return
if id_ == self.awaiting_xmpp_ping_id:
self.awaiting_xmpp_ping_id = None
errmsg = iq_obj.getErrorMsg()
errcode = iq_obj.getErrorCode()
self.dispatch('ERROR_ANSWER', (id_, jid_from, errmsg, errcode))
......
......@@ -15,6 +15,8 @@
Handles Jingle contents (XEP 0166)
"""
import xmpp
contents = {}
def get_jingle_content(node):
......@@ -131,4 +133,4 @@ class JingleContent(object):
self.callbacks = None
del self.session.contents[(self.creator, self.name)]
# vim: se ts=3:
\ No newline at end of file
# vim: se ts=3:
......@@ -2265,7 +2265,8 @@ class Interface:
w = ctrl.parent_win
elif type_ in ('normal', 'file-request', 'file-request-error',
'file-send-error', 'file-error', 'file-stopped', 'file-completed'):
'file-send-error', 'file-error', 'file-stopped', 'file-completed',
'jingle-incoming'):
# Get the first single message event
event = gajim.events.get_first_event(account, fjid, type_)
if not event:
......@@ -2301,11 +2302,6 @@ class Interface:
self.show_unsubscribed_dialog(account, contact)
gajim.events.remove_events(account, jid, event)
self.roster.draw_contact(jid, account)
elif type_ == 'jingle-incoming':
event = gajim.events.get_first_event(account, jid, type_)
peerjid, sid, content_types = event.parameters
dialogs.VoIPCallReceivedDialog(account, peerjid, sid, content_types)
gajim.events.remove_events(account, jid, event)
if w:
w.set_active_tab(ctrl)
w.window.window.focus(gtk.get_current_event_time())
......
......@@ -1849,6 +1849,11 @@ class RosterWindow:
gajim.interface.show_unsubscribed_dialog(account, data)
gajim.events.remove_events(account, jid, event)
return True
elif event.type_ == 'jingle-incoming':
peerjid, sid, content_types = data
dialogs.VoIPCallReceivedDialog(account, peerjid, sid, content_types)
gajim.events.remove_events(account, jid, event)
return True
return False
################################################################################
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment