Author: sb Date: 2006-07-27 22:36:21 +0200 (Thu, 27 Jul 2006) New Revision: 6611
Modified: branches/zeroconf_network/src/common/zeroconf/client_zeroconf.py branches/zeroconf_network/src/common/zeroconf/connection_handlers_zeroconf.py branches/zeroconf_network/src/common/zeroconf/connection_zeroconf.py branches/zeroconf_network/src/common/zeroconf/roster_zeroconf.py branches/zeroconf_network/src/common/zeroconf/zeroconf.py Log: display full name on roster if available
Modified: branches/zeroconf_network/src/common/zeroconf/client_zeroconf.py =================================================================== --- branches/zeroconf_network/src/common/zeroconf/client_zeroconf.py 2006-07-27 10:54:12 UTC (rev 6610) +++ branches/zeroconf_network/src/common/zeroconf/client_zeroconf.py 2006-07-27 20:36:21 UTC (rev 6611) @@ -1,4 +1,18 @@ +## common/zeroconf/client_zeroconf.py +## +## Copyright (C) 2006 Stefan Bethge stefan@lanpartei.de +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published +## by the Free Software Foundation; version 2 only. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +##
+ from common.zeroconf import roster_zeroconf
class ClientZeroconf:
Modified: branches/zeroconf_network/src/common/zeroconf/connection_handlers_zeroconf.py =================================================================== --- branches/zeroconf_network/src/common/zeroconf/connection_handlers_zeroconf.py 2006-07-27 10:54:12 UTC (rev 6610) +++ branches/zeroconf_network/src/common/zeroconf/connection_handlers_zeroconf.py 2006-07-27 20:36:21 UTC (rev 6611) @@ -6,6 +6,7 @@ ## - Nikos Kouremenos nkour@jabber.org ## - Dimitur Kirov dkirov@gmail.com ## - Travis Shirk travis@pobox.com +## - Stefan Bethge stefan@lanpartei.de ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published
Modified: branches/zeroconf_network/src/common/zeroconf/connection_zeroconf.py =================================================================== --- branches/zeroconf_network/src/common/zeroconf/connection_zeroconf.py 2006-07-27 10:54:12 UTC (rev 6610) +++ branches/zeroconf_network/src/common/zeroconf/connection_zeroconf.py 2006-07-27 20:36:21 UTC (rev 6611) @@ -1,19 +1,21 @@ -## common/connection_zeroconf.py +## common/zeroconf/connection_zeroconf.py ## ## Contributors for this file: ## - Yann Le Boulanger asterix@lagaule.org ## - Nikos Kouremenos nkour@jabber.org ## - Dimitur Kirov dkirov@gmail.com ## - Travis Shirk travis@pobox.com +## - Stefan Bethge stefan@lanpartei.de ## ## Copyright (C) 2003-2004 Yann Le Boulanger asterix@lagaule.org ## Vincent Hanquez tab@snarc.org -## Copyright (C) 2005 Yann Le Boulanger asterix@lagaule.org +## Copyright (C) 2006 Yann Le Boulanger asterix@lagaule.org ## Vincent Hanquez tab@snarc.org ## Nikos Kouremenos nkour@jabber.org ## Dimitur Kirov dkirov@gmail.com ## Travis Shirk travis@pobox.com ## Norman Rasmussen norman@rasmussen.co.za +## Stefan Bethge stefan@lanpartei.de ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published @@ -121,14 +123,11 @@ '''always passes account name as first param''' self.put_event((event, data))
- def _reconnect(self): gajim.log.debug('reconnect')
signed = self.get_signed_msg(self.status) - - def quit(self, kill_core): if kill_core and self.connected > 1: @@ -172,9 +171,9 @@
# callbacks called from zeroconf def _on_new_service(self,jid): - self.roster.setItem(jid) + self.roster.setItem(jid) display_jid = self.zeroconf.check_jid(jid) - self.dispatch('ROSTER_INFO', (display_jid, display_jid, 'both', 'no', self.roster.getGroups(jid))) + self.dispatch('ROSTER_INFO', (display_jid, self.roster.getName(jid), 'both', 'no', self.roster.getGroups(jid))) self.dispatch('NOTIFY', (display_jid, self.roster.getStatus(jid), self.roster.getMessage(jid), 'local', 0, None, 0)) @@ -198,7 +197,7 @@ #display contacts already detected and resolved for jid in self.roster.keys(): display_jid = self.zeroconf.check_jid(jid) - self.dispatch('ROSTER_INFO', (display_jid, display_jid, 'both', 'no', self.roster.getGroups(jid))) + self.dispatch('ROSTER_INFO', (display_jid, self.roster.getName(jid), 'both', 'no', self.roster.getGroups(jid))) self.dispatch('NOTIFY', (display_jid, self.roster.getStatus(jid), self.roster.getMessage(jid), 'local', 0, None, 0))
self.connected = STATUS_LIST.index(show)
Modified: branches/zeroconf_network/src/common/zeroconf/roster_zeroconf.py =================================================================== --- branches/zeroconf_network/src/common/zeroconf/roster_zeroconf.py 2006-07-27 10:54:12 UTC (rev 6610) +++ branches/zeroconf_network/src/common/zeroconf/roster_zeroconf.py 2006-07-27 20:36:21 UTC (rev 6611) @@ -1,3 +1,18 @@ +## common/zeroconf/roster_zeroconf.py +## +## Copyright (C) 2006 Stefan Bethge stefan@lanpartei.de +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published +## by the Free Software Foundation; version 2 only. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## + + from common.zeroconf import zeroconf
class Roster: @@ -36,7 +51,6 @@ = self.zeroconf.get_contact(jid)
self._data[jid]={} - self._data[jid]['name']=jid[:jid.find('@')] self._data[jid]['ask'] = 'no' #? self._data[jid]['subscription'] = 'both' self._data[jid]['groups'] = [] @@ -49,6 +63,10 @@ status = txt_dict['status'] else: status = '' + if txt_dict.has_key('1st') and txt_dict.has_key('last'): + self._data[jid]['name']=txt_dict['1st']+' '+txt_dict['last'] + else: + self._data[jid]['name']=jid if status == 'avail': status = 'online' self._data[jid]['txt_dict'] = txt_dict if not self._data[jid]['txt_dict'].has_key('msg'): @@ -91,7 +109,10 @@ def getGroups(self, jid): return self._data[jid]['groups'] - + def getName(self, jid): + if self._data.has_key(jid): + return self._data[jid]['name'] + def getStatus(self, jid): if self._data.has_key(jid): return self._data[jid]['status']
Modified: branches/zeroconf_network/src/common/zeroconf/zeroconf.py =================================================================== --- branches/zeroconf_network/src/common/zeroconf/zeroconf.py 2006-07-27 10:54:12 UTC (rev 6610) +++ branches/zeroconf_network/src/common/zeroconf/zeroconf.py 2006-07-27 20:36:21 UTC (rev 6611) @@ -1,3 +1,17 @@ +## common/zeroconf/zeroconf.py +## +## Copyright (C) 2006 Stefan Bethge stefan@lanpartei.de +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published +## by the Free Software Foundation; version 2 only. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## + import os import sys import socket @@ -95,6 +109,8 @@ return items def service_resolved_callback(self, interface, protocol, name, stype, domain, host, aprotocol, address, port, txt, flags): + print "Service data for service '%s' in domain '%s' on %i.%i:" % (name, domain, interface, protocol) + print "\tHost %s (%s), port %i, TXT data: %s" % (host, address, port, str(avahi.txt_array_to_string_array(txt))) self.contacts[name] = (name, domain, interface, protocol, host, address, port, txt) self.new_serviceCB(name)
@@ -155,7 +171,7 @@
self.txt['port.p2pj'] = self.port self.txt['version'] = 1 - self.txt['textvers'] = 1 + self.txt['txtvers'] = 1 # replace gajim's status messages with proper ones if self.txt.has_key('status'):