• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python jid.makeContactJID函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中messenger.proto.xmpp.jid.makeContactJID函数的典型用法代码示例。如果您正苦于以下问题:Python makeContactJID函数的具体用法?Python makeContactJID怎么用?Python makeContactJID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了makeContactJID函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: addIgnored

 def addIgnored(self, dbID, name):
     error = self.__checkCooldown(CLIENT_ACTION_ID.ADD_IGNORED)
     if error:
         return (False, error)
     tasks, itemType = [], XMPP_ITEM_TYPE.EMPTY_ITEM
     contact = self.usersStorage.getUser(dbID, PROTO_TYPE.XMPP)
     if contact:
         if contact.isCurrentPlayer():
             return (False, ClientActionError(CLIENT_ACTION_ID.ADD_FRIEND, CLIENT_ERROR_ID.GENERIC))
         itemType = contact.getItemType()
         if itemType == XMPP_ITEM_TYPE.BLOCK_ITEM:
             return (False, ClientContactError(CONTACT_ERROR_ID.BLOCK_ITEM_EXISTS, contact.getFullName()))
     length = self.usersStorage.getCount(ItemsFindCriteria(XMPP_ITEM_TYPE.BLOCKING_LIST))
     if length >= CONTACT_LIMIT.BLOCK_MAX_COUNT:
         return (False, ClientIntLimitError(LIMIT_ERROR_ID.MAX_BLOCK_ITEMS, CONTACT_LIMIT.BLOCK_MAX_COUNT))
     if contact:
         jid = contact.getJID()
         if itemType == XMPP_ITEM_TYPE.SUB_PENDING:
             tasks.append(sub_tasks.CancelSubscriptionTask(jid))
     else:
         jid = makeContactJID(dbID)
     tasks.append(block_tasks.AddBlockItemTask(jid, name))
     if itemType == XMPP_ITEM_TYPE.ROSTER_ITEM:
         groups = contact.getGroups()
         if groups:
             tasks.append(roster_tasks.EmptyGroupsTask(jid, groups=groups))
     self.__cooldown.process(CLIENT_ACTION_ID.ADD_IGNORED)
     return self.__addTasks(CLIENT_ACTION_ID.ADD_IGNORED, jid, *tasks)
开发者ID:webiumsk,项目名称:WoT,代码行数:28,代码来源:__init__.py


示例2: createItem

def createItem(databaseID, itemType = XMPP_ITEM_TYPE.EMPTY_ITEM, trusted = True):
    jid = makeContactJID(databaseID)
    if itemType in _SUPPORTED_ITEM_TYPE_TO_CLASS:
        clazz = _SUPPORTED_ITEM_TYPE_TO_CLASS[itemType]
        item = clazz(jid, trusted=trusted)
    else:
        item = ContactItem(jid)
    return item
开发者ID:krzcho,项目名称:WOTDecompiled,代码行数:8,代码来源:xmpp_items.py


示例3: setNote

 def setNote(self, dbID, note):
     error = self.__checkCooldown(CLIENT_ACTION_ID.SET_NOTE)
     if error:
         return (False, error)
     contact = self.usersStorage.getUser(dbID)
     if not contact or not contact.getTags():
         return (False, ClientContactError(CONTACT_ERROR_ID.CONTACT_ITEM_NOT_FOUND))
     jid = makeContactJID(dbID)
     self.__cooldown.process(CLIENT_ACTION_ID.SET_NOTE)
     return self.__addTasks(CLIENT_ACTION_ID.SET_NOTE, jid, note_tasks.SetNoteTask(jid, note))
开发者ID:webiumsk,项目名称:WoT,代码行数:10,代码来源:__init__.py


示例4: addFriend

    def addFriend(self, dbID, name, group = None):
        error = self.__checkCooldown(CLIENT_ACTION_ID.ADD_FRIEND)
        if error:
            return (False, error)
        else:
            if group:
                if not self.usersStorage.isGroupExists(group):
                    return (False, ClientContactError(CONTACT_ERROR_ID.GROUP_NOT_FOUND, group))
                groups = {group}
            else:
                groups = None
            contact = self.usersStorage.getUser(dbID, PROTO_TYPE.XMPP)
            tasks, itemType = [], XMPP_ITEM_TYPE.EMPTY_ITEM
            if contact:
                if contact.isCurrentPlayer():
                    return (False, ClientActionError(CLIENT_ACTION_ID.ADD_FRIEND, CLIENT_ERROR_ID.GENERIC))
                jid = contact.getJID()
                itemType = contact.getItemType()
                if itemType == XMPP_ITEM_TYPE.ROSTER_ITEM:
                    return (False, ClientContactError(CONTACT_ERROR_ID.ROSTER_ITEM_EXISTS, contact.getFullName()))
                subTo = contact.getSubscription()[0]
            else:
                jid = makeContactJID(dbID)
                subTo = _SUB.OFF
            error = self.__checkRosterSize()
            if error:
                return (False, error)
            if itemType == XMPP_ITEM_TYPE.BLOCK_ITEM:
                tasks.append(block_tasks.RemoveBlockItemTask(jid, name))
                tasks.append(roster_tasks.AddRosterItemTask(jid, name, groups))
            elif itemType == XMPP_ITEM_TYPE.ROSTER_BLOCK_ITEM:
                tasks.append(block_tasks.RemoveBlockItemTask(jid, name))
                task, exclude = None, set()
                rosterGroups = contact.getItem().getRosterGroups()
                for group in rosterGroups:
                    if self.usersStorage.isGroupEmpty(group):
                        exclude.add(group)

                if groups:
                    if groups != exclude:
                        task = roster_tasks.ChangeRosterItemGroupsTask(jid, name, groups, exclude)
                elif rosterGroups:
                    task = roster_tasks.ChangeRosterItemGroupsTask(jid, name, set(), exclude)
                if task:
                    tasks.append(task)
            elif itemType == XMPP_ITEM_TYPE.SUB_PENDING:
                tasks.append(sub_tasks.ApproveSubscriptionTask(jid, name))
                if groups:
                    tasks.append(roster_tasks.ChangeRosterItemGroupsTask(jid, name, groups))
            else:
                tasks.append(roster_tasks.AddRosterItemTask(jid, name, groups))
            if subTo == _SUB.OFF:
                tasks.append(sub_tasks.AskSubscriptionTask(jid))
            self.__cooldown.process(CLIENT_ACTION_ID.ADD_FRIEND)
            return self.__addTasks(CLIENT_ACTION_ID.ADD_FRIEND, jid, *tasks)
开发者ID:webiumsk,项目名称:WoT,代码行数:55,代码来源:__init__.py


示例5: __onUserStatusUpdated

 def __onUserStatusUpdated(self, user):
     if not user.isCurrentPlayer():
         if user.getProtoType() == PROTO_TYPE.XMPP:
             uid = user.getJID()
         else:
             uid = makeContactJID(user.getID())
         member = self._channel.getMember(uid)
         if member is not None:
             presence = user.getItem().getPresence()
             member.update(status=presence)
     return
开发者ID:aevitas,项目名称:wotsdk,代码行数:11,代码来源:xmpplobby_controllers.py


示例6: setContactPresence

 def setContactPresence(self, contact):
     dbID = contact.getID()
     if contact.getProtoType() == PROTO_TYPE.XMPP:
         jid = contact.getJID()
     else:
         jid = jid_entity.makeContactJID(dbID)
     exists = self.getChannelByJID(jid)
     if exists is not None:
         member = exists.getMember(dbID)
         if member is not None:
             member.setOnline(contact.isOnline())
     return
开发者ID:webiumsk,项目名称:WOT-0.9.15-CT,代码行数:12,代码来源:chat_session.py


示例7: setContactPresence

 def setContactPresence(self, contact):
     dbID = contact.getID()
     if contact.getProtoType() == PROTO_TYPE.XMPP:
         jid = contact.getJID()
     else:
         jid = makeContactJID(dbID)
     if jid not in self.__sessions:
         return
     channel = self.channelsStorage.getChannel(entities.XMPPChatChannelEntity(jid))
     if channel:
         member = channel.getMember(dbID)
         if member:
             member.setOnline(contact.isOnline())
开发者ID:webiumsk,项目名称:WoT,代码行数:13,代码来源:messages.py


示例8: approveFriendship

 def approveFriendship(self, dbID):
     contact = self.usersStorage.getUser(dbID, PROTO_TYPE.XMPP)
     result, error = self.canApproveFriendship(contact)
     if not result:
         return (result, error)
     if contact.getItemType() == XMPP_ITEM_TYPE.ROSTER_ITEM:
         jid = contact.getJID()
         tasks = [sub_tasks.ApproveSubscriptionTask(jid)]
         if contact.getSubscription()[0] == _SUB.OFF:
             tasks.append(sub_tasks.AskSubscriptionTask(jid))
     else:
         jid = makeContactJID(dbID)
         tasks = (sub_tasks.ApproveSubscriptionTask(jid), sub_tasks.AskSubscriptionTask(jid))
     return self.__addTasks(CLIENT_ACTION_ID.APPROVE_FRIENDSHIP, jid, *tasks)
开发者ID:webiumsk,项目名称:WoT,代码行数:14,代码来源:__init__.py


示例9: addTmpIgnored

 def addTmpIgnored(self, dbID, name):
     error = self._checkCooldown(CLIENT_ACTION_ID.ADD_IGNORED)
     if error:
         return (False, error)
     tasks, itemType = [], XMPP_ITEM_TYPE.EMPTY_ITEM
     contact = self.usersStorage.getUser(dbID, PROTO_TYPE.XMPP)
     if contact:
         if contact.isCurrentPlayer():
             return (False, ClientActionError(CLIENT_ACTION_ID.ADD_IGNORED, CLIENT_ERROR_ID.GENERIC))
         itemType = contact.getItemType()
         if itemType in XMPP_ITEM_TYPE.BLOCK_ITEMS:
             return (False, ClientContactError(CONTACT_ERROR_ID.BLOCK_ITEM_EXISTS, contact.getFullName()))
     if contact:
         jid = contact.getJID()
     else:
         jid = makeContactJID(dbID)
     tasks.append(block_tasks.AddTmpBlockItemTask(jid, name))
     self.__cooldown.process(CLIENT_ACTION_ID.ADD_IGNORED)
     return self.__addTasks(CLIENT_ACTION_ID.ADD_IGNORED, jid, *tasks)
开发者ID:aevitas,项目名称:wotsdk,代码行数:19,代码来源:contacts__init__.py


示例10: __me_onUserActionReceived

 def __me_onUserActionReceived(self, actionID, user):
     if actionID == USER_ACTION_ID.IGNORED_ADDED:
         self.__chatSessions.stopSession(makeContactJID(user.getID()))
开发者ID:webiumsk,项目名称:WoT,代码行数:3,代码来源:messages.py


示例11: startChatSession

 def startChatSession(self, dbID, name):
     self.__chatSessions.startSession(makeContactJID(dbID), name)
     return (True, None)
开发者ID:webiumsk,项目名称:WoT,代码行数:3,代码来源:messages.py


示例12: setUserAction

 def setUserAction(self, actionID, contact):
     if actionID == USER_ACTION_ID.IGNORED_ADDED:
         self.stopSession(jid_entity.makeContactJID(contact.getID()))
开发者ID:webiumsk,项目名称:WOT-0.9.15-CT,代码行数:3,代码来源:chat_session.py


示例13: return

        return (created, exists)

    def _repeatMessage(self, channel, body, filters):
        dbID = utils.getPlayerDatabaseID()
        name = utils.getPlayerName()
        g_messengerEvents.channels.onMessageReceived(ChatMessage(dbID, name, filters.chainIn(dbID, body), time.time()), channel)

    def __addSession(self, session, contactDBID = 0L, byAction = False):
        jid = session.getID()
        presence = PRESENCE.UNAVAILABLE
        if contactDBID:
            contact = self.usersStorage.getUser(contactDBID)
            if contact is not None:
                if contact.isIgnored():
                    return False
                if contact.isOnline():
                    presence = PRESENCE.AVAILABLE
                else:
                    presence = PRESENCE.UNAVAILABLE
        userDBID = utils.getPlayerDatabaseID()
        session.setUser(jid_entity.makeContactJID(userDBID), utils.getPlayerName())
        session.setContact(jid, presence, contactDBID)
        super(ChatSessionsProvider, self)._addChannel(session, byAction)
        return True

    def __removeSession(self, session):
        super(ChatSessionsProvider, self)._removeChannel(session)
# okay decompyling c:\Users\PC\wotsources\files\originals\res\scripts\client\messenger\proto\xmpp\messages\chat_session.pyc 
# decompiled 1 files: 1 okay, 0 failed, 0 verify failed
# 2016.05.01 15:25:18 Støední Evropa (letní èas)
开发者ID:webiumsk,项目名称:WOT-0.9.15-CT,代码行数:30,代码来源:chat_session.py



注:本文中的messenger.proto.xmpp.jid.makeContactJID函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python g_logOutput.debug函数代码示例发布时间:2022-05-27
下一篇:
Python XmppCooldownManager.XmppCooldownManager类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap