Ignore ourselves in the buddy list

This commit is contained in:
Dan Williams 2006-04-24 14:18:49 -04:00
parent 135ceef80a
commit 79ee53921c
2 changed files with 9 additions and 3 deletions

View File

@ -48,9 +48,10 @@ class Buddy(object):
class BuddyList(object):
""" Manage a list of buddies """
def __init__(self):
def __init__(self, servicename):
self._listeners = []
self._buddies = {}
self._servicename = servicename
self._pdiscovery = presence.PresenceDiscovery()
self._pdiscovery.add_service_listener(self._on_service_change)
@ -61,6 +62,10 @@ class BuddyList(object):
self._listeners.append(listener)
def _add_buddy(self, host, address, port, servicename, data):
# Ignore ourselves
if servicename == self._servicename:
return
if len(data) > 0 and 'name' in data.keys():
buddy = self._find_buddy_by_service_name(servicename)
if not buddy:

View File

@ -117,11 +117,12 @@ class ChatActivity(activity.Activity):
activity.Activity.__init__(self)
self._act_name = "Chat"
self._pannounce = presence.PresenceAnnounce()
self._buddy_list = BuddyList.BuddyList()
self._buddy_list.add_buddy_listener(self._on_buddy_presence_event)
(self._nick, self._realname) = self._get_name()
self._buddy_list = BuddyList.BuddyList(self._realname)
self._buddy_list.add_buddy_listener(self._on_buddy_presence_event)
def _create_chat(self):
chat_vbox = gtk.VBox()
chat_vbox.set_spacing(6)