Ignore ourselves in the buddy list
This commit is contained in:
parent
135ceef80a
commit
79ee53921c
@ -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:
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user