kythyria / msnp-sharp

Automatically exported from code.google.com/p/msnp-sharp
0 stars 0 forks source link

YM Text Message Received #176

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Thank you for the feedback. I have this bugs and haven't solved it yet. I
have two or more YM Users chat with them. But when i send message to one of
them,both of them are received the message which i send to one of them..How
can this be fixed?

Original issue reported on code.google.com by ptvegat...@gmail.com on 17 Jan 2010 at 3:01

GoogleCodeExporter commented 9 years ago
I have fixed this..I don't know where is the error so i changed the code like 
this:

 protected virtual void DispatchMessage(NetworkMessage message)
        {
            // copy the messageHandlers array because the collection can be 
            // modified during the message handling. (Handlers are
registered/unregistered)
            IMessageHandler[] handlers = MessageHandlers.ToArray();

            // now give the handlers the opportunity to handle the message
            foreach (IMessageHandler handler in handlers)
            {
                try
                {
                    //I think the person who first write this make a big mistake, C#
is NOT C++,
                    //message class passes as reference, one change, all changed.
                    //Mabe we need to review all HandleMessage calling.
                    ICloneable imessageClone = (message as NSMessage) as ICloneable;
                    NSMessage messageClone = imessageClone.Clone() as NSMessage;
                    if (handler is YIMMessageHandler)
                    {
                        YIMMessageHandler ym = (YIMMessageHandler)handler;
                        int byk =ym.Contacts.Count;

                        Contact [] lst=new Contact[byk];

                        ym.Contacts.Keys.CopyTo(lst, 0);

                        for (int i = 0; i <= lst.Length - 1; i++)

                        {   //check the mail ID
                            if (lst[i].Mail.ToUpper() ==
messageClone.CommandValues[0].ToString().ToUpper())
                            {
                                handler.HandleMessage(this, messageClone);
                                break;
                            }
                        }

                    }
                        else
                    {
                        handler.HandleMessage(this, messageClone);
                    }

                }
                catch (Exception e)
                {
                    if (HandlerException != null)
                        HandlerException(this, new ExceptionEventArgs(new
MSNPSharpException("An exception occured while handling a nameserver message. 
See
inner exception for more details.", e)));
                }
            }
        }

Original comment by ptvegat...@gmail.com on 17 Jan 2010 at 3:40

GoogleCodeExporter commented 9 years ago
Hi,

Cannot reproduce your problem. I use two YIM accounts, one sign in with Yahoo 
Messenger, another sign in with Yahoo Web Messenger. Then I send message to one 
of 
them via example client, everything is ok.

Could you please provide more details?

Original comment by freezing...@gmail.com on 18 Jan 2010 at 7:41

GoogleCodeExporter commented 9 years ago
Am I used an older version of the msnpsharp? I used the v3.0.1 MSNPSharp.

1. I login from your main app.
2. I received IM From MSN User
3. I received IM From 1st YM User
4. I received IM From 2nd YM User
5. Retry from 2nd point to 4th point for a few times.
6. Then the IM received is shown to our conversation form (Our 1st YM User
Conversation and the 2nd YM User Conversation)

I don't know why, when I try to debug, the textMessageReceived is fired twice.

Thank you...

Original comment by ptvegat...@gmail.com on 18 Jan 2010 at 10:17

GoogleCodeExporter commented 9 years ago
Hi,
I don't know what happened just now. A moment ago, I can accepted IM From YM, 
But
Just now, it can't accepted. the Sb_Created Event and textmessagereceived is not
fired.. Then I try used the demo application, the YM user is not offline 
eventhough
the YM user is online..

Original comment by ptvegat...@gmail.com on 18 Jan 2010 at 11:15

GoogleCodeExporter commented 9 years ago
Hi,
I don't know what happened..the YM is works well again..:)

Original comment by ptvegat...@gmail.com on 18 Jan 2010 at 2:03

GoogleCodeExporter commented 9 years ago

Original comment by freezing...@gmail.com on 19 Jan 2010 at 7:58

GoogleCodeExporter commented 9 years ago
Fixed.

Original comment by freezing...@gmail.com on 19 Jan 2010 at 9:55

GoogleCodeExporter commented 9 years ago

Original comment by freezing...@gmail.com on 21 Jan 2010 at 8:02