예제 #1
0
 void mySkypeClient_SkypeResponse(object theSender, SkypeResponseEventArgs theEventArgs)
 {
     if (SkypeResponse != null)
     {
         SkypeResponse(this, theEventArgs);
     }
 }
예제 #2
0
        void mySkypeClient_OnSkypeResponse(object theSender, SkypeResponseEventArgs theEventArgs)
        {
            if (SkypeResponse != null)
            {
                SkypeResponse(this, theEventArgs);
            }

            String response = theEventArgs.Response;

            // strip off any command ID
            if (response[0] == '#')
            {
                response = response.Substring(response.IndexOf(' ') + 1);
            }

            if (response.StartsWith(Constants.CALL_string))
            {
                HandleCallMessage(response);
            }
            else if (response == Constants.PONG_string)
            {
                pongSuccess.Set();
            }
            else if (response == Constants.CREATE_APPLICATION_string)
            {
                ap2ApCreateEvent.Set();
            }
            else if (response.StartsWith(Constants.GET_USER_response))
            {
                localUser = response.Substring(Constants.GET_USER_response.Length);
                getUserSuccess.Set();
            }
            else if (response.StartsWith(Constants.STREAM_NAME_string))
            {
                if (response.Length > Constants.STREAM_NAME_string.Length)
                {
                    streamName = response.Substring(Constants.STREAM_NAME_string.Length);
                    RaiseSkypeProxyMessage(String.Format("SkypeApi::HandleSkypeMessage: stream name is '{0}'", streamName));
                    RaiseAp2ApConnect();
                    ap2ApConnectEvent.Set();
                }
                else
                {
                    RaiseSkypeProxyMessage(String.Format("SkypeApi::HandleSkypeMessage: received empty stream name, so do nothing"));
                }
            }
            else if (response.StartsWith(Constants.APPLICATION_RECEIVED_string))
            {
                HandleApplicationReceived(response);
            }
            else if (response.StartsWith(Constants.READ_APPLICATION_string))
            {
                HandleReadApplication(response);
            }
            else if (response.StartsWith(Constants.CHATMESSAGE_string_start) &&
                     response.EndsWith(Constants.CHATMESSAGE_string_end))
            {
                if (ChatMsgAdvancesCamera)
                {
                    RaiseSkypeProxyMessage("CHATMESSAGE received -- will switch cameras");
                    RaiseAdvanceCamera();
                }
                else
                {
                    RaiseSkypeProxyMessage("CHATMESSAGE received, but camera-switching disabled for chat messages");
                }
            }
        }
 void mySkypeClient_SkypeResponse(object theSender, SkypeResponseEventArgs theEventArgs)
 {
     if (SkypeResponse != null)
         SkypeResponse(this, theEventArgs);
 }
예제 #4
0
 void skypeProxy_SkypeResponse(object sender, SkypeResponseEventArgs e)
 {
     if ((tcpClient != null) && (tcpClient.Connected) && (streamWriter != null))
     {
         string[] details = e.Response.Split(' ');
         if (Authenticated)
         {
             if ((details.Length > 3) &&
             ((details[0] == "MESSAGE") || (details[0] == "CHATMESSAGE")) &&
             (details[2] == "STATUS") &&
             (details[3] == "RECEIVED"))
             {
                 skypeProxy.Command("GET " + details[0] + " " + details[1] + " FROM_HANDLE");
                 skypeProxy.Command("GET " + details[0] + " " + details[1] + " BODY");
             }
             streamWriter.WriteLine(e.Response);
         }
         else
         {
             if ((details.Length > 1) &&
                 (details[0] == "CURRENTUSERHANDLE"))
             {
                 Authenticated = true;
                 streamWriter.WriteLine("AUTH " + details[1] + " " + JabberIDTextBox.Text);
             }
         }
     }
 }
예제 #5
0
        void aSkype_SkypeResponse(object theSender, SkypeResponseEventArgs theEventArgs)
        {
            try
            {
                string response = "";
                string[] lines;
                string[] userSplit;

                switch (action)
                {
                    case "Friends":
                        action = "";
                        response = theEventArgs.Response;
                        lines = Regex.Split(response, "USERS ");
                        response = lines[1];
                        userSplit = Regex.Split(response, ", ");
                        friends.Clear();

                        foreach (string eachUser in userSplit)
                        {
                            friends.Add(eachUser);
                            aSkype.Command("MESSAGE " + eachUser + " " + txtMessage.Text);
                        }

                        txtMessage.Text = "";
                        break;

                      case "Accept Requests":
                        action = "";
                        response = theEventArgs.Response;
                        lines = Regex.Split(response, "USERS ");
                        response = lines[1];

                        userSplit = Regex.Split(response, ", ");
                        requestFriendship.Clear();

                        foreach (string eachUser in userSplit)
                        {
                            requestFriendship.Add(eachUser);
                            aSkype.Command("SET USER " + eachUser + " BUDDYSTATUS 2");
                            System.Threading.Thread.Sleep(10);
                        }

                      break;

                    case "Connect":
                      action = "";
                      txtMessage.Enabled = true;
                      btnMessageContacts.Enabled = true;
                      button4.Enabled = true;
                      button1.Enabled = false;
                    break;
                }

            }
            catch (SyntaxErrorException ex)
            {
            }
            finally
            {
            }
        }
