Lot of fixes
This commit is contained in:
parent
878714a627
commit
afb9b2c97f
@ -1,10 +1,6 @@
|
||||
sugardir = $(pythondir)/sugar
|
||||
sugar_PYTHON = \
|
||||
BuddyList.py \
|
||||
chat.py \
|
||||
network.py \
|
||||
presence.py \
|
||||
p2p.py \
|
||||
richtext.py
|
||||
|
||||
icondir = $(pkgdatadir)
|
||||
|
20
chat/chat.py
20
chat/chat.py
@ -172,8 +172,9 @@ class BuddyChat(Chat):
|
||||
Chat.__init__(self, controller)
|
||||
|
||||
def _start(self):
|
||||
service_name = buddy.get_service_name()
|
||||
self._stream_writer = StreamWriter(self._group, service_name)
|
||||
service_name = self._buddy.get_service_name()
|
||||
group = self._controller.get_group()
|
||||
self._stream_writer = StreamWriter(group, service_name)
|
||||
|
||||
def activity_on_connected_to_shell(self):
|
||||
Chat.activity_on_connected_to_shell(self)
|
||||
@ -192,7 +193,7 @@ class BuddyChat(Chat):
|
||||
|
||||
def activity_on_close_from_user(self):
|
||||
Chat.activity_on_close_from_user(self)
|
||||
self._buddy.set_chat(None)
|
||||
del self._chats[self._buddy]
|
||||
|
||||
class GroupChat(Chat):
|
||||
|
||||
@ -202,6 +203,7 @@ class GroupChat(Chat):
|
||||
|
||||
def __init__(self):
|
||||
self._act_name = "Chat"
|
||||
self._chats = {}
|
||||
|
||||
bus = dbus.SessionBus()
|
||||
proxy_obj = bus.get_object('com.redhat.Sugar.Browser', '/com/redhat/Sugar/Browser')
|
||||
@ -209,6 +211,9 @@ class GroupChat(Chat):
|
||||
|
||||
Chat.__init__(self, self)
|
||||
|
||||
def get_group(self):
|
||||
return self._group
|
||||
|
||||
def _start(self):
|
||||
self._group = LocalGroup()
|
||||
self._group.add_listener(self._on_group_event)
|
||||
@ -300,9 +305,9 @@ class GroupChat(Chat):
|
||||
(model, aniter) = widget.get_selection().get_selected()
|
||||
chat = None
|
||||
buddy = self._buddy_list_model.get_value(aniter, self._MODEL_COL_BUDDY)
|
||||
if buddy and not buddy.chat():
|
||||
if buddy and not self._chats.has_key(buddy):
|
||||
chat = BuddyChat(self, buddy)
|
||||
buddy.set_chat(chat)
|
||||
self._chats[buddy] = chat
|
||||
chat.activity_connect_to_shell()
|
||||
|
||||
def _on_group_event(self, action, buddy):
|
||||
@ -342,10 +347,9 @@ class GroupChat(Chat):
|
||||
self._controller.notify_new_message(self, None)
|
||||
|
||||
def _buddy_recv_message(self, sender, msg):
|
||||
chat = sender.chat()
|
||||
if not chat:
|
||||
if self._chats.has_key[sender]:
|
||||
chat = BuddyChat(self, sender)
|
||||
sender.set_chat(chat)
|
||||
self._chats[buddy] = chat
|
||||
chat.activity_connect_to_shell()
|
||||
chat.recv_message(sender, msg)
|
||||
|
||||
|
@ -67,7 +67,6 @@ class LocalGroup(Group):
|
||||
|
||||
def _on_service_resolved(self, interface, protocol, name, stype, domain,
|
||||
host, aprotocol, address, port, txt, flags):
|
||||
print name
|
||||
if name != self._owner.get_service().get_name():
|
||||
service = Service(name, host, address, port)
|
||||
self._services[name] = service
|
||||
|
@ -1,3 +1,5 @@
|
||||
import xmlrpclib
|
||||
import traceback
|
||||
import socket
|
||||
|
||||
import network
|
||||
|
Loading…
Reference in New Issue
Block a user