当前位置: 首页>>代码示例>>C#>>正文


C# Contact.setBuddyStatus方法代码示例

本文整理汇总了C#中Contact.setBuddyStatus方法的典型用法代码示例。如果您正苦于以下问题:C# Contact.setBuddyStatus方法的具体用法?C# Contact.setBuddyStatus怎么用?C# Contact.setBuddyStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Contact的用法示例。


在下文中一共展示了Contact.setBuddyStatus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: onChange

        /**
         * ContactGroupListener Override: Tutorial Handler - ContactGroup TYPE.
         * <br /><br />
         * This handler fires for all ContactGroups. If it's <em>not</em>
         * a pending authorization request, log and ignore it.
         * <br /><br />
         * Tutorial 9 - Process authorization requests
         *
         * @since 1.0
         *
         * @see com.skype.api.ContactGroupListener#onChange(com.skype.api.ContactGroup, com.skype.api.Contact)
         */
        public void onChange(com.skype.api.ContactGroup obj, Contact contact)
        {
            if (contact != null)
            {
                String contactSkypeName = contact.getSkypeName(); // Find out who it's from
                String contactDisplayName = contact.getDisplayName();

                ContactGroup waitingAuth =
                        mySession.mySkype.getHardwiredContactGroup(ContactGroup.Type.CONTACTS_WAITING_MY_AUTHORIZATION);
                Contact[] waitingAuthMembers = waitingAuth.getContacts();
                int waitingAuthMembersCnt = waitingAuthMembers.Length;

                if (waitingAuthMembersCnt == 0)
                {
                    MySession.myConsole.printf("%s: Ignoring ContactGroup change for %s (%s); no Contacts awaiting authorization %n",
                            mySession.myTutorialTag, contactSkypeName, contactDisplayName);
                    return;
                }

                if (contact.getReceivedAuthRequest().Length == 0)
                {
                    MySession.myConsole.printf("%s: Ignoring ContactGroup change; Contact  %s (%s) is not awaiting authorization %n",
                            mySession.myTutorialTag, contactSkypeName, contactDisplayName);
                    return;
                }

                String authRequestText = contact.getReceivedAuthRequest();	// Get any intro text...
                if ((authRequestText == null) || (authRequestText.Length == 0))
                {						// ...and default it if missing
                    authRequestText = "-- NO INTRODUCTORY TEXT --";
                }
                MySession.myConsole.printf("%s: Authorization request from: %s (%s):%n\t%s",
                        mySession.myTutorialTag, contactSkypeName, contactDisplayName, authRequestText);
                contact.setBuddyStatus(true, true);
                /*
                 * SetBuddyStatus should really return a boolean...
                 * If and when it does, replace the above SetBuddyStatus invocation with the following...
                            if (contact.setBuddyStatus(true, true)) {
                                MySession.myConsole.printf("%s: %s is now authorized%n", mySession.myTutorialTag, contactSkypeName);
                            }
                            else {
                                MySession.myConsole.printf("%s: Authorization failed.%n", mySession.myTutorialTag);
                            }
                */
                MySession.myConsole.printf("%s: %s is now authorized!%n", mySession.myTutorialTag, contactSkypeName);
            }
        }
开发者ID:ravurivasu,项目名称:Skype-Examples,代码行数:59,代码来源:Listeners.cs


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