Esempio n. 1
0
 /**
  * ConversationListener Override.
  *
  * @since 1.0
  *
  * @see com.skype.api.ConversationListener#onMessage(com.skype.api.Conversation, com.skype.api.Message)
  */
 public void onMessage(com.skype.api.Conversation obj, Message message)
 {
     Message.Type msgType = message.getType();
     if (msgType == Message.Type.POSTED_TEXT)
     {
         String       conversationID = message.getConvoGuid();
         Conversation conversation   =
             mySession.mySkype.getConversationByIdentity(conversationID);
         String msgAuthor = message.getAuthor();
         String msgBody   = message.getBodyXml();
         if (!msgAuthor.Equals(mySession.myAccountName))
         {
             // Get timestamp -- it's in seconds, and the Date ructor needs milliseconds!
             int      msgTimeStamp  = message.getTimestamp();
             DateTime dateTimeStamp = new DateTime((msgTimeStamp * 1000L));
             //DateFormat targetDateFmt = DateFormat.getDateTimeInstance();
             //MySession.myConsole.printf("%s: [%s] %s posted message%n%s%n",
             //        mySession.myTutorialTag, targetDateFmt.format(dateTimeStamp), msgAuthor, msgBody);
             MySession.myConsole.printf("%s: [%s] %s posted message%n%s%n",
                                        mySession.myTutorialTag, dateTimeStamp.ToString(), msgAuthor, msgBody);
             //Calendar targetDate = Calendar.getInstance();
             //conversation.postText((targetDateFmt.format(targetDate.getTime()) + ": This is an automated reply"), false);
         }
     }
     else
     {
         MySession.myConsole.printf("%s: Ignoring ConversationListener.onMessage of type %s%n",
                                    mySession.myTutorialTag, msgType);
     }
 }
Esempio n. 2
0
        /**
         * ConversationListener Override: Tutorial Handler - Conversation "Live Status".
         * <br /><br />
         * If it's <em>not</em> a "live status" change, ignore it. Otherwise:
         * <ul>
         *   <li>display changes to our live status</li>
         *   <li>handle answering calls for us</li>
         * </ul>
         *
         * Tutorial 6/7 - Looks for:
         * <ul>
         *   <li>RINGING_FOR_ME so we can pick up the call</li>
         *   <li>IM_LIVE to indicate that a call is in progress</li>
         *   <li>RECENTLY_LIVE/NONE to indicate that a call has ended</li>
         *  </ul>
         *
         * @param obj
         *  The affected Conversation.
         * @param prop
         *  The Conversation property that triggered this event.
         * @param value
         *  Ignored.
         *
         * @since 1.0
         *
         * @see com.skype.api.ConversationListener#onPropertyChange(com.skype.api.Conversation, com.skype.api.Conversation.Property, int, String)
         */
        public void onPropertyChange(com.skype.api.Conversation obj, com.skype.api.Conversation.Property prop, int value, String svalue)
        {
            if (prop == Conversation.Property.P_LOCAL_LIVE_STATUS)
            {
                Conversation affectedConversation       = (Conversation)obj;
                Conversation.LocalLiveStatus liveStatus = affectedConversation.getLocalLiveStatus();
                MySession.myConsole.printf("%s: Live status changed to %s%n",
                                           mySession.myTutorialTag, liveStatus);

                if (liveStatus == Conversation.LocalLiveStatus.RINGING_FOR_ME)
                {
                    MySession.myConsole.println("RING RING...");
                    if (doPickUpCall())
                    {
                        MySession.myConsole.println("Conv: Call answered!");
                        activeConversation             = affectedConversation;
                        activeConversationParticipants = affectedConversation.getParticipants(Conversation.ParticipantFilter.ALL);
                        mySession.callActive           = true;
                    }
                }
                else if (liveStatus == Conversation.LocalLiveStatus.RECENTLY_LIVE || liveStatus == Conversation.LocalLiveStatus.NONE)
                {
                    activeConversation             = null;
                    activeConversationParticipants = null;
                    mySession.callActive           = false;
                    MySession.myConsole.println("Conv: Call has ended/never started.");
                }
                else if (liveStatus == Conversation.LocalLiveStatus.IM_LIVE)
                {
                    MySession.myConsole.println("Conv: Live session is up!");
                }
                else
                {
                    MySession.myConsole.println(mySession.myTutorialTag + ": Conv - Ignoring LiveStatus " + liveStatus);
                }
            }
        }
Esempio n. 3
0
 /**
  * ConversationListener Override.
  *
  * @since 1.0
  *
  * @see com.skype.api.ConversationListener#onSpawnConference(com.skype.api.Conversation, com.skype.api.Conversation)
  */
 public void onSpawnConference(com.skype.api.Conversation obj, Conversation spawned)
 {
     Log.d("Tutorial", "onSpawnConference(" + spawned + ")");
 }
Esempio n. 4
0
 /**
  * ConversationListener Override.
  *
  * @since 1.0
  *
  * @see com.skype.api.ConversationListener#onParticipantListChange(com.skype.api.Conversation)
  */
 public void onParticipantListChange(com.skype.api.Conversation obj)
 {
 }