[roidelapluie] Added initial support for Roster Item Exchange (XEP-0144) based on ticket #378. Only handling NS_ROSTERX 'set' operations is supported and tested as of now.
This commit is contained in:
parent
3676c55e9d
commit
38fa0be12a
|
@ -0,0 +1,99 @@
|
|||
<?xml version="1.0"?>
|
||||
<glade-interface>
|
||||
<!-- interface-requires gtk+ 2.16 -->
|
||||
<!-- interface-naming-policy project-wide -->
|
||||
<widget class="GtkWindow" id="roster_item_exchange_window">
|
||||
<property name="title" translatable="yes">Roster Item Exchange</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="type_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>someone@somewhere.com</b> would like you to <b>add</b> some contacts in your roster.</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">center</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="body_scrolledwindow">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="hscrollbar_policy">automatic</property>
|
||||
<property name="vscrollbar_policy">automatic</property>
|
||||
<child>
|
||||
<widget class="GtkTextView" id="body_textview">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="justification">center</property>
|
||||
<property name="cursor_visible">False</property>
|
||||
<property name="text" translatable="yes">Message Body</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">automatic</property>
|
||||
<property name="vscrollbar_policy">automatic</property>
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="items_list_treeview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">3</property>
|
||||
<child>
|
||||
<widget class="GtkButton" id="cancel_button">
|
||||
<property name="label" translatable="yes">gtk-cancel</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="on_cancel_button_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="accept_button">
|
||||
<property name="label" translatable="yes">gtk-ok</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="on_accept_button_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</glade-interface>
|
|
@ -1771,6 +1771,27 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
|
|||
self.dispatch('GMAIL_NOTIFY', (jid, newmsgs, gmail_messages_list))
|
||||
raise common.xmpp.NodeProcessed
|
||||
|
||||
|
||||
def _rosterItemExchangeCB(self, con, msg):
|
||||
''' XEP-0144 Roster Item Echange '''
|
||||
exchange_items_list = {}
|
||||
jid_from = msg.getAttr('from')
|
||||
items_list = msg.getTag('x').getChildren()
|
||||
action = items_list[0].getAttr('action')
|
||||
if action == None:
|
||||
action = 'add'
|
||||
for item in msg.getTag('x').getChildren():
|
||||
jid = item.getAttr('jid')
|
||||
name = item.getAttr('name')
|
||||
groups=[]
|
||||
for group in item.getChildren():
|
||||
groups.append(group.getData())
|
||||
exchange_items_list[jid] = []
|
||||
exchange_items_list[jid].append(name)
|
||||
exchange_items_list[jid].append(groups)
|
||||
self.dispatch('ROSTERX', (action, exchange_items_list, jid_from))
|
||||
|
||||
|
||||
def _messageCB(self, con, msg):
|
||||
'''Called when we receive a message'''
|
||||
log.debug('MessageCB')
|
||||
|
@ -1780,6 +1801,11 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
|
|||
if msg.getTag('error') is None:
|
||||
self._pubsubEventCB(con, msg)
|
||||
return
|
||||
|
||||
# check if the message is a roster item exchange (XEP-0144)
|
||||
#if msg.getTag('x') and msg.getTag('x').namespace == common.xmpp.NS_ROSTERX:
|
||||
#self._rosterItemExchangeCB(con, msg)
|
||||
#return
|
||||
|
||||
# check if the message is a XEP-0070 confirmation request
|
||||
if msg.getTag('confirm', namespace=common.xmpp.NS_HTTP_AUTH):
|
||||
|
@ -2579,6 +2605,8 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
|
|||
common.xmpp.NS_ROSTER)
|
||||
con.RegisterHandler('iq', self._siSetCB, 'set',
|
||||
common.xmpp.NS_SI)
|
||||
con.RegisterHandler('iq', self._rosterItemExchangeCB, 'set',
|
||||
common.xmpp.NS_ROSTERX)
|
||||
con.RegisterHandler('iq', self._siErrorCB, 'error',
|
||||
common.xmpp.NS_SI)
|
||||
con.RegisterHandler('iq', self._siResultCB, 'result',
|
||||
|
|
|
@ -195,7 +195,7 @@ gajim_common_features = [xmpp.NS_BYTESTREAM, xmpp.NS_SI, xmpp.NS_FILE,
|
|||
'jabber:iq:gateway', xmpp.NS_LAST, xmpp.NS_PRIVACY, xmpp.NS_PRIVATE,
|
||||
xmpp.NS_REGISTER, xmpp.NS_VERSION, xmpp.NS_DATA, xmpp.NS_ENCRYPTED, 'msglog',
|
||||
'sslc2s', 'stringprep', xmpp.NS_PING, xmpp.NS_TIME_REVISED, xmpp.NS_SSN,
|
||||
xmpp.NS_MOOD, xmpp.NS_ACTIVITY, xmpp.NS_NICK]
|
||||
xmpp.NS_MOOD, xmpp.NS_ACTIVITY, xmpp.NS_NICK, xmpp.NS_ROSTERX]
|
||||
|
||||
# Optional features gajim supports per account
|
||||
gajim_optional_features = {}
|
||||
|
|
767
src/dialogs.py
767
src/dialogs.py
File diff suppressed because it is too large
Load Diff
|
@ -2059,6 +2059,10 @@ class Interface:
|
|||
# ('PEP_CONFIG', account, (node, form))
|
||||
if 'pep_services' in self.instances[account]:
|
||||
self.instances[account]['pep_services'].config(data[0], data[1])
|
||||
|
||||
def handle_event_roster_item_exchange(self, account, data):
|
||||
# data = (action in [add, delete, modify], exchange_list, jid_from)
|
||||
dialogs.RosterItemExchangeWindow(account, data[0], data[1], data[2])
|
||||
|
||||
def handle_event_unique_room_id_supported(self, account, data):
|
||||
'''Receive confirmation that unique_room_id are supported'''
|
||||
|
@ -2294,6 +2298,7 @@ class Interface:
|
|||
'SEARCH_FORM': self.handle_event_search_form,
|
||||
'SEARCH_RESULT': self.handle_event_search_result,
|
||||
'RESOURCE_CONFLICT': self.handle_event_resource_conflict,
|
||||
'ROSTERX': self.handle_event_roster_item_exchange,
|
||||
'PEP_CONFIG': self.handle_event_pep_config,
|
||||
'UNIQUE_ROOM_ID_UNSUPPORTED': \
|
||||
self.handle_event_unique_room_id_unsupported,
|
||||
|
|
Loading…
Reference in New Issue