I'm having a new problem with the skype library (skype4com)
. In fact they are two problems. I'm doing my application in WindowsForm
(C#)
.
I made an application to send auto-reply on skype.
private Skype skypeId;
private string resposta = "**********ESTA E UMA RESPOSTA AUTOMATICA**********";
private void Form1_Load(object sender, EventArgs e)
{
//captura a instancia do skype
skypeId = new Skype();
skypeId.Attach(7, false);
//Monitor
skypeId.MessageStatus += new _ISkypeEvents_MessageStatusEventHandler(skypeId_MessageStatus);
}
public void skypeId_MessageStatus (ChatMessage msg, TChatMessageStatus status)
{
if(msg.Body != "")
{
System.Threading.Thread.Sleep(5000);
try
{
skypeId.SendMessage(msg.Sender.Handle, resposta);
}
catch (Exception err)
{
}
}
}
What happens is that when a message arrives on skype the application sends after 5 seconds twice the message resposta
. I already tried to put a variable bool
to check and it was the same as below, but it did not work:
public void skypeId_MessageStatus (ChatMessage msg, TChatMessageStatus status)
{
bool novaMsg = true;
if(msg.Body != "" && novaMsg == true)
{
novaMsg = false;
System.Threading.Thread.Sleep(5000);
try
{
skypeId.SendMessage(msg.Sender.Handle, resposta);
}
catch (Exception err)
{
}
}
}
Another problem is that only the reply to new people messages is sent, group messages are not answered. I have already seen here in a question from another user that the form of response in chat is thus Ex: msg.Chat.SendMessage("Mensagem");
, however how can I differentiate a normal conversation from a Skype group chat?