diff --git a/core/core.py b/core/core.py
index f9ab322a7..339780f01 100644
--- a/core/core.py
+++ b/core/core.py
@@ -104,6 +104,8 @@ class GajimCore:
self.con.requestRoster()
roster = self.con.getRoster().getRaw()
+ if not roster :
+ roster = {}
self.hub.sendPlugin('ROSTER', roster)
self.con.sendInitPresence()
self.connected = 1
@@ -121,16 +123,16 @@ class GajimCore:
return
#('STATUS', status)
elif ev[0] == 'STATUS':
+
if (ev[1] != 'offline') and (self.connected == 0):
self.connect()
elif (ev[1] == 'offline') and (self.connected == 1):
self.con.disconnect()
self.connected = 0
- else:
- print ev
- p = common.jabber.Presence()
- p.setShow(ev[1])
- self.con.send(p)
+ return 1
+ p = common.jabber.Presence()
+ p.setShow(ev[1])
+ self.con.send(p)
#('MSG', (jid, msg))
elif ev[0] == 'MSG':
msg = common.jabber.Message(ev[1][0], ev[1][1])
@@ -140,6 +142,9 @@ class GajimCore:
elif ev[0] == 'SUB':
log.debug('subscription request for %s' % ev[1][0])
self.con.send(common.jabber.Presence(ev[1][0], 'subscribe'))
+ #('REQ', jid)
+ elif ev[0] == 'AUTH':
+ self.con.send(common.jabber.Presence(ev[1], 'subscribed'))
#('UNSUB', jid)
elif ev[0] == 'UNSUB':
delauth = self.cfgParser.Core_delauth
diff --git a/plugins/gtkgui.glade b/plugins/gtkgui.glade
index e1c77f568..b09f7f8fa 100644
--- a/plugins/gtkgui.glade
+++ b/plugins/gtkgui.glade
@@ -40,7 +40,7 @@
True
-
+
True
gtk-convert
1
@@ -62,7 +62,7 @@
-
+
True
gtk-preferences
1
@@ -83,7 +83,7 @@
-
+
True
gtk-select-color
1
@@ -110,7 +110,7 @@
-
+
True
gtk-add
1
@@ -137,7 +137,7 @@
-
+
True
gtk-help
1
@@ -159,7 +159,7 @@
-
+
True
gtk-quit
1
@@ -201,7 +201,7 @@
True
False
False
- False
+ True
True
@@ -1390,7 +1390,7 @@ David Ferlier (david@yazzy.org)
0
0
0
- I would like to add you to my contact list, please
+ I would like to add you to my contact list, please.
@@ -1555,7 +1555,7 @@ David Ferlier (david@yazzy.org)
- 0
+ 5
False
True
GTK_PACK_END
@@ -1587,4 +1587,300 @@ David Ferlier (david@yazzy.org)
+
+ True
+ Subscription request
+ GTK_WINDOW_TOPLEVEL
+ GTK_WIN_POS_NONE
+ False
+ 400
+ 200
+ True
+ False
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ Subscription request from
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+ 10
+ False
+ True
+
+
+
+
+
+ 5
+ True
+ True
+ GTK_POLICY_AUTOMATIC
+ GTK_POLICY_AUTOMATIC
+ GTK_SHADOW_IN
+ GTK_CORNER_TOP_LEFT
+
+
+
+ True
+ True
+ False
+ GTK_JUSTIFY_LEFT
+ GTK_WRAP_WORD
+ False
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+
+ True
+
+
+ 5
+ False
+ True
+
+
+
+
+
+ 10
+ True
+ GTK_BUTTONBOX_END
+ 20
+
+
+
+ True
+ True
+ True
+ GTK_RELIEF_NORMAL
+
+
+
+ True
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+
+ True
+ False
+ 2
+
+
+
+ True
+ gtk-close
+ 4
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ _Close
+ True
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+
+
+
+
+
+
+
+ True
+ True
+ True
+ GTK_RELIEF_NORMAL
+
+
+
+ True
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+
+ True
+ False
+ 2
+
+
+
+ True
+ gtk-cancel
+ 4
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ _Deny
+ True
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+
+
+
+
+
+
+
+ True
+ True
+ True
+ GTK_RELIEF_NORMAL
+
+
+
+ True
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+
+ True
+ False
+ 2
+
+
+
+ True
+ gtk-add
+ 4
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ _Authorize
+ True
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+
+
+
+
+
+
+ 0
+ False
+ False
+
+
+
+
+
+
diff --git a/plugins/gtkgui.py b/plugins/gtkgui.py
index 44215aceb..a2d507ffa 100644
--- a/plugins/gtkgui.py
+++ b/plugins/gtkgui.py
@@ -64,7 +64,7 @@ class add:
start_iter = buf.get_start_iter()
end_iter = buf.get_end_iter()
txt = buf.get_text(start_iter, end_iter, 0)
- self.r.req_sub(who, txt)
+ self.r.req_sub(self, who, txt)
self.delete_event(self)
def __init__(self, roster):
@@ -223,23 +223,43 @@ class roster:
self.l_contact[u.jid]['iter'].append(iterU)
else:
if show == 'offline' and not self.showOffline:
- self.treestore.remove(iter)
+ for i in self.l_contact[jid]['iter']:
+ self.treestore.remove(i)
else:
for i in self.l_contact[jid]['iter']:
self.treestore.set_value(i, 0, self.pixbufs[show])
-
-
-
u.show = show
u.status = status
def mk_menu_c(self, event, iter):
+ jid = self.treestore.get_value(iter, 2)
+ path = self.treestore.get_path(iter)
self.menu_c = gtk.Menu()
+ item = gtk.MenuItem("Start chat")
+ self.menu_c.append(item)
+ item.connect("activate", self.on_row_activated, path)
+ item = gtk.MenuItem("Rename")
+ self.menu_c.append(item)
+# item.connect("activate", self.on_rename, iter)
+ item = gtk.MenuItem()
+ self.menu_c.append(item)
+ item = gtk.MenuItem("Subscription")
+ self.menu_c.append(item)
+
+ menu_sub = gtk.Menu()
+ item.set_submenu(menu_sub)
+ item = gtk.MenuItem("Resend authorization to")
+ menu_sub.append(item)
+ item.connect("activate", self.authorize, jid)
+ item = gtk.MenuItem("Rerequest authorization from")
+ menu_sub.append(item)
+ item.connect("activate", self.req_sub, jid, 'I would like to add you to my contact list, please.')
+
+ item = gtk.MenuItem()
+ self.menu_c.append(item)
item = gtk.MenuItem("Remove")
self.menu_c.append(item)
item.connect("activate", self.on_req_usub, iter)
-# item = gtk.MenuItem("user2")
-# self.menu_c.append(item)
self.menu_c.popup(None, None, None, event.button, event.time)
self.menu_c.show_all()
@@ -254,6 +274,27 @@ class roster:
self.menu_c.popup(None, None, None, event.button, event.time)
self.menu_c.show_all()
+ def authorize(self, widget, jid):
+ self.queueOUT.put(('AUTH', jid))
+
+ def rename(self, widget, jid, name)
+ u = self.r.l_contact[jid]['user']
+ u.name = name
+ for i in self.r.l_contact[jid]['iter']:
+ self.r.treestore.set_value(i, 1, name)
+
+ def req_sub(self, widget, jid, txt):
+ self.queueOUT.put(('SUB', (jid, txt)))
+ if not self.l_contact.has_key(jid):
+ #TODO: sub
+ user1 = user(jid, jid, ['general'], 'requested', 'requested', 'sub')
+ #TODO: ajouter un grp si necessaire
+ if not self.l_group.has_key('general'):
+ iterG = self.treestore.append(None, (None, 'general', 'group'))
+ self.l_group['general'] = iterG
+ iterU = self.treestore.append(self.l_group['general'], (self.pixbufs['requested'], jid, jid))
+ self.l_contact[jid] = {'user':user1, 'iter':[iterU]}
+
def on_treeview_event(self, widget, event):
if (event.button == 3) & (event.type == gtk.gdk.BUTTON_PRESS):
try:
@@ -269,15 +310,6 @@ class roster:
return gtk.TRUE
return gtk.FALSE
- def req_sub(self, jid, txt):
- self.queueOUT.put(('SUB', (jid, txt)))
- if not self.l_contact.has_key(jid):
- #TODO: sub
- user1 = user(jid, jid, ['general'], 'requested', 'requested', 'sub')
- #TODO: ajouter un grp si necessaire
- iterU = self.treestore.append(self.l_group['general'], (self.pixbufs['requested'], jid, jid))
- self.l_contact[jid] = {'user':user1, 'iter':[iterU]}
-
def on_req_usub(self, widget, iter):
window_confirm = confirm(self, iter)
@@ -297,7 +329,7 @@ class roster:
self.queueOUT.put(('QUIT',''))
gtk.mainquit()
- def on_row_activated(self, widget, path, col):
+ def on_row_activated(self, widget, path, col=0):
iter = self.treestore.get_iter(path)
jid = self.treestore.get_value(iter, 2)
if self.tab_messages.has_key(jid):