Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann Leboulanger <asterix@lagaule.org>2004-05-05 05:12:08 +0400
committerYann Leboulanger <asterix@lagaule.org>2004-05-05 05:12:08 +0400
commit133c635c83c8b815b062aef17e2026944c1b1bf6 (patch)
tree77408702800441d26b7a9dd3d79bb66a897001a1 /plugins
parent4e9f627a053ea6463290dcc91573de356cd89314 (diff)
Support for proxy
Diffstat (limited to 'plugins')
-rw-r--r--plugins/gtkgui/gtkgui.glade187
-rw-r--r--plugins/gtkgui/gtkgui.py68
2 files changed, 231 insertions, 24 deletions
diff --git a/plugins/gtkgui/gtkgui.glade b/plugins/gtkgui/gtkgui.glade
index 36aea6c41..7b58d629e 100644
--- a/plugins/gtkgui/gtkgui.glade
+++ b/plugins/gtkgui/gtkgui.glade
@@ -1287,18 +1287,183 @@ Yann Le Boulanger (asterix@crans.org)</property>
</child>
<child>
- <widget class="GtkLabel" id="label12">
+ <widget class="GtkVBox" id="vbox25">
<property name="visible">True</property>
- <property name="label" translatable="yes">Empty</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="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkFrame" id="frame12">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0.5</property>
+ <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox35">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkTable" id="table14">
+ <property name="border_width">5</property>
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">5</property>
+ <property name="column_spacing">5</property>
+
+ <child>
+ <widget class="GtkEntry" id="entry_proxyport">
+ <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" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label136">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Port:</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</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="entry_proxyhost">
+ <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" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label135">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Host:</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</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="checkbutton_proxy">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Use proxy</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label134">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Proxy</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>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="tab_expand">False</property>
diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py
index 5a9884aab..e0d318250 100644
--- a/plugins/gtkgui/gtkgui.py
+++ b/plugins/gtkgui/gtkgui.py
@@ -597,6 +597,13 @@ class accountPreference_Window:
self.xml.get_widget("entry_password").set_text(infos['password'])
if infos.has_key('ressource'):
self.xml.get_widget("entry_ressource").set_text(infos['ressource'])
+ if infos.has_key('use_proxy'):
+ self.xml.get_widget("checkbutton_proxy").set_active(infos['use_proxy'])
+ if infos.has_key('proxyhost'):
+ self.xml.get_widget("entry_proxyhost").set_text(infos['proxyhost'])
+ if infos.has_key('proxyport'):
+ self.xml.get_widget("entry_proxyport").set_text('%i'%\
+ infos['proxyport'])
def on_save_clicked(self, widget):
"""When save button is clicked : Save informations in config file"""
@@ -605,6 +612,14 @@ class accountPreference_Window:
check = self.xml.get_widget("checkbutton")
entryName = self.xml.get_widget("entry_name")
entryJid = self.xml.get_widget("entry_jid")
+ checkProxy = self.xml.get_widget("checkbutton_proxy")
+ if checkProxy.get_active():
+ useProxy = 1
+ else:
+ useProxy = 0
+ entryProxyhost = self.xml.get_widget("entry_proxyhost")
+ entryProxyport = self.xml.get_widget("entry_proxyport")
+ proxyPort = entryProxyport.get_text()
name = entryName.get_text()
jid = entryJid.get_text()
if (name == ''):
@@ -614,8 +629,13 @@ class accountPreference_Window:
warning_Window('You must enter a Jabber ID for this account\n\
For example : login@hostname')
return 0
- else:
- (login, hostname) = string.split(jid, '@')
+ if proxyPort != '':
+ try:
+ proxyPort = string.atoi(proxyPort)
+ except ValueError:
+ warning_Window('Proxy Port must be a port number')
+ return 0
+ (login, hostname) = string.split(jid, '@')
#if we are modifying an account
if self.modify:
#if we modify the name of the account
@@ -639,7 +659,8 @@ class accountPreference_Window:
self.plugin.send('ACC_CHG', self.account, name)
self.plugin.accounts[name] = {'name': login, 'hostname': hostname,\
'password': entryPass.get_text(), 'ressource': \
- entryRessource.get_text()}
+ entryRessource.get_text(), 'use_proxy': useProxy, 'proxyhost': \
+ entryProxyhost.get_text(), 'proxyport': proxyPort}
self.plugin.send('CONFIG', None, ('accounts', self.plugin.accounts))
#refresh accounts window
if self.plugin.windows.has_key('accounts'):
@@ -656,12 +677,15 @@ class accountPreference_Window:
#if we neeed to register a new account
if check.get_active():
self.plugin.send('NEW_ACC', None, (hostname, login, \
- entryPass.get_text(), name, entryRessource.get_text()))
+ entryPass.get_text(), name, entryRessource.get_text(), \
+ checkProxy.get_active(), entryProxyhost.get_text(), \
+ entryProxyport.get_text()))
check.set_active(FALSE)
return
self.plugin.accounts[name] = {'name': login, 'hostname': hostname,\
'password': entryPass.get_text(), 'ressource': \
- entryRessource.get_text()}
+ entryRessource.get_text(), 'use_proxy': useProxy, 'proxyhost': \
+ entryProxyhost.get_text(), 'proxyport': proxyPort}
self.plugin.send('CONFIG', None, ('accounts', self.plugin.accounts))
#update variables
self.plugin.windows[name] = {'infos': {}, 'chats': {}}
@@ -766,10 +790,19 @@ class accounts_Window:
(model, iter) = sel.get_selected()
account = model.get_value(iter, 0)
infos['name'] = account
- infos['jid'] = self.plugin.accounts[account]["name"] + \
- '@' + self.plugin.accounts[account]["hostname"]
- infos['password'] = self.plugin.accounts[account]["password"]
- infos['ressource'] = self.plugin.accounts[account]["ressource"]
+ if self.plugin.accounts[account].has_key("name"):
+ infos['jid'] = self.plugin.accounts[account]["name"] + \
+ '@' + self.plugin.accounts[account]["hostname"]
+ if self.plugin.accounts[account].has_key("password"):
+ infos['password'] = self.plugin.accounts[account]["password"]
+ if self.plugin.accounts[account].has_key("ressource"):
+ infos['ressource'] = self.plugin.accounts[account]["ressource"]
+ if self.plugin.accounts[account].has_key("use_proxy"):
+ infos['use_proxy'] = self.plugin.accounts[account]["use_proxy"]
+ if self.plugin.accounts[account].has_key("proxyhost"):
+ infos['proxyhost'] = self.plugin.accounts[account]["proxyhost"]
+ if self.plugin.accounts[account].has_key("proxyport"):
+ infos['proxyport'] = self.plugin.accounts[account]["proxyport"]
self.plugin.windows['accountPreference'] = \
accountPreference_Window(self.plugin, infos)
@@ -1521,10 +1554,19 @@ class roster_Window:
if not self.plugin.windows.has_key('accountPreference'):
infos = {}
infos['name'] = account
- infos['jid'] = self.plugin.accounts[account]["name"] + \
- '@' + self.plugin.accounts[account]["hostname"]
- infos['password'] = self.plugin.accounts[account]["password"]
- infos['ressource'] = self.plugin.accounts[account]["ressource"]
+ if self.plugin.accounts[account].has_key("name"):
+ infos['jid'] = self.plugin.accounts[account]["name"] + \
+ '@' + self.plugin.accounts[account]["hostname"]
+ if self.plugin.accounts[account].has_key("password"):
+ infos['password'] = self.plugin.accounts[account]["password"]
+ if self.plugin.accounts[account].has_key("ressource"):
+ infos['ressource'] = self.plugin.accounts[account]["ressource"]
+ if self.plugin.accounts[account].has_key("use_proxy"):
+ infos['use_proxy'] = self.plugin.accounts[account]["use_proxy"]
+ if self.plugin.accounts[account].has_key("proxyhost"):
+ infos['proxyhost'] = self.plugin.accounts[account]["proxyhost"]
+ if self.plugin.accounts[account].has_key("proxyport"):
+ infos['proxyport'] = self.plugin.accounts[account]["proxyport"]
self.plugin.windows['accountPreference'] = \
accountPreference_Window(self.plugin, infos)