gajim: fix typo in remote_control.py. Fixes #5987

2010-10-19 Thread Yann Leboulanger
changeset b38c28e0fba4 in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=b38c28e0fba4
description: fix typo in remote_control.py. Fixes #5987

diffstat:

 src/remote_control.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 3afab18a50d0 -r b38c28e0fba4 src/remote_control.py
--- a/src/remote_control.py Tue Oct 19 21:49:49 2010 +0200
+++ b/src/remote_control.py Wed Oct 20 07:59:34 2010 +0200
@@ -173,7 +173,7 @@
 def on_gc_message_received(self, obj):
 self.raise_signal('GCMessage', (obj.conn.name, [obj.fjid, obj.msgtxt,
 obj.timestamp, obj.has_timestamp, obj.xhtml_msgtxt, 
obj.status_code,
-obj.displaymarking, obj.captcha_form, obj.needs_highlight])
+obj.displaymarking, obj.captcha_form, obj.needs_highlight]))
 
 def raise_signal(self, signal, arg):
 if self.signal_object:
___
Commits mailing list
Commits@gajim.org
http://lists.gajim.org/cgi-bin/listinfo/commits


gajim: fix var name

2010-10-19 Thread Yann Leboulanger
changeset 3afab18a50d0 in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=3afab18a50d0
description: fix var name

diffstat:

 src/common/connection_handlers.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 08276df0a91f -r 3afab18a50d0 src/common/connection_handlers.py
--- a/src/common/connection_handlers.py Tue Oct 19 21:43:44 2010 +0200
+++ b/src/common/connection_handlers.py Tue Oct 19 21:49:49 2010 +0200
@@ -1176,7 +1176,7 @@
 return
 if obj.id_ in self.version_ids:
 gajim.nec.push_incoming_event(VersionResultReceivedEvent(None,
-conn=self, stanza=obj.iq_obj))
+conn=self, stanza=obj.stanza))
 return True
 if obj.id_ in self.entity_time_ids:
 gajim.nec.push_incoming_event(TimeResultReceivedEvent(None,
___
Commits mailing list
Commits@gajim.org
http://lists.gajim.org/cgi-bin/listinfo/commits


gajim: prevent showing twice the same message in muc when we are...

2010-10-19 Thread Yann Leboulanger
changeset 08276df0a91f in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=08276df0a91f
description: prevent showing twice the same message in muc when we are twice in 
a room from 2 accounts.

diffstat:

 src/common/connection_handlers_events.py |  1 +
 src/groupchat_control.py |  4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 89ff917c301a -r 08276df0a91f src/common/connection_handlers_events.py
--- a/src/common/connection_handlers_events.py  Tue Oct 19 21:43:09 2010 +0200
+++ b/src/common/connection_handlers_events.py  Tue Oct 19 21:43:44 2010 +0200
@@ -1042,6 +1042,7 @@
 self.fjid = self.msg_obj.fjid
 self.msgtxt = self.msg_obj.msgtxt
 self.jid = self.msg_obj.jid
+self.room_jid = self.msg_obj.jid
 self.timestamp = self.msg_obj.timestamp
 self.xhtml_msgtxt = self.stanza.getXHTML()
 
diff -r 89ff917c301a -r 08276df0a91f src/groupchat_control.py
--- a/src/groupchat_control.py  Tue Oct 19 21:43:09 2010 +0200
+++ b/src/groupchat_control.py  Tue Oct 19 21:43:44 2010 +0200
@@ -811,7 +811,7 @@
 menu.destroy()
 
 def _nec_gc_message_received(self, obj):
-if obj.jid != self.room_jid:
+if obj.room_jid != self.room_jid or obj.conn.name != self.account:
 return
 if obj.captcha_form:
 if self.form_widget:
@@ -1270,7 +1270,7 @@
 self.draw_role(role)
 
 def _nec_gc_presence_received(self, obj):
-if obj.room_jid != self.room_jid:
+if obj.room_jid != self.room_jid or obj.conn.name != self.account:
 return
 if obj.ptype == 'error':
 return
___
Commits mailing list
Commits@gajim.org
http://lists.gajim.org/cgi-bin/listinfo/commits


gajim: prevent traceback when opening change status dialog. Fixe...

2010-10-19 Thread Yann Leboulanger
changeset 89ff917c301a in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=89ff917c301a
description: prevent traceback when opening change status dialog. Fixes #5985

diffstat:

 src/dialogs.py |  15 +++
 1 files changed, 7 insertions(+), 8 deletions(-)

diffs (36 lines):

diff -r 30010db4d1cd -r 89ff917c301a src/dialogs.py
--- a/src/dialogs.pyTue Oct 19 18:14:30 2010 +0200
+++ b/src/dialogs.pyTue Oct 19 21:43:09 2010 +0200
@@ -665,15 +665,14 @@
 label = self.xml.get_object('activity_button_label')
 if 'activity' in self.pep_dict and self.pep_dict['activity'] in \
pep.ACTIVITIES:
-if 'subactivity' in self.pep_dict and self.pep_dict['subactivity'] 
in \
-   pep.ACTIVITIES[self.pep_dict['activity']]:
+if 'subactivity' in self.pep_dict and self.pep_dict['subactivity'] 
\
+in pep.ACTIVITIES[self.pep_dict['activity']]:
 img.set_from_pixbuf(gtkgui_helpers.load_activity_icon(
-self.pep_dict['activity'], 
self.pep_dict['subactivity']).\
-get_pixbuf())
+self.pep_dict['activity'], self.pep_dict['subactivity']).\
+get_pixbuf())
 else:
 img.set_from_pixbuf(gtkgui_helpers.load_activity_icon(
-self.pep_dict['activity']).get_pixbuf())
-#   
item.set_tooltip_text(pep.ACTIVITIES[category]['category'])
+self.pep_dict['activity']).get_pixbuf())
 if self.pep_dict['activity_text']:
 label.set_text(self.pep_dict['activity_text'])
 else:
