예제 #1
0
        /**
         * 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);
            }
        }
예제 #2
0
 /**
  * ContactGroup Override.
  *
  * @since 1.0
  *
  * @see com.skype.api.ContactGroupListener#onChangeConversation(com.skype.api.ContactGroup, com.skype.api.Conversation)
  */
 public void onChangeConversation(com.skype.api.ContactGroup obj, Conversation conversation)
 {
     Log.d("Tutorial", "onChangeConversation(" + conversation + ")");
 }
예제 #3
0
 /**
  * ContactGroupListener Override.
  *
  * @since 1.0
  *
  * @see com.skype.api.ContactGroupListener#onPropertyChange(com.skype.api.ContactGroup, com.skype.api.ContactGroup.Property, int, String)
  */
 public void onPropertyChange(com.skype.api.ContactGroup obj, com.skype.api.ContactGroup.Property prop, int value, String svalue)
 {
 }