diff --git a/data/glade/vcard_information_window.glade b/data/glade/vcard_information_window.glade
index 12eb4b1d9..9dadbef46 100644
--- a/data/glade/vcard_information_window.glade
+++ b/data/glade/vcard_information_window.glade
@@ -2550,6 +2550,66 @@
tab
+
+
+
+ 6
+ True
+ True
+ GTK_POLICY_AUTOMATIC
+ GTK_POLICY_AUTOMATIC
+ GTK_SHADOW_IN
+ GTK_CORNER_TOP_LEFT
+
+
+
+ 70
+ True
+ True
+ True
+ False
+ True
+ GTK_JUSTIFY_LEFT
+ GTK_WRAP_NONE
+ True
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+
+
+ False
+ True
+
+
+
+
+
+ True
+ Comments
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ tab
+
+
0
diff --git a/src/common/connection.py b/src/common/connection.py
index 251d49139..5edf236c3 100644
--- a/src/common/connection.py
+++ b/src/common/connection.py
@@ -58,6 +58,7 @@ class Connection(ConnectionHandlers):
self.time_to_reconnect = None
self.new_account_info = None
self.bookmarks = []
+ self.annotations = {}
self.on_purpose = False
self.last_io = gajim.idlequeue.current_time()
self.last_sent = []
@@ -543,6 +544,9 @@ class Connection(ConnectionHandlers):
#Get bookmarks from private namespace
self.get_bookmarks()
+
+ #Get annotations
+ self.get_annotations()
#Inform GUI we just signed in
self.dispatch('SIGNED_IN', ())
@@ -934,6 +938,31 @@ class Connection(ConnectionHandlers):
iq5 = iq4.setTagData('print_status', bm['print_status'])
self.connection.send(iq)
+ def get_annotations(self):
+ '''Get Annonations from storage as described in XEP 0048, and XEP 0145'''
+ self.annotations = {}
+ if not self.connection:
+ return
+ iq = common.xmpp.Iq(typ='get')
+ iq2 = iq.addChild(name='query', namespace='jabber:iq:private')
+ iq2.addChild(name='storage', namespace='storage:rosternotes')
+ self.connection.send(iq)
+
+ def store_annotations(self):
+ '''Set Annonations in private storage as described in XEP 0048, and XEP 0145'''
+ if not self.connection:
+ return
+ iq = common.xmpp.Iq(typ='set')
+ iq2 = iq.addChild(name='query', namespace='jabber:iq:private')
+ iq3 = iq2.addChild(name='storage', namespace='storage:rosternotes')
+ for jid in self.annotations.keys():
+ if self.annotations[jid]:
+ iq4 = iq3.addChild(name = "note")
+ iq4.setAttr('jid', jid)
+ iq4.setData(self.annotations[jid])
+ self.connection.send(iq)
+
+
def get_metacontacts(self):
'''Get metacontacts list from storage as described in JEP 0049'''
if not self.connection:
diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py
index ca915da7f..bd429983c 100644
--- a/src/common/connection_handlers.py
+++ b/src/common/connection_handlers.py
@@ -1192,6 +1192,14 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
# http://www.jabber.org/jeps/jep-0049.html
#TODO: implement this
pass
+ elif ns == 'storage:rosternotes':
+ # Annotations
+ # http://www.xmpp.org/extensions/xep-0145.html
+ notes = storage.getTags('note')
+ for note in notes:
+ jid = note.getAttr('jid')
+ annotation = note.getData()
+ self.annotations[jid] = annotation
def _PrivateErrorCB(self, con, iq_obj):
gajim.log.debug('PrivateErrorCB')
@@ -1833,6 +1841,9 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
# Get bookmarks from private namespace
self.get_bookmarks()
+ # Get annotations from private namespace
+ self.get_annotations()
+
# If it's a gmail account,
# inform the server that we want e-mail notifications
if gajim.get_server_from_jid(our_jid) in gajim.gmail_domains:
diff --git a/src/vcard.py b/src/vcard.py
index 6884db68f..a586e44d3 100644
--- a/src/vcard.py
+++ b/src/vcard.py
@@ -77,6 +77,10 @@ class VcardWindow:
self.update_progressbar)
self.fill_jabber_page()
+ annotations = gajim.connections[self.account].annotations
+ if self.contact.jid in annotations:
+ buffer = self.xml.get_widget('textview_annotation').get_buffer()
+ buffer.set_text(annotations[self.contact.jid])
self.xml.signal_autoconnect(self)
self.window.show_all()
@@ -90,6 +94,11 @@ class VcardWindow:
if self.update_progressbar_timeout_id is not None:
gobject.source_remove(self.update_progressbar_timeout_id)
del gajim.interface.instances[self.account]['infos'][self.contact.jid]
+ buffer = self.xml.get_widget('textview_annotation').get_buffer()
+ gajim.connections[self.account].annotations[self.contact.jid] = \
+ buffer.get_text(buffer.get_start_iter(), buffer.get_end_iter())
+ gajim.connections[self.account].store_annotations()
+
def on_vcard_information_window_key_press_event(self, widget, event):
if event.keyval == gtk.keysyms.Escape: