def subscribeApprove(self, approve, to): if approve: self.send_presence(pto=to, ptype='subscribed') #If there was no subscription from us, we send it #and add to our contact list if not self.client_roster[to]['to']: self.send_presence(pto=to, ptype='subscribe') signals.getSignals().rosterChanged.emit([str(to)]) else: self.send_presence(pto=to, ptype='unsubscribed')
def onOffline(self, presence): if 'conference' in str(presence['from']): return else: signals.getSignals().contact_offline.emit(presence)
def onDisconnect(self, event): self.connected = False signals.getSignals().disconnected.emit()
def onAuthFailed(self, event): signals.getSignals().auth_failed.emit()
def onMessage(self, message): if str(message['from']).split('/')[0] not in self.client_roster: return signals.getSignals().message_received.emit(message)
def onStart(self, event): self.send_presence() self.get_roster() signals.getSignals().session_start.emit(self.client_roster)
def onUnSubscribed(self, presence): signals.getSignals().unsubs_in.emit(str(presence['from']))
def subscribe_to_contact(self, to): self.send_presence(pto=to, ptype='subscribe') signals.getSignals().rosterChanged.emit([to])
def muc_offline(self, presence): signals.getSignals().muc_contact_offline.emit(presence)