Revert "DevConsole/Purk: Support for auto-join channels on connect, new button to connect to #olpc-help"

This reverts commit 104b158a80.
This commit is contained in:
Marco Pesenti Gritti 2007-08-22 20:56:29 +02:00
parent 0690c42345
commit 77cd5796af
5 changed files with 16 additions and 40 deletions

View File

@ -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()

View File

@ -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()

View File

@ -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 = []

View File

@ -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)

View File

@ -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)