remove ssl/tls button from zeroconf props,
don't publish empty txt fields
This commit is contained in:
parent
0791277903
commit
341e88864c
|
@ -136,6 +136,95 @@
|
|||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox96">
|
||||
<property name="border_width">6</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox24">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="custom_port_checkbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Use custom port:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_custom_port_checkbutton_toggled" last_modification_time="Wed, 20 Sep 2006 18:29:49 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="custom_port_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="activates_default">False</property>
|
||||
<property name="width_chars">6</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="tab_expand">False</property>
|
||||
<property name="tab_fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label149">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Connection</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTable" id="table1">
|
||||
<property name="border_width">6</property>
|
||||
|
@ -370,116 +459,6 @@
|
|||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox96">
|
||||
<property name="border_width">6</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="use_tls_checkbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Use _TLS</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_use_ssl_checkbutton_toggled" last_modification_time="Tue, 14 Jun 2005 10:44:56 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox24">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="custom_port_checkbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Use custom port:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_custom_port_checkbutton_toggled" last_modification_time="Wed, 20 Sep 2006 18:29:49 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="custom_port_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="activates_default">False</property>
|
||||
<property name="width_chars">6</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="tab_expand">False</property>
|
||||
<property name="tab_fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label149">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Connection</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
|
|
@ -188,6 +188,9 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
|
|||
self.zeroconf.resolve_all()
|
||||
diffs = self.roster.getDiffs()
|
||||
for key in diffs:
|
||||
print key
|
||||
print self.roster.getStatus(key)
|
||||
print self.roster.getMessage(key),
|
||||
self.roster.setItem(key)
|
||||
self.dispatch('NOTIFY', (key, self.roster.getStatus(key), self.roster.getMessage(key), 'local', 0, None, 0))
|
||||
return self.call_resolve_timeout
|
||||
|
@ -258,16 +261,12 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
|
|||
self.call_resolve_timeout = False
|
||||
self.zeroconf.disconnect()
|
||||
|
||||
def reconnect(self, new_port, use_tls):
|
||||
def reconnect(self, new_port):
|
||||
txt = {}
|
||||
txt['1st'] = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, 'zeroconf_first_name')
|
||||
txt['last'] = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, 'zeroconf_last_name')
|
||||
txt['jid'] = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, 'zeroconf_jabber_id')
|
||||
txt['email'] = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, 'zeroconf_email')
|
||||
txt2 = {}
|
||||
for key, val in txt.iteritems():
|
||||
if val != '':
|
||||
txt2[key] = val
|
||||
|
||||
port = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, 'custom_port')
|
||||
|
||||
|
@ -277,7 +276,7 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
|
|||
self.connection.start_listener(port)
|
||||
|
||||
self.zeroconf.remove_announce()
|
||||
self.zeroconf.txt = txt2
|
||||
self.zeroconf.txt = txt
|
||||
self.zeroconf.port = port
|
||||
self.zeroconf.username = self.username
|
||||
self.zeroconf.announce()
|
||||
|
|
|
@ -121,6 +121,7 @@ class Roster:
|
|||
|
||||
def getStatus(self, jid):
|
||||
if self._data.has_key(jid):
|
||||
print 'roster: getStatus: %s' % self._data[jid]['status']
|
||||
return self._data[jid]['status']
|
||||
|
||||
def getMessage(self, jid):
|
||||
|
|
|
@ -201,14 +201,26 @@ class Zeroconf:
|
|||
# create an EntryGroup for publishing
|
||||
self.entrygroup = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, self.server.EntryGroupNew()), avahi.DBUS_INTERFACE_ENTRY_GROUP)
|
||||
self.entrygroup.connect_to_signal('StateChanged', self.entrygroup_state_changed_callback)
|
||||
|
||||
self.txt['port.p2pj'] = self.port
|
||||
self.txt['version'] = 1
|
||||
self.txt['txtvers'] = 1
|
||||
|
||||
txt = {}
|
||||
|
||||
#remove empty keys
|
||||
for key,val in self.txt.iteritems():
|
||||
if val:
|
||||
txt[key] = val
|
||||
|
||||
txt['port.p2pj'] = self.port
|
||||
txt['version'] = 1
|
||||
txt['txtvers'] = 1
|
||||
|
||||
# replace gajim's show messages with compatible ones
|
||||
if self.txt.has_key('status'):
|
||||
self.txt['status'] = self.replace_show(self.txt['status'])
|
||||
txt['status'] = self.replace_show(self.txt['status'])
|
||||
else:
|
||||
txt['status'] = 'avail'
|
||||
|
||||
|
||||
self.txt = txt
|
||||
|
||||
# print "Publishing service '%s' of type %s" % (self.name, self.stype)
|
||||
self.entrygroup.AddService(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, dbus.UInt32(0), self.name, self.stype, '', '', self.port, avahi.dict_to_txt_array(self.txt), reply_handler=self.service_added_callback, error_handler=self.service_add_fail_callback)
|
||||
|
@ -255,7 +267,7 @@ class Zeroconf:
|
|||
return True
|
||||
try:
|
||||
self.bus = dbus.SystemBus()
|
||||
# is there any way to check, if a dbus name exists?
|
||||
# is there any way to check if a dbus name exists?
|
||||
# that might make the Introspect Error go away...
|
||||
self.server = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, \
|
||||
avahi.DBUS_PATH_SERVER), avahi.DBUS_INTERFACE_SERVER)
|
||||
|
@ -317,9 +329,10 @@ class Zeroconf:
|
|||
return self.contacts[jid]
|
||||
|
||||
def update_txt(self, txt):
|
||||
# update only given keys
|
||||
# update only new non-empty keys
|
||||
for key in txt.keys():
|
||||
self.txt[key]=txt[key]
|
||||
if txt[key]:
|
||||
self.txt[key]=txt[key]
|
||||
|
||||
if txt.has_key('status'):
|
||||
self.txt['status'] = self.replace_show(txt['status'])
|
||||
|
|
|
@ -3122,10 +3122,6 @@ class ZeroconfPropertiesWindow:
|
|||
if st:
|
||||
self.xml.get_widget('email_entry').set_text(st)
|
||||
|
||||
st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, 'use_ssl')
|
||||
if st:
|
||||
self.xml.get_widget('use_tls_checkbutton').set_active(st)
|
||||
|
||||
st = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, 'custom_port')
|
||||
if st:
|
||||
self.xml.get_widget('custom_port_entry').set_text(str(st))
|
||||
|
@ -3180,9 +3176,6 @@ class ZeroconfPropertiesWindow:
|
|||
st = self.xml.get_widget('email_entry').get_text()
|
||||
gajim.config.set_per('accounts', gajim.ZEROCONF_ACC_NAME, 'zeroconf_email', st)
|
||||
|
||||
use_tls = self.xml.get_widget('use_tls_checkbutton').get_active()
|
||||
gajim.config.set_per('accounts', gajim.ZEROCONF_ACC_NAME, 'use_ssl', use_tls)
|
||||
|
||||
use_custom_port = self.xml.get_widget('custom_port_checkbutton').get_active()
|
||||
gajim.config.set_per('accounts', gajim.ZEROCONF_ACC_NAME, 'use_custom_host', use_custom_port)
|
||||
|
||||
|
@ -3201,7 +3194,7 @@ class ZeroconfPropertiesWindow:
|
|||
use_custom_port = False
|
||||
|
||||
if gajim.connections.has_key(gajim.ZEROCONF_ACC_NAME):
|
||||
gajim.connections[gajim.ZEROCONF_ACC_NAME].reconnect(use_custom_port, use_tls)
|
||||
gajim.connections[gajim.ZEROCONF_ACC_NAME].reconnect(use_custom_port)
|
||||
|
||||
self.window.destroy()
|
||||
|
||||
|
|
Loading…
Reference in New Issue