本文整理汇总了Python中messenger.proto.xmpp.log_output.g_logOutput.debug函数的典型用法代码示例。如果您正苦于以下问题:Python debug函数的具体用法?Python debug怎么用?Python debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __addContactToXmppRoster
def __addContactToXmppRoster(self, jid, userName = 'Unknown', groups = None):
if not GROUPS_SYNC_ENABLED:
groups = None
client = self.client()
g_logOutput.debug(CLIENT_LOG_AREA.SYNC, 'Adds contact from BW roster and sends request to add subscription', jid, userName, groups)
client.setContactToRoster(jid, userName, groups)
client.setSubscribeTo(jid)
示例2: sync
def sync(self):
if self.__isBWRosterReceived and self.client().isConnected():
g_logOutput.debug(CLIENT_LOG_AREA.SYNC, 'Syncing XMPP rosters from BW')
domain = g_settings.server.XMPP.domain
contacts = set()
for user in self.usersStorage.getList(_BWRosterFindCriteria()):
jid = ContactBareJID()
jid.setNode(user.getID())
jid.setDomain(domain)
contacts.add(jid)
if user.isCurrentPlayer():
self.xmppRoster[jid].name = user.getName()
continue
groups = self.__getBWRosterGroups(user)
if self.xmppRoster.hasItem(jid):
if GROUPS_SYNC_ENABLED and groups ^ self.xmppRoster[jid].groups:
self.__setContactToXmppRoster(jid, user.getName(), groups)
if self.xmppRoster[jid].subscriptionTo == SUBSCRIPTION.OFF:
self.__setSubscribeTo(jid)
else:
self.__addContactToXmppRoster(jid, user.getName(), groups)
toRemove = set(self.xmppRoster.keys()).difference(contacts)
for jid in toRemove:
contact = self.xmppRoster[jid]
if contact.subscriptionFrom != SUBSCRIPTION.OFF:
if contact.subscriptionTo == SUBSCRIPTION.ON:
self.__removeSubscribeTo(jid)
else:
self.__removeContactFromXmppRoster(jid)
示例3: __handleRosterResourceRemoved
def __handleRosterResourceRemoved(self, jid):
user = self.usersStorage.getUser(jid.getDatabaseID(), PROTO_TYPE.XMPP)
if user and not user.isCurrentPlayer():
user.update(jid=jid, resource=None)
g_logOutput.debug(CLIENT_LOG_AREA.RESOURCE, 'Resource is removed', jid.getResource(), user.getName())
g_messengerEvents.users.onUserStatusUpdated(user)
return
示例4: connect
def connect(self):
if self.__reconnectCallbackID is None:
self.__connectionsInfo.init()
self.__doConnect()
else:
g_logOutput.debug(CLIENT_LOG_AREA.CONNECTION, 'Connection already is processing')
return
示例5: __addToLocalXmppRoster
def __addToLocalXmppRoster(self, jid, name, groups, to, from_):
if self.xmppRoster.hasItem(jid):
g_logOutput.debug(CLIENT_LOG_AREA.SYNC, 'Updating item in local XMPP roster', jid, name, groups, to, from_)
self.xmppRoster[jid].update(name, groups, to, from_)
else:
g_logOutput.debug(CLIENT_LOG_AREA.SYNC, 'Adding item to local XMPP roster', jid, name, groups, to, from_)
self.xmppRoster[jid] = RosterItem(jid, name, groups, to, from_)
示例6: addMessage
def addMessage(self, jid, message):
if message.isHistory():
self.__historyRQ.addHistory(message)
return
dbID = message.accountDBID
name = message.accountName
if jid not in self.__sessions and g_settings.userPrefs.chatContactsListOnly:
contact = self.usersStorage.getUser(dbID)
if not contact or not USER_TAG.filterClosedContactsTags(contact.getTags()):
g_logOutput.debug(
CLIENT_LOG_AREA.MESSAGE,
"There is not closed contact in player's contacts list,contact's message is ignored",
jid,
name,
)
return
search = entities.XMPPChatChannelEntity(jid, name)
channel = self.channelsStorage.getChannel(search)
if not channel:
channel = self._addChannel(search, dbID, name)
if not channel:
return
self.__sessions.add(jid)
if message.body:
g_messengerEvents.channels.onMessageReceived(message, channel)
示例7: __onSeqsInited
def __onSeqsInited(self):
g_logOutput.debug(_LOG.GENERIC, 'Starts to process contacts tasks')
self.__presence.sendPresence(True)
self.__tasks.release()
self.__tasks.onSeqTaskRequested += self.__onSeqTaskRequested
self.__subsRestrictions.setToUseCachedCounts(True)
self.__subsBatch.process(self.__tasks)
self.__subsRestrictions.setToUseCachedCounts(False)
g_messengerEvents.users.onUsersListReceived({USER_TAG.FRIEND, USER_TAG.IGNORED, USER_TAG.MUTED})
示例8: __handleRosterResourceAdded
def __handleRosterResourceAdded(self, jid, resource):
dbID = jid.getDatabaseID()
user = self.usersStorage.getUser(dbID, PROTO_TYPE.XMPP)
if not user:
user = entities.XMPPUserEntity(dbID)
self.usersStorage.setUser(user)
if not user.isCurrentPlayer():
user.update(jid=jid, resource=resource)
g_logOutput.debug(CLIENT_LOG_AREA.RESOURCE, 'Resource is set', user.getName(), jid.getResource(), resource)
g_messengerEvents.users.onUserStatusUpdated(user)
示例9: _doSync
def _doSync(self, name, groups = None, sub = None, clanInfo = None):
user = self._getUser()
if not user or user.isCurrentPlayer():
return user
if user.getItemType() == XMPP_ITEM_TYPE.ROSTER_ITEM:
user.update(item=None)
_syncEmptyGroups(self.usersStorage, self._groups)
g_logOutput.debug(CLIENT_LOG_AREA.ROSTER, 'Roster item is removed', user)
self._doNotify(USER_ACTION_ID.FRIEND_REMOVED, user)
return user
示例10: _doRun
def _doRun(self, client):
user = self._getUser()
if user and user.getItemType() in XMPP_ITEM_TYPE.TMP_BLOCKING_LIST:
user.update(item=None)
user.removeTags({USER_TAG.MUTED})
g_logOutput.debug(CLIENT_LOG_AREA.BLOCK_LIST, 'Temporary block item is removed', self._jid, {'name': self._name})
self._doNotify(USER_ACTION_ID.TMP_IGNORED_REMOVED, user)
self._doNotify(USER_ACTION_ID.MUTE_UNSET, user, False)
self._result = TASK_RESULT.REMOVE
return
示例11: set
def set(self, pyGlooxTag):
result = blocking_cmd.BlockItemHandler().handleTag(pyGlooxTag)
jid, info = findFirst(None, result, ('', {}))
if jid != self._jid:
return
user = _syncBlockItem(self.usersStorage, self._jid, **info)
if user:
g_logOutput.debug(CLIENT_LOG_AREA.BLOCK_LIST, 'Block item is added', jid, info)
self._doNotify(USER_ACTION_ID.IGNORED_ADDED, user)
self._doNotify(USER_ACTION_ID.MUTE_SET, user, False)
self._result = TASK_RESULT.REMOVE
示例12: __handleTokenError
def __handleTokenError(self):
client = self.client()
if not client:
return
if self.__reqTokenBackOff.getTries() < _MAX_REQ_TOKEN_TRIES:
delay = self.__reqTokenBackOff.next()
self.__reqTokenCallbackID = BigWorld.callback(delay, self.__doNextLogin)
g_logOutput.debug(CLIENT_LOG_AREA.TOKEN, 'Will try to request token after {0} seconds'.format(delay))
else:
self.client().disconnect()
self.__handleDisconnect(DISCONNECT_REASON.OTHER_ERROR, 'Received chat token is not valid')
示例13: __handlePresenceWithIGR
def __handlePresenceWithIGR(self, jid, resource):
dbID = jid.getDatabaseID()
user = self.usersStorage.getUser(dbID, PROTO_TYPE.XMPP)
if user and user.isCurrentPlayer():
return
if not user:
user = entities.XMPPUserEntity(dbID)
self.usersStorage.setUser(user)
user.update(jid=jid, resource=resource)
g_logOutput.debug(CLIENT_LOG_AREA.RESOURCE, 'Resource with IGR is set', user.getName(), jid.getResource(), resource)
g_messengerEvents.users.onUserActionReceived(USER_ACTION_ID.IGR_CHANGED, user)
示例14: _populate
def _populate(self, taskQueue):
jids = []
while self._cancelTasks:
jid, tasks = self._cancelTasks.popitem()
jids.append(jid)
if taskQueue.addTasks(jid, *tasks):
taskQueue.runFirstTask(jid)
if jids:
g_logOutput.debug(_LOG.SUBSCRIPTION, 'Inbound subscriptions are canceled automatically', jids[:10])
jids = []
while self._approveTasks:
jid, tasks = self._approveTasks.popitem()
jids.append(jid)
if taskQueue.addTasks(jid, *tasks):
taskQueue.runFirstTask(jid)
if jids:
g_logOutput.debug(_LOG.SUBSCRIPTION, 'Inbound subscriptions are approved automatically', jids[:10])
if self._newRqs:
g_logOutput.debug(_LOG.SUBSCRIPTION, 'New inbound subscriptions are received', self._newRqs[:10])
g_messengerEvents.users.onFriendshipRequestsAdded(self._newRqs)
if self._oldRqs:
g_logOutput.debug(_LOG.SUBSCRIPTION, 'Inbound subscriptions are ignored to display', self._oldRqs[:10])
g_messengerEvents.users.onFriendshipRequestsUpdated(self._oldRqs)
示例15: _doSync
def _doSync(self, name, groups = None, sub = None, clanInfo = None):
user = self._getUser()
if not user or user.isCurrentPlayer():
return user
if user.getItemType() in XMPP_ITEM_TYPE.ROSTER_ITEMS:
user.update(item=ContactItem(user.getJID()))
_syncEmptyGroups(self.usersStorage, self._groups)
g_logOutput.debug(CLIENT_LOG_AREA.ROSTER, 'Roster item is removed', user)
self._doNotify(USER_ACTION_ID.FRIEND_REMOVED, user)
elif user.getItemType() in XMPP_ITEM_TYPE.SUB_PENDING_ITEMS:
user.update(item=ContactItem(user.getJID()))
_syncEmptyGroups(self.usersStorage, self._groups)
g_logOutput.debug(CLIENT_LOG_AREA.ROSTER, 'Friendship request is revoked by sender', user)
g_messengerEvents.users.onFriendshipRequestsUpdated([user])
return user