def addParticipant(self, uri, call_inst=None): # avoid duplication if self.isUriParticipant(uri): return uri_str = str(uri) # find buddy, create one if not found (e.g: for IM/typing ind), # it is a temporary one and not really registered to acc bud = None try: bud = self._acc.findBuddy(uri_str) except: bud = buddy.Buddy(None) bud_cfg = pj.BuddyConfig() bud_cfg.uri = uri_str bud_cfg.subscribe = False bud.create(self._acc, bud_cfg) bud.cfg = bud_cfg bud.account = self._acc # update URI from buddy URI uri = ParseSipUri(bud.cfg.uri) # add it self._participantList.append(uri) self._callList.append(call_inst) self._buddyList.append(bud) self._gui.addParticipant(str(uri)) self._updateGui()
def _createBuddy(self, acc, buddy_cfg): bud = buddy.Buddy(self) bud.cfg = buddy_cfg bud.account = acc bud.create(acc, bud.cfg) self.updateBuddy(bud) acc.buddyList.append(bud)