register a new account on a server is now possible
This commit is contained in:
parent
42ae1c5d73
commit
d07afbaf50
21
core/core.py
21
core/core.py
|
@ -175,6 +175,26 @@ class GajimCore:
|
||||||
self.hub.sendPlugin('AGENT_INFO', (ev[1], agent_info))
|
self.hub.sendPlugin('AGENT_INFO', (ev[1], agent_info))
|
||||||
elif ev[0] == 'REG_AGENT':
|
elif ev[0] == 'REG_AGENT':
|
||||||
self.con.sendRegInfo(ev[1])
|
self.con.sendRegInfo(ev[1])
|
||||||
|
#('NEW_ACC', (hostname, login, password, name, ressource))
|
||||||
|
elif ev[0] == 'NEW_ACC':
|
||||||
|
c = common.jabber.Client(host = \
|
||||||
|
ev[1][0], debug = False, log = sys.stderr)
|
||||||
|
try:
|
||||||
|
c.connect()
|
||||||
|
except IOError, e:
|
||||||
|
log.debug("Couldn't connect to %s %s" % (hostname, e))
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
log.debug("Connected to server")
|
||||||
|
c.requestRegInfo()
|
||||||
|
req = c.getRegInfo()
|
||||||
|
c.setRegInfo( 'username', ev[1][1])
|
||||||
|
c.setRegInfo( 'password', ev[1][2])
|
||||||
|
#FIXME: if users already exist, no error message :(
|
||||||
|
if not c.sendRegInfo():
|
||||||
|
print "error " + c.lastErr
|
||||||
|
else:
|
||||||
|
self.hub.sendPlugin('ACC_OK', ev[1])
|
||||||
else:
|
else:
|
||||||
log.debug("Unknown Command")
|
log.debug("Unknown Command")
|
||||||
elif self.connected == 1:
|
elif self.connected == 1:
|
||||||
|
@ -197,6 +217,7 @@ def loadPlugins(gc):
|
||||||
gc.hub.register(mod, 'AGENTS')
|
gc.hub.register(mod, 'AGENTS')
|
||||||
gc.hub.register(mod, 'AGENT_INFO')
|
gc.hub.register(mod, 'AGENT_INFO')
|
||||||
gc.hub.register(mod, 'QUIT')
|
gc.hub.register(mod, 'QUIT')
|
||||||
|
gc.hub.register(mod, 'ACC_OK')
|
||||||
modObj.load()
|
modObj.load()
|
||||||
# END loadPLugins
|
# END loadPLugins
|
||||||
|
|
||||||
|
|
|
@ -499,8 +499,8 @@
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="padding">0</property>
|
||||||
<property name="expand">True</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
@ -994,16 +994,16 @@ David Ferlier (david@yazzy.org)</property>
|
||||||
<widget class="GtkTable" id="table1">
|
<widget class="GtkTable" id="table1">
|
||||||
<property name="border_width">5</property>
|
<property name="border_width">5</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="n_rows">3</property>
|
<property name="n_rows">4</property>
|
||||||
<property name="n_columns">2</property>
|
<property name="n_columns">2</property>
|
||||||
<property name="homogeneous">False</property>
|
<property name="homogeneous">False</property>
|
||||||
<property name="row_spacing">5</property>
|
<property name="row_spacing">5</property>
|
||||||
<property name="column_spacing">5</property>
|
<property name="column_spacing">5</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label9">
|
<widget class="GtkLabel" id="label11">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes">Jabber ID:</property>
|
<property name="label" translatable="yes">Ressource: </property>
|
||||||
<property name="use_underline">False</property>
|
<property name="use_underline">False</property>
|
||||||
<property name="use_markup">False</property>
|
<property name="use_markup">False</property>
|
||||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
|
@ -1017,34 +1017,13 @@ David Ferlier (david@yazzy.org)</property>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
<property name="right_attach">1</property>
|
<property name="right_attach">1</property>
|
||||||
<property name="top_attach">0</property>
|
<property name="top_attach">3</property>
|
||||||
<property name="bottom_attach">1</property>
|
<property name="bottom_attach">4</property>
|
||||||
<property name="x_options">fill</property>
|
<property name="x_options">fill</property>
|
||||||
<property name="y_options"></property>
|
<property name="y_options"></property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkEntry" id="entry_jid">
|
|
||||||
<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">0</property>
|
|
||||||
<property name="bottom_attach">1</property>
|
|
||||||
<property name="y_options"></property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label10">
|
<widget class="GtkLabel" id="label10">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -1059,6 +1038,30 @@ David Ferlier (david@yazzy.org)</property>
|
||||||
<property name="xpad">0</property>
|
<property name="xpad">0</property>
|
||||||
<property name="ypad">0</property>
|
<property name="ypad">0</property>
|
||||||
</widget>
|
</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="GtkLabel" id="label9">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Jabber ID:</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>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
<property name="right_attach">1</property>
|
<property name="right_attach">1</property>
|
||||||
|
@ -1069,6 +1072,27 @@ David Ferlier (david@yazzy.org)</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkEntry" id="entry_ressource">
|
||||||
|
<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">Gajim</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">3</property>
|
||||||
|
<property name="bottom_attach">4</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkEntry" id="entry_password">
|
<widget class="GtkEntry" id="entry_password">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -1084,38 +1108,14 @@ David Ferlier (david@yazzy.org)</property>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="right_attach">2</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="label11">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">Ressource: </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="top_attach">2</property>
|
||||||
<property name="bottom_attach">3</property>
|
<property name="bottom_attach">3</property>
|
||||||
<property name="x_options">fill</property>
|
|
||||||
<property name="y_options"></property>
|
<property name="y_options"></property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkEntry" id="entry_ressource">
|
<widget class="GtkEntry" id="entry_jid">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="editable">True</property>
|
<property name="editable">True</property>
|
||||||
|
@ -1129,8 +1129,30 @@ David Ferlier (david@yazzy.org)</property>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="right_attach">2</property>
|
<property name="right_attach">2</property>
|
||||||
<property name="top_attach">2</property>
|
<property name="top_attach">1</property>
|
||||||
<property name="bottom_attach">3</property>
|
<property name="bottom_attach">2</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkCheckButton" id="checkbutton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="label" translatable="yes">Register new account</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">0</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
<property name="bottom_attach">1</property>
|
||||||
|
<property name="x_padding">26</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
<property name="y_options"></property>
|
<property name="y_options"></property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -2400,4 +2422,100 @@ David Ferlier (david@yazzy.org)</property>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
|
<widget class="GtkDialog" id="Warning">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="title" translatable="yes">Warning</property>
|
||||||
|
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||||
|
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||||
|
<property name="modal">True</property>
|
||||||
|
<property name="resizable">True</property>
|
||||||
|
<property name="destroy_with_parent">False</property>
|
||||||
|
<property name="has_separator">True</property>
|
||||||
|
|
||||||
|
<child internal-child="vbox">
|
||||||
|
<widget class="GtkVBox" id="dialog-vbox2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="homogeneous">False</property>
|
||||||
|
<property name="spacing">0</property>
|
||||||
|
|
||||||
|
<child internal-child="action_area">
|
||||||
|
<widget class="GtkHButtonBox" id="Message">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="layout_style">GTK_BUTTONBOX_EDGE</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkButton" id="closebutton1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_default">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="label">gtk-close</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
<property name="response_id">-7</property>
|
||||||
|
<signal name="clicked" handler="gtk_widget_destroy" last_modification_time="Sat, 13 Dec 2003 20:39:21 GMT"/>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">3</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="pack_type">GTK_PACK_END</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="GtkImage" id="image108">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="stock">gtk-dialog-warning</property>
|
||||||
|
<property name="icon_size">6</property>
|
||||||
|
<property name="xalign">1</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">6</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Message</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="padding">0</property>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
|
||||||
</glade-interface>
|
</glade-interface>
|
||||||
|
|
|
@ -79,6 +79,16 @@ class add:
|
||||||
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
||||||
self.xml.signal_connect('on_button_sub_clicked', self.on_subscribe)
|
self.xml.signal_connect('on_button_sub_clicked', self.on_subscribe)
|
||||||
|
|
||||||
|
class warning:
|
||||||
|
def delete_event(self, widget):
|
||||||
|
self.window.destroy()
|
||||||
|
|
||||||
|
def __init__(self, txt):
|
||||||
|
self.xml = gtk.glade.XML('plugins/gtkgui/gtkgui.glade', 'Warning')
|
||||||
|
self.window = self.xml.get_widget("Warning")
|
||||||
|
self.xml.get_widget('label').set_text(txt)
|
||||||
|
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
||||||
|
|
||||||
class about:
|
class about:
|
||||||
def delete_event(self, widget):
|
def delete_event(self, widget):
|
||||||
self.Wabout.destroy()
|
self.Wabout.destroy()
|
||||||
|
@ -103,12 +113,19 @@ class account_pref:
|
||||||
self.xml.get_widget("entry_ressource").set_text(infos['ressource'])
|
self.xml.get_widget("entry_ressource").set_text(infos['ressource'])
|
||||||
|
|
||||||
def on_save_clicked(self, widget):
|
def on_save_clicked(self, widget):
|
||||||
# accountsStr = self.cfgParser.Profile_accounts
|
|
||||||
# accounts = string.split(accountsStr, ' ')
|
|
||||||
name = self.xml.get_widget("entry_name").get_text()
|
name = self.xml.get_widget("entry_name").get_text()
|
||||||
|
jid = self.xml.get_widget('entry_jid').get_text()
|
||||||
if (name == ''):
|
if (name == ''):
|
||||||
|
warning('You must enter a name for this account')
|
||||||
return 0
|
return 0
|
||||||
|
if (jid == '') or (string.count(jid, '@') != 1):
|
||||||
|
warning('You must enter a Jabber ID for this account\nFor example : login@hostname')
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
(login, hostname) = string.split(jid, '@')
|
||||||
|
#if we are modifying an account
|
||||||
if self.mod:
|
if self.mod:
|
||||||
|
#if we modify the name of the account
|
||||||
if name != self.acc:
|
if name != self.acc:
|
||||||
self.cfgParser.remove_section(self.acc)
|
self.cfgParser.remove_section(self.acc)
|
||||||
self.accs.accounts.remove(self.acc)
|
self.accs.accounts.remove(self.acc)
|
||||||
|
@ -116,15 +133,22 @@ class account_pref:
|
||||||
self.accs.accounts.append(name)
|
self.accs.accounts.append(name)
|
||||||
accountsStr = string.join(self.accs.accounts)
|
accountsStr = string.join(self.accs.accounts)
|
||||||
self.cfgParser.set('Profile', 'accounts', accountsStr)
|
self.cfgParser.set('Profile', 'accounts', accountsStr)
|
||||||
|
#if it's a new account
|
||||||
else:
|
else:
|
||||||
if name in self.accs.accounts:
|
if name in self.accs.accounts:
|
||||||
|
warning('An account already has this name')
|
||||||
return 0
|
return 0
|
||||||
else:
|
#if we neeed to register a new account
|
||||||
self.cfgParser.add_section(name)
|
if self.xml.get_widget('checkbutton').get_active():
|
||||||
self.accs.accounts.append(name)
|
self.accs.r.queueOUT.put(('NEW_ACC', (hostname, login, \
|
||||||
accountsStr = string.join(self.accs.accounts)
|
self.xml.get_widget('entry_password').get_text(), name, \
|
||||||
self.cfgParser.set('Profile', 'accounts', accountsStr)
|
self.xml.get_widget('entry_ressource').get_text())))
|
||||||
(login, hostname) = string.split(self.xml.get_widget("entry_jid").get_text(), '@')
|
self.xml.get_widget('checkbutton').set_active(FALSE)
|
||||||
|
return 1
|
||||||
|
self.cfgParser.add_section(name)
|
||||||
|
self.accs.accounts.append(name)
|
||||||
|
accountsStr = string.join(self.accs.accounts)
|
||||||
|
self.cfgParser.set('Profile', 'accounts', accountsStr)
|
||||||
self.cfgParser.set(name, 'name', login)
|
self.cfgParser.set(name, 'name', login)
|
||||||
self.cfgParser.set(name, 'hostname', hostname)
|
self.cfgParser.set(name, 'hostname', hostname)
|
||||||
self.cfgParser.set(name, 'password', self.xml.get_widget("entry_password").get_text())
|
self.cfgParser.set(name, 'password', self.xml.get_widget("entry_password").get_text())
|
||||||
|
@ -145,6 +169,8 @@ class account_pref:
|
||||||
self.init_account(infos)
|
self.init_account(infos)
|
||||||
else:
|
else:
|
||||||
self.mod = FALSE
|
self.mod = FALSE
|
||||||
|
if self.mod:
|
||||||
|
self.xml.get_widget("checkbutton").set_sensitive(FALSE)
|
||||||
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
||||||
self.xml.signal_connect('on_save_clicked', self.on_save_clicked)
|
self.xml.signal_connect('on_save_clicked', self.on_save_clicked)
|
||||||
|
|
||||||
|
@ -191,9 +217,9 @@ class accounts:
|
||||||
infos['ressource'] = self.cfgParser.__getattr__("%s" % account+"_ressource")
|
infos['ressource'] = self.cfgParser.__getattr__("%s" % account+"_ressource")
|
||||||
account_pref(self, infos)
|
account_pref(self, infos)
|
||||||
|
|
||||||
def __init__(self, accounts):
|
def __init__(self, roster):
|
||||||
self.cfgParser = common.optparser.OptionsParser(CONFPATH)
|
self.r = roster
|
||||||
self.cfgParser.parseCfgFile()
|
self.cfgParser = self.r.cfgParser
|
||||||
self.xml = gtk.glade.XML('plugins/gtkgui/gtkgui.glade', 'Accounts')
|
self.xml = gtk.glade.XML('plugins/gtkgui/gtkgui.glade', 'Accounts')
|
||||||
self.window = self.xml.get_widget("Accounts")
|
self.window = self.xml.get_widget("Accounts")
|
||||||
self.treeview = self.xml.get_widget("treeview")
|
self.treeview = self.xml.get_widget("treeview")
|
||||||
|
@ -208,7 +234,7 @@ class accounts:
|
||||||
renderer = gtk.CellRendererText()
|
renderer = gtk.CellRendererText()
|
||||||
renderer.set_data('column', 1)
|
renderer.set_data('column', 1)
|
||||||
self.treeview.insert_column_with_attributes(-1, 'Server', renderer, text=1)
|
self.treeview.insert_column_with_attributes(-1, 'Server', renderer, text=1)
|
||||||
self.accounts = accounts
|
self.accounts = self.r.accounts
|
||||||
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
||||||
self.xml.signal_connect('on_row_activated', self.on_row_activated)
|
self.xml.signal_connect('on_row_activated', self.on_row_activated)
|
||||||
self.xml.signal_connect('on_new_clicked', self.on_new_clicked)
|
self.xml.signal_connect('on_new_clicked', self.on_new_clicked)
|
||||||
|
@ -603,7 +629,7 @@ class roster:
|
||||||
def on_accounts(self, widget):
|
def on_accounts(self, widget):
|
||||||
global Waccounts
|
global Waccounts
|
||||||
if not Waccounts:
|
if not Waccounts:
|
||||||
Waccounts = accounts(self.accounts)
|
Waccounts = accounts(self)
|
||||||
|
|
||||||
def on_quit(self, widget):
|
def on_quit(self, widget):
|
||||||
self.queueOUT.put(('QUIT',''))
|
self.queueOUT.put(('QUIT',''))
|
||||||
|
@ -832,6 +858,22 @@ class plugin:
|
||||||
Wbrowser.agents(ev[1])
|
Wbrowser.agents(ev[1])
|
||||||
elif ev[0] == 'AGENT_INFO':
|
elif ev[0] == 'AGENT_INFO':
|
||||||
Wreg = agent_reg(ev[1][0], ev[1][1], self.r)
|
Wreg = agent_reg(ev[1][0], ev[1][1], self.r)
|
||||||
|
#('ACC_OK', (hostname, login, pasword, name, ressource))
|
||||||
|
elif ev[0] == 'ACC_OK':
|
||||||
|
print "acc_ok"
|
||||||
|
print ev[1]
|
||||||
|
self.r.cfgParser.add_section(ev[1][3])
|
||||||
|
self.r.accounts.append(ev[1][3])
|
||||||
|
accountsStr = string.join(self.r.accounts)
|
||||||
|
self.r.cfgParser.set('Profile', 'accounts', accountsStr)
|
||||||
|
self.r.cfgParser.set(ev[1][3], 'name', ev[1][1])
|
||||||
|
self.r.cfgParser.set(ev[1][3], 'hostname', ev[1][0])
|
||||||
|
self.r.cfgParser.set(ev[1][3], 'password', ev[1][2])
|
||||||
|
self.r.cfgParser.set(ev[1][3], 'ressource', ev[1][4])
|
||||||
|
self.r.cfgParser.writeCfgFile()
|
||||||
|
self.r.cfgParser.parseCfgFile()
|
||||||
|
if (Waccounts != 0):
|
||||||
|
Waccounts.init_accounts()
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
def __init__(self, quIN, quOUT):
|
def __init__(self, quIN, quOUT):
|
||||||
|
|
Loading…
Reference in New Issue