예제 #6
0
 void skypeProxy_SkypeResponse(object theSender, SkypeResponseEventArgs theEventArgs)
 {
     string response = theEventArgs.Response;
     if (!(SkypeProxy.IsDurationMessage(response)))
         this.AppendText(string.Format("Response: {0}\r\n", response));
 }
        void skypeProxy_SkypeResponse(object sender, SkypeResponseEventArgs e)
        {
            AppendToLog(e.Response);

            Match match;

            match = Regex.Match(e.Response, @"CURRENTUSERHANDLE (?<username>.*)");
            if (match.Success)
                username = match.Groups["username"].Value;

            match = Regex.Match(e.Response, @"MESSAGE (?<id>\d+) STATUS RECEIVED");
            if (match.Success)
            {
                ulong id = Convert.ToUInt64(match.Groups["id"].Value);
                NewMessageReceived(id);
                return;
            }

            match = Regex.Match(e.Response, @"MESSAGE (?<id>\d+) PARTNER_HANDLE (?<userId>.*)");
            if (match.Success)
            {
                ulong id = Convert.ToUInt64(match.Groups["id"].Value);
                string userId = match.Groups["userId"].Value;
                MessageUserIdReceived(id, userId);
                return;
            }

            match = Regex.Match(e.Response, @"MESSAGE (?<id>\d+) CHATNAME (?<conversationId>.*)");
            if (match.Success)
            {
                ulong id = Convert.ToUInt64(match.Groups["id"].Value);
                string conversationId = match.Groups["conversationId"].Value;
                MessageConversationIdReceived(id, conversationId);
                return;
            }

            match = Regex.Match(e.Response, @"MESSAGE (?<id>\d+) BODY (?<body>.*)");
            if (match.Success)
            {
                ulong id = Convert.ToUInt64(match.Groups["id"].Value);
                string body = match.Groups["body"].Value;
                MessageBodyReceived(id, body);
                return;
            }

            match = Regex.Match(e.Response, @"MESSAGE (?<id>\d+) STATUS READ");
            if (match.Success)
            {
                ulong id = Convert.ToUInt64(match.Groups["id"].Value);
                MessageRead(id);
                return;
            }
        }
예제 #8
0
        void mySkypeClient_OnSkypeResponse(object theSender, SkypeResponseEventArgs theEventArgs)
        {
            if (SkypeResponse != null)
                SkypeResponse(this, theEventArgs);

            String response = theEventArgs.Response;
            // strip off any command ID
            if (response[0] == '#')
            {
                response = response.Substring(response.IndexOf(' ') + 1);
            }

            if (response.StartsWith(Constants.CALL_string))
            {
                HandleCallMessage(response);
            }
            else if (response == Constants.PONG_string)
            {
                pongSuccess.Set();
            }
            else if (response == Constants.CREATE_APPLICATION_string)
            {
                ap2ApCreateEvent.Set();
            }
            else if (response.StartsWith(Constants.GET_USER_response))
            {
                localUser = response.Substring(Constants.GET_USER_response.Length);
                getUserSuccess.Set();
            }
            else if (response.StartsWith(Constants.STREAM_NAME_string))
            {
                if (response.Length > Constants.STREAM_NAME_string.Length)
                {
                    streamName = response.Substring(Constants.STREAM_NAME_string.Length);
                    RaiseSkypeProxyMessage(String.Format("SkypeApi::HandleSkypeMessage: stream name is '{0}'", streamName));
                    RaiseAp2ApConnect();
                    ap2ApConnectEvent.Set();
                }
                else
                {
                    RaiseSkypeProxyMessage(String.Format("SkypeApi::HandleSkypeMessage: received empty stream name, so do nothing"));
                }
            }
            else if (response.StartsWith(Constants.APPLICATION_RECEIVED_string))
            {
                HandleApplicationReceived(response);
            }
            else if (response.StartsWith(Constants.READ_APPLICATION_string))
            {
                HandleReadApplication(response);
            }
            else if (response.StartsWith(Constants.CHATMESSAGE_string_start)
                && response.EndsWith(Constants.CHATMESSAGE_string_end))
            {
                if (ChatMsgAdvancesCamera)
                {
                    RaiseSkypeProxyMessage("CHATMESSAGE received -- will switch cameras");
                    RaiseAdvanceCamera();
                }
                else
                {
                    RaiseSkypeProxyMessage("CHATMESSAGE received, but camera-switching disabled for chat messages");
                }
            }
        }
예제 #9
0
 void aSkype_SkypeResponse(object theSender, SkypeResponseEventArgs theEventArgs)
 {
     textBox1.AppendText(string.Format("Response: {0}\r\n", theEventArgs.Response));
 }