From 77cd5796af3e4b24a448b77ecc4f053e6b303e10 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Wed, 22 Aug 2007 20:56:29 +0200 Subject: [PATCH] Revert "DevConsole/Purk: Support for auto-join channels on connect, new button to connect to #olpc-help" This reverts commit 104b158a8003b0967ed1dea19ed5652e4fba8d8c. --- services/console/console.py | 2 +- .../interface/irc_client/irc_client.py | 28 ++++--------------- services/console/lib/purk/__init__.py | 9 +----- services/console/lib/purk/events.py | 8 +++++- services/console/lib/purk/irc.py | 9 ++---- 5 files changed, 16 insertions(+), 40 deletions(-) diff --git a/services/console/console.py b/services/console/console.py index 7f3d3ca8..cf33a765 100755 --- a/services/console/console.py +++ b/services/console/console.py @@ -54,7 +54,7 @@ class Console(object): self._load_interface('memphis', 'Memphis') self._load_interface('logviewer', 'Log Viewer') self._load_interface('terminal', 'Terminal') - self._load_interface('irc_client', 'IRC Client') + self._load_interface('irc_client', 'IRC') self._load_interface('ps_watcher', 'Presence') main_hbox = gtk.HBox() diff --git a/services/console/interface/irc_client/irc_client.py b/services/console/interface/irc_client/irc_client.py index 3cc2a83c..a7189594 100644 --- a/services/console/interface/irc_client/irc_client.py +++ b/services/console/interface/irc_client/irc_client.py @@ -1,28 +1,10 @@ -import gtk import purk -class IRCGui(gtk.VBox): - _DEFAULT_SERVER = "irc.freenode.net" - _AUTO_JOIN_CHANNEL = "#olpc-help" - - def __init__(self): - gtk.VBox.__init__(self, False) - - connect_button = gtk.Button('Connect to OLPC Help Channel') - connect_button.connect('clicked', self._on_connect_clicked_cb) - - self._client = purk.Client() - self._client.add_channel(self._AUTO_JOIN_CHANNEL) - client_widget = self._client.get_widget() - - self.pack_start(connect_button, False, False, 1) - self.pack_start(client_widget) - self.show_all() - - def _on_connect_clicked_cb(self, widget): - self._client.join_server(self._DEFAULT_SERVER) - class Interface(object): def __init__(self): - self.widget = IRCGui() + client = purk.Client() + client.show() + client.join_server('irc.freenode.net') + self.widget = client.get_widget() + diff --git a/services/console/lib/purk/__init__.py b/services/console/lib/purk/__init__.py index 7a87e549..35d93ad6 100644 --- a/services/console/lib/purk/__init__.py +++ b/services/console/lib/purk/__init__.py @@ -49,8 +49,7 @@ class Core(object): self.trigger = Trigger() self.events = self.trigger.events self.manager = widgets.UrkUITabs(self) - self.channels = [] - + mods = self.trigger.get_modules() for m in mods: m.core = self @@ -80,7 +79,6 @@ class Client(object): def __init__(self): self.core = Core() self.widget = self.core.manager.box - def run_command(self, command): self.core.run_command(command) @@ -94,8 +92,3 @@ class Client(object): def show(self): self.widget.show_all() - def add_channel(self, channel): - self.core.channels.append(channel) - - def clear_channels(self): - self.core.channels = [] diff --git a/services/console/lib/purk/events.py b/services/console/lib/purk/events.py index 4142003f..2a0d45e5 100644 --- a/services/console/lib/purk/events.py +++ b/services/console/lib/purk/events.py @@ -192,11 +192,17 @@ def run(text, window, network): c_data.args = split event_name = "Command" + c_data.name.capitalize() - + #print "searching: " + event_name + #for s in all_events: + # print "match: " + s + # if s == event_name: + # print "we got it!" + if event_name in all_events: result = trigger(event_name, c_data) if result: + print "* /%s: %s" % (c_data.name, result[0]) c_data.window.write("* /%s: %s" % (c_data.name, result[0])) else: trigger("Command", c_data) diff --git a/services/console/lib/purk/irc.py b/services/console/lib/purk/irc.py index 48d1fb8b..d5a01aad 100644 --- a/services/console/lib/purk/irc.py +++ b/services/console/lib/purk/irc.py @@ -54,7 +54,6 @@ class Network(object): def __init__(self, core, server="irc.default.org", port=6667, nicks=[], username="", fullname="", name=None, **kwargs): - self.core = core self.manager = core.manager self.server = server self.port = port @@ -132,7 +131,7 @@ class Network(object): self.disconnect(error=error[1]) #we should immediately retry if we failed to open the socket and there are hosts left if self.status == DISCONNECTED and not self.failedlasthost: - windows.get_default(self, self.core.manager).write("* Retrying with next available host") + windows.get_default(self).write("* Retrying with next available host") self.connect() else: self.source = source = ui.Source() @@ -144,10 +143,6 @@ class Network(object): if source.enabled: self.source = ui.fork(self.on_read, self.socket.recv, 8192) - # Auto join channels on connect - for channel in self.core.channels: - self.core.run_command("/join %s" % channel) - #called when we read data or failed to read data def on_read(self, result, error): if error: @@ -169,7 +164,7 @@ class Network(object): if source.enabled: self.source = ui.fork(self.on_read, self.socket.recv, 8192) - + def raw(self, msg): self.events.trigger("OwnRaw", network=self, raw=msg)