when we autoconnect, ask the status message if ask_online_status is set in the preferences
This commit is contained in:
parent
ac17b23836
commit
739c1657dd
3 changed files with 12 additions and 4 deletions
|
@ -274,6 +274,8 @@ class Away_message_dialog:
|
|||
"""Class for Away message dialog"""
|
||||
def run(self):
|
||||
"""Wait for OK button to be pressed and return away messsage"""
|
||||
if self.autoconnect:
|
||||
gtk.gdk.threads_enter()
|
||||
rep = self.window.run()
|
||||
if rep == gtk.RESPONSE_OK:
|
||||
beg, end = self.message_buffer.get_bounds()
|
||||
|
@ -282,6 +284,8 @@ class Away_message_dialog:
|
|||
else:
|
||||
message = -1
|
||||
self.window.destroy()
|
||||
if self.autoconnect:
|
||||
gtk.gdk.threads_leave()
|
||||
return message
|
||||
|
||||
def on_message_comboboxentry_changed(self, widget, data=None):
|
||||
|
@ -297,10 +301,11 @@ class Away_message_dialog:
|
|||
if (event.state & gtk.gdk.CONTROL_MASK):
|
||||
self.window.response(gtk.RESPONSE_OK)
|
||||
|
||||
def __init__(self, plugin):
|
||||
def __init__(self, plugin, autoconnect = 0):
|
||||
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'away_message_dialog', APP)
|
||||
self.window = self.xml.get_widget('away_message_dialog')
|
||||
self.plugin = plugin
|
||||
self.autoconnect = autoconnect
|
||||
message_textview = self.xml.get_widget('message_textview')
|
||||
self.message_buffer = message_textview.get_buffer()
|
||||
self.message_buffer.set_text(self.plugin.config['last_msg'])
|
||||
|
|
|
@ -657,10 +657,13 @@ class plugin:
|
|||
|
||||
def autoconnect(self):
|
||||
"""auto connect at startup"""
|
||||
message = self.roster.get_status_message('online', 1)
|
||||
if message == -1:
|
||||
return
|
||||
for a in self.accounts.keys():
|
||||
if self.accounts[a].has_key('autoconnect'):
|
||||
if self.accounts[a]['autoconnect']:
|
||||
self.roster.send_status(a, 'online', 'Online', 1)
|
||||
self.roster.send_status(a, 'online', message, 1)
|
||||
return 0
|
||||
|
||||
def show_systray(self):
|
||||
|
|
|
@ -725,12 +725,12 @@ class roster_window:
|
|||
else:
|
||||
self.plugin.sleeper_state[account] = 0
|
||||
|
||||
def get_status_message(self, status):
|
||||
def get_status_message(self, status, autoconnect = 0):
|
||||
if (status == 'online' and not self.plugin.config['ask_online_status']) \
|
||||
or (status == 'offline' and not \
|
||||
self.plugin.config['ask_offline_status']):
|
||||
return status
|
||||
w = Away_message_dialog(self.plugin)
|
||||
w = Away_message_dialog(self.plugin, autoconnect)
|
||||
message = w.run()
|
||||
return message
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue