2006-04-19 20:43:40 +02:00
|
|
|
#!/usr/bin/python -t
|
2006-04-21 21:30:49 +02:00
|
|
|
# -*- tab-width: 4; indent-tabs-mode: t -*-
|
2006-04-19 20:43:40 +02:00
|
|
|
|
2006-04-21 22:16:47 +02:00
|
|
|
import dbus
|
|
|
|
import dbus.service
|
|
|
|
import dbus.glib
|
|
|
|
|
|
|
|
import pygtk
|
|
|
|
pygtk.require('2.0')
|
2006-04-19 20:43:40 +02:00
|
|
|
import gtk, gobject
|
|
|
|
|
2006-04-21 22:16:47 +02:00
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import pwd
|
2006-04-24 19:08:18 +02:00
|
|
|
import socket
|
2006-04-19 20:43:40 +02:00
|
|
|
|
2006-04-21 22:16:47 +02:00
|
|
|
import activity
|
2006-04-19 20:43:40 +02:00
|
|
|
|
2006-04-21 22:16:47 +02:00
|
|
|
import presence
|
|
|
|
import BuddyList
|
|
|
|
import network
|
2006-04-23 07:00:49 +02:00
|
|
|
import richtext
|
2006-04-24 19:08:18 +02:00
|
|
|
import xmlrpclib
|
2006-04-21 21:30:49 +02:00
|
|
|
|
2006-04-26 06:18:21 +02:00
|
|
|
from sugar_globals import *
|
|
|
|
|
2006-04-21 21:30:49 +02:00
|
|
|
|
2006-04-26 22:36:06 +02:00
|
|
|
class Chat(activity.Activity):
|
|
|
|
def __init__(self, controller):
|
|
|
|
self._controller = controller
|
|
|
|
activity.Activity.__init__(self)
|
|
|
|
|
|
|
|
def activity_on_connected_to_shell(self):
|
|
|
|
self.activity_set_tab_text(self._act_name)
|
|
|
|
self._plug = self.activity_get_gtk_plug()
|
|
|
|
self._ui_setup(self._plug)
|
|
|
|
self._plug.show_all()
|
|
|
|
|
|
|
|
def _create_chat(self):
|
|
|
|
chat_vbox = gtk.VBox()
|
|
|
|
chat_vbox.set_spacing(6)
|
|
|
|
|
|
|
|
sw = gtk.ScrolledWindow()
|
|
|
|
sw.set_shadow_type(gtk.SHADOW_IN)
|
|
|
|
sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
|
|
|
|
self._chat_view = richtext.RichTextView()
|
|
|
|
self._chat_view.connect("link-clicked", self.__link_clicked_cb)
|
|
|
|
self._chat_view.set_editable(False)
|
2006-04-26 22:43:27 +02:00
|
|
|
self._chat_view.set_cursor_visible(False)
|
2006-04-26 22:36:06 +02:00
|
|
|
sw.add(self._chat_view)
|
|
|
|
self._chat_view.show()
|
|
|
|
chat_vbox.pack_start(sw)
|
|
|
|
sw.show()
|
|
|
|
|
|
|
|
rich_buf = richtext.RichTextBuffer()
|
|
|
|
chat_view_sw = gtk.ScrolledWindow()
|
|
|
|
chat_view_sw.set_shadow_type(gtk.SHADOW_IN)
|
|
|
|
chat_view_sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
|
|
|
self._editor = richtext.RichTextView(rich_buf)
|
|
|
|
self._editor.connect("key-press-event", self.__key_press_event_cb)
|
|
|
|
self._editor.set_size_request(-1, 50)
|
|
|
|
chat_view_sw.add(self._editor)
|
|
|
|
self._editor.show()
|
|
|
|
|
|
|
|
chat_vbox.pack_start(chat_view_sw, False)
|
|
|
|
chat_view_sw.show()
|
|
|
|
|
|
|
|
return chat_vbox, rich_buf
|
|
|
|
|
|
|
|
def _ui_setup(self, base):
|
|
|
|
vbox = gtk.VBox(False, 6)
|
|
|
|
|
|
|
|
self._hbox = gtk.HBox(False, 12)
|
|
|
|
self._hbox.set_border_width(12)
|
|
|
|
|
|
|
|
[chat_vbox, buffer] = self._create_chat()
|
|
|
|
self._hbox.pack_start(chat_vbox)
|
|
|
|
chat_vbox.show()
|
|
|
|
|
|
|
|
vbox.pack_start(self._hbox)
|
|
|
|
self._hbox.show()
|
|
|
|
|
|
|
|
toolbar = self._create_toolbar(buffer)
|
|
|
|
vbox.pack_start(toolbar, False)
|
|
|
|
toolbar.show()
|
|
|
|
|
|
|
|
base.add(vbox)
|
|
|
|
vbox.show()
|
|
|
|
|
|
|
|
def __link_clicked_cb(self, view, address):
|
|
|
|
self._browser_shell.open_browser(address)
|
|
|
|
|
|
|
|
def __key_press_event_cb(self, text_view, event):
|
|
|
|
if event.keyval == gtk.keysyms.Return:
|
|
|
|
buf = text_view.get_buffer()
|
|
|
|
|
|
|
|
serializer = richtext.RichTextSerializer()
|
|
|
|
text = serializer.serialize(buf)
|
|
|
|
self.send_message(text)
|
|
|
|
|
|
|
|
buf.set_text("")
|
|
|
|
buf.place_cursor(buf.get_start_iter())
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
def _create_toolbar(self, rich_buf):
|
|
|
|
toolbar = richtext.RichTextToolbar(rich_buf)
|
|
|
|
|
|
|
|
item = gtk.MenuToolButton(None, "Links")
|
|
|
|
item.set_menu(gtk.Menu())
|
|
|
|
item.connect("show-menu", self.__show_link_menu_cb)
|
|
|
|
toolbar.insert(item, -1)
|
|
|
|
item.show()
|
|
|
|
|
|
|
|
return toolbar
|
|
|
|
|
|
|
|
def __link_activate_cb(self, item, link):
|
|
|
|
buf = self._editor.get_buffer()
|
|
|
|
buf.append_link(link['title'], link['address'])
|
|
|
|
|
|
|
|
def __show_link_menu_cb(self, button):
|
|
|
|
menu = gtk.Menu()
|
|
|
|
|
|
|
|
links = self._browser_shell.get_links()
|
|
|
|
|
|
|
|
for link in links:
|
|
|
|
item = gtk.MenuItem(link['title'], False)
|
|
|
|
item.connect("activate", self.__link_activate_cb, link)
|
|
|
|
menu.append(item)
|
|
|
|
item.show()
|
|
|
|
|
|
|
|
button.set_menu(menu)
|
|
|
|
|
|
|
|
def activity_on_close_from_user(self):
|
|
|
|
print "act %d: in activity_on_close_from_user"%self.activity_get_id()
|
|
|
|
self.activity_shutdown()
|
|
|
|
|
|
|
|
def activity_on_lost_focus(self):
|
|
|
|
print "act %d: in activity_on_lost_focus"%self.activity_get_id()
|
|
|
|
|
|
|
|
def activity_on_got_focus(self):
|
|
|
|
print "act %d: in activity_on_got_focus"%self.activity_get_id()
|
|
|
|
self._controller.notify_activate(self)
|
2006-04-21 21:30:49 +02:00
|
|
|
|
|
|
|
def recv_message(self, buddy, msg):
|
2006-04-24 21:17:03 +02:00
|
|
|
self._insert_rich_message(buddy.nick(), msg)
|
2006-04-26 22:36:06 +02:00
|
|
|
self._controller.notify_new_message(self, buddy)
|
2006-04-24 21:17:03 +02:00
|
|
|
|
|
|
|
def _insert_rich_message(self, nick, msg):
|
2006-04-26 22:36:06 +02:00
|
|
|
buffer = self._chat_view.get_buffer()
|
|
|
|
aniter = buffer.get_end_iter()
|
|
|
|
buffer.insert(aniter, nick + ": ")
|
2006-04-23 07:00:49 +02:00
|
|
|
|
|
|
|
serializer = richtext.RichTextSerializer()
|
2006-04-26 22:36:06 +02:00
|
|
|
serializer.deserialize(msg, buffer)
|
2006-04-21 21:30:49 +02:00
|
|
|
|
2006-04-26 22:36:06 +02:00
|
|
|
aniter = buffer.get_end_iter()
|
|
|
|
buffer.insert(aniter, "\n")
|
2006-04-21 21:30:49 +02:00
|
|
|
|
2006-04-24 21:17:03 +02:00
|
|
|
def _local_message(self, success, text):
|
|
|
|
if not success:
|
|
|
|
message = "Error: %s\n" % text
|
2006-04-26 22:36:06 +02:00
|
|
|
buffer = self._chat_view.get_buffer()
|
|
|
|
aniter = buffer.get_end_iter()
|
|
|
|
buffer.insert(aniter, message)
|
2006-04-24 21:17:03 +02:00
|
|
|
else:
|
2006-04-26 22:36:06 +02:00
|
|
|
(nick, realname) = self._controller.local_name()
|
2006-04-24 21:17:03 +02:00
|
|
|
self._insert_rich_message(nick, text)
|
|
|
|
|
2006-04-24 19:08:18 +02:00
|
|
|
class BuddyChat(Chat):
|
2006-04-26 22:36:06 +02:00
|
|
|
def __init__(self, controller, buddy):
|
2006-04-24 19:08:18 +02:00
|
|
|
self._buddy = buddy
|
2006-04-26 22:36:06 +02:00
|
|
|
self._act_name = "Chat: %s" % buddy.nick()
|
|
|
|
Chat.__init__(self, controller)
|
2006-04-24 19:08:18 +02:00
|
|
|
|
|
|
|
def recv_message(self, msg):
|
|
|
|
Chat.recv_message(self, self._buddy, msg)
|
|
|
|
|
|
|
|
def send_message(self, text):
|
|
|
|
if len(text) <= 0:
|
|
|
|
return
|
|
|
|
addr = "http://%s:%d" % (self._buddy.address(), self._buddy.port())
|
|
|
|
peer = xmlrpclib.ServerProxy(addr)
|
2006-04-24 21:17:03 +02:00
|
|
|
msg = text
|
2006-04-24 19:08:18 +02:00
|
|
|
success = True
|
|
|
|
try:
|
|
|
|
peer.message(text)
|
2006-04-25 19:14:20 +02:00
|
|
|
except (socket.error, xmlrpclib.Fault), e:
|
2006-04-24 19:08:18 +02:00
|
|
|
msg = str(e)
|
|
|
|
success = False
|
2006-04-24 21:17:03 +02:00
|
|
|
self._local_message(success, msg)
|
2006-04-24 19:08:18 +02:00
|
|
|
|
|
|
|
class ChatRequestHandler(object):
|
2006-04-26 22:36:06 +02:00
|
|
|
def __init__(self, parent):
|
2006-04-24 19:08:18 +02:00
|
|
|
self._parent = parent
|
|
|
|
|
|
|
|
def message(self, message):
|
|
|
|
client_address = network.get_authinfo()
|
|
|
|
buddy = self._parent.find_buddy_by_address(client_address[0])
|
|
|
|
if buddy:
|
2006-04-24 19:19:10 +02:00
|
|
|
chat = buddy.chat()
|
|
|
|
if not chat:
|
2006-04-26 22:36:06 +02:00
|
|
|
chat = BuddyChat(self._parent, buddy)
|
2006-04-24 19:19:10 +02:00
|
|
|
buddy.set_chat(chat)
|
2006-04-26 22:36:06 +02:00
|
|
|
chat.activity_connect_to_shell()
|
2006-04-24 19:19:10 +02:00
|
|
|
chat.recv_message(message)
|
|
|
|
return True
|
2006-04-24 19:08:18 +02:00
|
|
|
|
2006-04-26 22:36:06 +02:00
|
|
|
class GroupChat(Chat):
|
2006-04-25 04:22:18 +02:00
|
|
|
|
|
|
|
_MODEL_COL_NICK = 0
|
|
|
|
_MODEL_COL_ICON = 1
|
|
|
|
_MODEL_COL_BUDDY = 2
|
2006-04-26 22:36:06 +02:00
|
|
|
|
|
|
|
_CHAT_SERVER_PORT = 6666
|
2006-04-25 04:22:18 +02:00
|
|
|
|
2006-04-21 22:16:47 +02:00
|
|
|
def __init__(self):
|
|
|
|
self._act_name = "Chat"
|
2006-04-19 20:43:40 +02:00
|
|
|
self._pannounce = presence.PresenceAnnounce()
|
|
|
|
|
|
|
|
(self._nick, self._realname) = self._get_name()
|
|
|
|
|
2006-04-24 20:18:49 +02:00
|
|
|
self._buddy_list = BuddyList.BuddyList(self._realname)
|
|
|
|
self._buddy_list.add_buddy_listener(self._on_buddy_presence_event)
|
|
|
|
|
2006-04-25 23:47:49 +02:00
|
|
|
bus = dbus.SessionBus()
|
|
|
|
proxy_obj = bus.get_object('com.redhat.Sugar.Browser', '/com/redhat/Sugar/Browser')
|
2006-04-26 22:36:06 +02:00
|
|
|
self._browser_shell = dbus.Interface(proxy_obj, 'com.redhat.Sugar.BrowserShell')
|
2006-04-25 23:47:49 +02:00
|
|
|
|
2006-04-26 22:36:06 +02:00
|
|
|
Chat.__init__(self, self)
|
2006-04-24 19:50:39 +02:00
|
|
|
|
|
|
|
def _create_sidebar(self):
|
|
|
|
vbox = gtk.VBox(False, 6)
|
|
|
|
|
|
|
|
label = gtk.Label("Who's around:")
|
|
|
|
label.set_alignment(0.0, 0.5)
|
|
|
|
vbox.pack_start(label, False)
|
|
|
|
label.show()
|
2006-04-26 22:36:06 +02:00
|
|
|
|
2006-04-25 04:22:18 +02:00
|
|
|
self._buddy_list_model = gtk.ListStore(gobject.TYPE_STRING, gtk.gdk.Pixbuf, gobject.TYPE_PYOBJECT)
|
|
|
|
|
2006-04-26 06:18:21 +02:00
|
|
|
self._pixbuf_active_chat = gtk.gdk.pixbuf_new_from_file(data_dir + "/bubbleOutline.png")
|
|
|
|
self._pixbuf_new_message = gtk.gdk.pixbuf_new_from_file(data_dir + "/bubble.png")
|
2006-04-24 19:50:39 +02:00
|
|
|
|
2006-04-23 07:00:49 +02:00
|
|
|
sw = gtk.ScrolledWindow()
|
2006-04-24 19:50:39 +02:00
|
|
|
sw.set_shadow_type(gtk.SHADOW_IN)
|
2006-04-23 07:00:49 +02:00
|
|
|
sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
2006-04-24 19:50:39 +02:00
|
|
|
|
2006-04-23 07:00:49 +02:00
|
|
|
self._buddy_list_view = gtk.TreeView(self._buddy_list_model)
|
2006-04-24 19:50:39 +02:00
|
|
|
self._buddy_list_view.set_headers_visible(False)
|
2006-04-21 22:16:47 +02:00
|
|
|
self._buddy_list_view.connect("cursor-changed", self._on_buddyList_buddy_selected)
|
|
|
|
self._buddy_list_view.connect("row-activated", self._on_buddyList_buddy_double_clicked)
|
2006-04-24 19:50:39 +02:00
|
|
|
|
|
|
|
sw.set_size_request(120, -1)
|
2006-04-23 07:00:49 +02:00
|
|
|
sw.add(self._buddy_list_view)
|
|
|
|
self._buddy_list_view.show()
|
2006-04-21 22:16:47 +02:00
|
|
|
|
2006-04-25 04:22:18 +02:00
|
|
|
renderer = gtk.CellRendererPixbuf()
|
|
|
|
column = gtk.TreeViewColumn("", renderer, pixbuf=self._MODEL_COL_ICON)
|
|
|
|
column.set_resizable(False)
|
|
|
|
column.set_expand(False);
|
|
|
|
self._buddy_list_view.append_column(column)
|
|
|
|
|
2006-04-21 22:16:47 +02:00
|
|
|
renderer = gtk.CellRendererText()
|
2006-04-25 04:22:18 +02:00
|
|
|
column = gtk.TreeViewColumn("", renderer, text=self._MODEL_COL_NICK)
|
2006-04-21 22:16:47 +02:00
|
|
|
column.set_resizable(True)
|
|
|
|
column.set_sizing("GTK_TREE_VIEW_COLUMN_GROW_ONLY");
|
|
|
|
column.set_expand(True);
|
|
|
|
self._buddy_list_view.append_column(column)
|
|
|
|
|
2006-04-24 19:50:39 +02:00
|
|
|
vbox.pack_start(sw)
|
|
|
|
sw.show()
|
|
|
|
|
|
|
|
return vbox
|
|
|
|
|
2006-04-26 22:36:06 +02:00
|
|
|
def _ui_setup(self, base):
|
|
|
|
Chat._ui_setup(self, base)
|
2006-04-24 19:50:39 +02:00
|
|
|
|
|
|
|
sidebar = self._create_sidebar()
|
2006-04-26 22:36:06 +02:00
|
|
|
self._hbox.pack_start(sidebar, False)
|
2006-04-24 19:50:39 +02:00
|
|
|
sidebar.show()
|
2006-04-26 22:36:06 +02:00
|
|
|
self._plug.show_all()
|
2006-04-21 22:16:47 +02:00
|
|
|
|
|
|
|
def _start(self):
|
|
|
|
self._buddy_list.start()
|
2006-04-26 22:36:06 +02:00
|
|
|
self._pannounce.register_service(self._realname, self._CHAT_SERVER_PORT, presence.OLPC_CHAT_SERVICE,
|
2006-04-21 22:16:47 +02:00
|
|
|
name = self._nick, realname = self._realname)
|
2006-04-24 19:08:18 +02:00
|
|
|
|
|
|
|
# Create the P2P chat XMLRPC server
|
2006-04-26 22:36:06 +02:00
|
|
|
self._p2p_req_handler = ChatRequestHandler(self)
|
|
|
|
self._p2p_server = network.GlibXMLRPCServer(("", self._CHAT_SERVER_PORT))
|
2006-04-24 19:08:18 +02:00
|
|
|
self._p2p_server.register_instance(self._p2p_req_handler)
|
2006-04-21 22:16:47 +02:00
|
|
|
|
2006-04-26 22:36:06 +02:00
|
|
|
self._gc_controller = network.GroupChatController('224.0.0.221', 6666, self._recv_group_message)
|
|
|
|
self._gc_controller.start()
|
|
|
|
|
2006-04-21 22:16:47 +02:00
|
|
|
def activity_on_connected_to_shell(self):
|
2006-04-26 22:36:06 +02:00
|
|
|
Chat.activity_on_connected_to_shell(self)
|
|
|
|
aniter = self._buddy_list_model.append(None)
|
|
|
|
self._buddy_list_model.set(aniter, self._MODEL_COL_NICK, "Group",
|
|
|
|
self._MODEL_COL_ICON, self._pixbuf_active_chat, self._MODEL_COL_BUDDY, None)
|
2006-04-21 22:16:47 +02:00
|
|
|
self._start()
|
|
|
|
|
|
|
|
def activity_on_disconnected_from_shell(self):
|
2006-04-26 22:36:06 +02:00
|
|
|
Chat.activity_on_disconnected_from_shell(self)
|
2006-04-25 21:20:47 +02:00
|
|
|
gtk.main_quit()
|
2006-04-19 20:43:40 +02:00
|
|
|
|
|
|
|
def _get_name(self):
|
|
|
|
ent = pwd.getpwuid(os.getuid())
|
|
|
|
nick = ent[0]
|
|
|
|
if not nick or not len(nick):
|
|
|
|
nick = "n00b"
|
|
|
|
realname = ent[4]
|
|
|
|
if not realname or not len(realname):
|
|
|
|
realname = "Some Clueless User"
|
|
|
|
return (nick, realname)
|
|
|
|
|
2006-04-20 21:33:30 +02:00
|
|
|
def _on_buddyList_buddy_selected(self, widget, *args):
|
2006-04-19 20:43:40 +02:00
|
|
|
(model, aniter) = widget.get_selection().get_selected()
|
2006-04-25 04:22:18 +02:00
|
|
|
name = self._buddy_list_model.get(aniter, self._MODEL_COL_NICK)
|
2006-04-19 20:43:40 +02:00
|
|
|
print "Selected %s" % name
|
|
|
|
|
2006-04-20 21:33:30 +02:00
|
|
|
def _on_buddyList_buddy_double_clicked(self, widget, *args):
|
2006-04-21 21:30:49 +02:00
|
|
|
""" Select the chat for this buddy or group """
|
2006-04-19 20:43:40 +02:00
|
|
|
(model, aniter) = widget.get_selection().get_selected()
|
2006-04-21 21:30:49 +02:00
|
|
|
chat = None
|
2006-04-25 04:22:18 +02:00
|
|
|
buddy = self._buddy_list_model.get_value(aniter, self._MODEL_COL_BUDDY)
|
2006-04-25 17:47:19 +02:00
|
|
|
if buddy and not buddy.chat():
|
2006-04-26 22:36:06 +02:00
|
|
|
chat = BuddyChat(self, buddy)
|
2006-04-25 17:47:19 +02:00
|
|
|
buddy.set_chat(chat)
|
2006-04-26 22:36:06 +02:00
|
|
|
chat.activity_connect_to_shell()
|
2006-04-19 20:43:40 +02:00
|
|
|
|
2006-04-20 21:33:30 +02:00
|
|
|
def _on_buddy_presence_event(self, action, buddy):
|
|
|
|
if action == BuddyList.ACTION_BUDDY_ADDED:
|
2006-04-21 22:16:47 +02:00
|
|
|
aniter = self._buddy_list_model.append(None)
|
2006-04-25 04:22:18 +02:00
|
|
|
self._buddy_list_model.set(aniter, self._MODEL_COL_NICK, buddy.nick(),
|
|
|
|
self._MODEL_COL_ICON, None, self._MODEL_COL_BUDDY, buddy)
|
2006-04-24 19:42:01 +02:00
|
|
|
elif action == BuddyList.ACTION_BUDDY_REMOVED:
|
2006-04-25 04:22:18 +02:00
|
|
|
aniter = self._get_iter_for_buddy(buddy)
|
|
|
|
if aniter:
|
|
|
|
self._buddy_list_model.remove(aniter)
|
|
|
|
|
|
|
|
def _get_iter_for_buddy(self, buddy):
|
|
|
|
aniter = self._buddy_list_model.get_iter_first()
|
|
|
|
while aniter:
|
|
|
|
list_buddy = self._buddy_list_model.get_value(aniter, self._MODEL_COL_BUDDY)
|
|
|
|
if buddy == list_buddy:
|
|
|
|
return aniter
|
|
|
|
aniter = self._buddy_list_model.iter_next(aniter)
|
|
|
|
|
|
|
|
def notify_new_message(self, chat, buddy):
|
2006-04-26 22:36:06 +02:00
|
|
|
aniter = self._get_iter_for_buddy(buddy)
|
|
|
|
self._buddy_list_model.set(aniter, self._MODEL_COL_ICON, self._pixbuf_new_message)
|
|
|
|
|
|
|
|
def notify_activate(self, chat):
|
|
|
|
aniter = self._get_iter_for_buddy(buddy)
|
|
|
|
self._buddy_list_model.set(aniter, self._MODEL_COL_ICON, self._pixbuf_active_chat)
|
2006-04-20 21:33:30 +02:00
|
|
|
|
2006-04-21 21:30:49 +02:00
|
|
|
def find_buddy_by_address(self, address):
|
|
|
|
return self._buddy_list.find_buddy_by_address(address)
|
|
|
|
|
2006-04-24 21:17:03 +02:00
|
|
|
def local_name(self):
|
|
|
|
return (self._nick, self._realname)
|
|
|
|
|
2006-04-26 22:36:06 +02:00
|
|
|
def send_message(self, text):
|
|
|
|
if len(text) > 0:
|
|
|
|
self._gc_controller.send_msg(text)
|
|
|
|
self._local_message(True, text)
|
2006-04-19 20:43:40 +02:00
|
|
|
|
2006-04-26 22:36:06 +02:00
|
|
|
def recv_message(self, buddy, msg):
|
|
|
|
self._insert_rich_message(buddy.nick(), msg)
|
|
|
|
self._parent.notify_new_message(self, None)
|
2006-04-26 22:35:19 +02:00
|
|
|
|
2006-04-26 22:36:06 +02:00
|
|
|
def _recv_group_message(self, msg):
|
|
|
|
buddy = self.find_buddy_by_address(msg['addr'])
|
|
|
|
if buddy:
|
|
|
|
self.recv_message(buddy, msg['data'])
|
2006-04-19 20:43:40 +02:00
|
|
|
|
2006-04-21 22:16:47 +02:00
|
|
|
def run(self):
|
2006-04-24 16:43:45 +02:00
|
|
|
try:
|
|
|
|
gtk.main()
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
pass
|
2006-04-19 20:43:40 +02:00
|
|
|
|
|
|
|
def main():
|
2006-04-26 22:36:06 +02:00
|
|
|
app = GroupChat()
|
2006-04-21 22:16:47 +02:00
|
|
|
app.activity_connect_to_shell()
|
2006-04-19 20:43:40 +02:00
|
|
|
app.run()
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|