@@ -688,9 +687,9 @@
 """
 img = self.xml.get_object('mood_image')
 label = self.xml.get_object('mood_button_label')
-if self.pep_dict['mood'] in pep.MOODS:
+if 'mood' in self.pep_dict and self.pep_dict['mood'] in pep.MOODS:
 img.set_from_pixbuf(gtkgui_helpers.load_mood_icon(
-self.pep_dict['mood']).get_pixbuf())
+self.pep_dict['mood']).get_pixbuf())
 if self.pep_dict['mood_text']:
 label.set_text(self.pep_dict['mood_text'])
 else:
___
Commits mailing list
Commits@gajim.org
http://lists.gajim.org/cgi-bin/listinfo/commits


gajim: use RosterReceivedEvent object to handle load_roster_from...

2010-10-19 Thread Yann Leboulanger
changeset 30010db4d1cd in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=30010db4d1cd
description: use RosterReceivedEvent object to handle load_roster_from_db.

diffstat:

 src/common/connection.py |   4 +-
 src/common/connection_handlers.py|  35 +++--
 src/common/connection_handlers_events.py |  52 +++
 src/common/resolver.py   |   3 +-
 src/gui_interface.py |  11 --
 5 files changed, 53 insertions(+), 52 deletions(-)

diffs (164 lines):

diff -r 940f04599f4a -r 30010db4d1cd src/common/connection.py
--- a/src/common/connection.py  Tue Oct 19 17:21:11 2010 +0200
+++ b/src/common/connection.py  Tue Oct 19 18:14:30 2010 +0200
@@ -2322,8 +2322,6 @@
 self.connection.SendAndCallForResponse(iq, _on_response)
 
 def load_roster_from_db(self):
-roster = gajim.logger.get_roster(gajim.get_jid_from_account(self.name))
-self.dispatch('ROSTER', roster)
-
+gajim.nec.push_incoming_event(RosterReceivedEvent(None, conn=self))
 
 # END Connection
diff -r 940f04599f4a -r 30010db4d1cd src/common/connection_handlers.py
--- a/src/common/connection_handlers.py Tue Oct 19 17:21:11 2010 +0200
+++ b/src/common/connection_handlers.py Tue Oct 19 18:14:30 2010 +0200
@@ -1984,25 +1984,26 @@
 if send_first_presence:
 self._send_first_presence(signed)
 
-for jid in obj.roster:
-if jid != our_jid and gajim.jid_is_transport(jid) and \
-not gajim.get_transport_name_from_jid(jid):
-# we can't determine which iconset to use
-self.discoverInfo(jid)
+if obj.received_from_server:
+for jid in obj.roster:
+if jid != our_jid and gajim.jid_is_transport(jid) and \
+not gajim.get_transport_name_from_jid(jid):
+# we can't determine which iconset to use
+self.discoverInfo(jid)
 
-gajim.logger.replace_roster(self.name, obj.version, obj.roster)
-if obj.received_from_server:
-for contact in gajim.contacts.iter_contacts(self.name):
-if not contact.is_groupchat() and contact.jid not in 
obj.roster\
-and contact.jid != our_jid:
-gajim.nec.push_incoming_event(RosterInfoEvent(None,
-conn=self, jid=contact.jid, nickname=None, sub=None,
-ask=None, groups=()))
-for jid, info in obj.roster.items():
+gajim.logger.replace_roster(self.name, obj.version, obj.roster)
+
+for contact in gajim.contacts.iter_contacts(self.name):
+if not contact.is_groupchat() and contact.jid not in obj.roster\
+and contact.jid != our_jid:
 gajim.nec.push_incoming_event(RosterInfoEvent(None,
-conn=self, jid=jid, nickname=info['name'],
-sub=info['subscription'], ask=info['ask'],
-groups=info['groups']))
+conn=self, jid=contact.jid, nickname=None, sub=None,
+ask=None, groups=()))
+for jid, info in obj.roster.items():
+gajim.nec.push_incoming_event(RosterInfoEvent(None,
+conn=self, jid=jid, nickname=info['name'],
+sub=info['subscription'], ask=info['ask'],
+groups=info['groups']))
 
 def _send_first_presence(self, signed=''):
 show = self.continue_connect_info[0]
diff -r 940f04599f4a -r 30010db4d1cd src/common/connection_handlers_events.py
--- a/src/common/connection_handlers_events.py  Tue Oct 19 17:21:11 2010 +0200
+++ b/src/common/connection_handlers_events.py  Tue Oct 19 18:14:30 2010 +0200
@@ -307,27 +307,39 @@
 base_network_events = []
 
 def generate(self):
-self.version = self.xmpp_roster.version
-self.received_from_server = self.xmpp_roster.received_from_server
-self.roster = {}
-raw_roster = self.xmpp_roster.getRaw()
-our_jid = gajim.get_jid_from_account(self.conn.name)
+if hasattr(self, 'xmpp_roster'):
+self.version = self.xmpp_roster.version
+self.received_from_server = self.xmpp_roster.received_from_server
+self.roster = {}
+raw_roster = self.xmpp_roster.getRaw()
+our_jid = gajim.get_jid_from_account(self.conn.name)
 
-for jid in raw_roster:
-try:
-j = helpers.parse_jid(jid)
-except Exception:
-print >> sys.stderr, _('JID %s is not RFC compliant. It will 
not be added to your roster. Use roster management tools such as 
http://jru.jabberstudio.org/ to remove it') % jid
-else:
-infos = raw_roster[jid]
-if jid != our_jid and (not infos['subscription'] or \
-infos['subscription'] == 'none') and (not infos['ask'] or \
-

gajim: fix var name. Fixes #5984

2010-10-19 Thread Yann Leboulanger
changeset 940f04599f4a in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=940f04599f4a
description: fix var name. Fixes #5984

diffstat:

 src/common/connection.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 8c0c42562886 -r 940f04599f4a src/common/connection.py
--- a/src/common/connection.py  Tue Oct 19 17:19:13 2010 +0200
+++ b/src/common/connection.py  Tue Oct 19 17:21:11 2010 +0200
@@ -2317,7 +2317,7 @@
 item.setTagData(i, form[i])
 def _on_response(resp):
 gajim.nec.push_incoming_event(SearchResultReceivedEvent(None,
-conn=self, iq_obj=resp))
+conn=self, stanza=resp))
 
 self.connection.SendAndCallForResponse(iq, _on_response)
 
___
Commits mailing list
Commits@gajim.org
http://lists.gajim.org/cgi-bin/listinfo/commits


gajim: don't reply to XEP-184 requests when we fail to decrypt m...

2010-10-19 Thread Yann Leboulanger
changeset 8c0c42562886 in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=8c0c42562886
description: don't reply to XEP-184 requests when we fail to decrypt messages

diffstat:

 src/common/connection_handlers.py |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (11 lines):

diff -r c55b6c38d1c5 -r 8c0c42562886 src/common/connection_handlers.py
--- a/src/common/connection_handlers.py Tue Oct 19 11:43:17 2010 +0200
+++ b/src/common/connection_handlers.py Tue Oct 19 17:19:13 2010 +0200
@@ -1417,6 +1417,7 @@
 except Exception:
 self.dispatch('FAILED_DECRYPT', (obj.fjid, obj.timestamp,
 obj.session))
+return
 
 if obj.enc_tag and self.USE_GPG:
 encmsg = obj.enc_tag.getData()
___
Commits mailing list
Commits@gajim.org
http://lists.gajim.org/cgi-bin/listinfo/commits


gajim: check receipt (XEP-184) requests / answers only after sta...

2010-10-19 Thread Yann Leboulanger
changeset c55b6c38d1c5 in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=c55b6c38d1c5
description: check receipt (XEP-184) requests / answers only after stanza is 
decrypted

diffstat:

 src/common/connection_handlers.py|  45 ---
 src/common/connection_handlers_events.py |  10 --
 2 files changed, 29 insertions(+), 26 deletions(-)

diffs (96 lines):

diff -r 1ef848da72c1 -r c55b6c38d1c5 src/common/connection_handlers.py
--- a/src/common/connection_handlers.py Tue Oct 19 10:47:43 2010 +0200
+++ b/src/common/connection_handlers.py Tue Oct 19 11:43:17 2010 +0200
@@ -1418,28 +1418,6 @@
 self.dispatch('FAILED_DECRYPT', (obj.fjid, obj.timestamp,
 obj.session))
 
-# Receipt requested
-# TODO: We shouldn't answer if we're invisible!
-contact = gajim.contacts.get_contact(self.name, obj.jid)
-nick = obj.resource
-gc_contact = gajim.contacts.get_gc_contact(self.name, obj.jid, nick)
-if obj.receipt_request_tag and gajim.config.get_per('accounts',
-self.name, 'answer_receipts') and ((contact and contact.sub \
-not in (u'to', u'none')) or gc_contact) and obj.mtype != 'error':
-receipt = common.xmpp.Message(to=obj.fjid, typ='chat')
-receipt.setID(obj.id_)
-receipt.setTag('received', namespace='urn:xmpp:receipts',
-attrs={'id': obj.id_})
-
-if obj.thread_id:
-receipt.setThread(obj.thread_id)
-self.connection.send(receipt)
-
-# We got our message's receipt
-if obj.receipt_received_tag and obj.session.control and \
-gajim.config.get_per('accounts', self.name, 'request_receipt'):
-obj.session.control.conv_textview.hide_xep0184_warning(obj.id_)
-
 if obj.enc_tag and self.USE_GPG:
 encmsg = obj.enc_tag.getData()
 
@@ -1463,6 +1441,29 @@
 def _nec_decrypted_message_received(self, obj):
 if obj.conn.name != self.name:
 return
+
+# Receipt requested
+# TODO: We shouldn't answer if we're invisible!
+contact = gajim.contacts.get_contact(self.name, obj.jid)
+nick = obj.resource
+gc_contact = gajim.contacts.get_gc_contact(self.name, obj.jid, nick)
+if obj.receipt_request_tag and gajim.config.get_per('accounts',
+self.name, 'answer_receipts') and ((contact and contact.sub \
+not in (u'to', u'none')) or gc_contact) and obj.mtype != 'error':
+receipt = common.xmpp.Message(to=obj.fjid, typ='chat')
+receipt.setID(obj.id_)
+receipt.setTag('received', namespace='urn:xmpp:receipts',
+attrs={'id': obj.id_})
+
+if obj.thread_id:
+receipt.setThread(obj.thread_id)
+self.connection.send(receipt)
+
+# We got our message's receipt
+if obj.receipt_received_tag and obj.session.control and \
+gajim.config.get_per('accounts', self.name, 'request_receipt'):
+obj.session.control.conv_textview.hide_xep0184_warning(obj.id_)
+
 if obj.mtype == 'error':
 self.dispatch_error_message(msg, msgtxt, session, frm, tim)
 elif obj.mtype == 'groupchat':
diff -r 1ef848da72c1 -r c55b6c38d1c5 src/common/connection_handlers_events.py
--- a/src/common/connection_handlers_events.py  Tue Oct 19 10:47:43 2010 +0200
+++ b/src/common/connection_handlers_events.py  Tue Oct 19 11:43:17 2010 +0200
@@ -972,10 +972,6 @@
 if xep_200_encrypted:
 self.encrypted = 'xep200'
 
-self.receipt_request_tag = self.stanza.getTag('request',
-namespace=xmpp.NS_RECEIPTS)
-self.receipt_received_tag = self.stanza.getTag('received',
-namespace=xmpp.NS_RECEIPTS)
 return True
 
 class GcInvitationReceivedEvent(nec.NetworkIncomingEvent):
@@ -1006,6 +1002,7 @@
 
 def generate(self):
 self.stanza = self.msg_obj.stanza
+self.id_ = self.msg_obj.id_
 self.jid = self.msg_obj.jid
 self.fjid = self.msg_obj.fjid
 self.resource = self.msg_obj.resource
@@ -1017,6 +1014,11 @@
 self.session = self.msg_obj.session
 self.timestamp = self.msg_obj.timestamp
 self.encrypted = self.msg_obj.encrypted
+
+self.receipt_request_tag = self.stanza.getTag('request',
+namespace=xmpp.NS_RECEIPTS)
+self.receipt_received_tag = self.stanza.getTag('received',
+namespace=xmpp.NS_RECEIPTS)
 return True
 
 class GcMessageReceivedEvent(nec.NetworkIncomingEvent):
___
Commits mailing list
Commits@gajim.org
http://lists.gajim.org/cgi-bin/listinfo/commits


gajim: fix receiving encrypted messages. fixes #5982

2010-10-19 Thread Yann Leboulanger
changeset 1ef848da72c1 in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=1ef848da72c1
description: fix receiving encrypted messages. fixes #5982

diffstat:

 src/common/connection_handlers.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 9a451418d910 -r 1ef848da72c1 src/common/connection_handlers.py
--- a/src/common/connection_handlers.py Tue Oct 19 09:30:25 2010 +0200
+++ b/src/common/connection_handlers.py Tue Oct 19 10:47:43 2010 +0200
@@ -1412,7 +1412,7 @@
 return
 if obj.encrypted == 'xep200':
 try:
-obj.stanza = self.session.decrypt_stanza(obj.stanza)
+obj.stanza = obj.session.decrypt_stanza(obj.stanza)
 obj.msgtxt = obj.stanza.getBody()
 except Exception:
 self.dispatch('FAILED_DECRYPT', (obj.fjid, obj.timestamp,
___
Commits mailing list
Commits@gajim.org
http://lists.gajim.org/cgi-bin/listinfo/commits


gajim: [Dicson] Fix typo. Fixes #5983

2010-10-19 Thread Yann Leboulanger
changeset 9a451418d910 in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=9a451418d910
description: [Dicson] Fix typo. Fixes #5983

diffstat:

 src/remote_control.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r ccb661a03d1f -r 9a451418d910 src/remote_control.py
--- a/src/remote_control.py Tue Oct 19 07:03:45 2010 +0200
+++ b/src/remote_control.py Tue Oct 19 09:30:25 2010 +0200
@@ -173,7 +173,7 @@
 def on_gc_message_received(self, obj):
 self.raise_signal('GCMessage', (obj.conn.name, [obj.fjid, obj.msgtxt,
 obj.timestamp, obj.has_timestamp, obj.xhtml_msgtxt, 
obj.status_code,
-obj.displaymarking, obj.captcha_form, obj.needs_highlight)
+obj.displaymarking, obj.captcha_form, obj.needs_highlight])
 
 def raise_signal(self, signal, arg):
 if self.signal_object:
___
Commits mailing list
Commits@gajim.org
http://lists.gajim.org/cgi-bin/listinfo/commits