TReKiE / msnp-sharp

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

ReverseAdded doesn't always get fired. #203

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add a new EventHandler to the Nameserver.ContactService.ReverseAdded event 
on your bot (A).
2. Log into another account (B) and add the bot (A) to (B)'s contact list. 
(Make sure this is the first time (B) adds (A)).

What is the expected output? What do you see instead?
The ReverseAdded event should be fired, but instead, nothing happens.
This is not always the case though, as sometimes it does get fired.
If the event wasn't fired, it get's fired the next time the program is started.

What version of the product are you using? (MSNPSharp, OS, Mono etc.)
MSNPSHARP_30_STABLE on .NET 3.5

Is your code check out from SVN or download from our download site?
Downloads page.

Original issue reported on code.google.com by SuprD...@gmail.com on 7 Jul 2010 at 9:24

GoogleCodeExporter commented 9 years ago
This looks a bit duplicated to issue 165. SuprDewd try it with the reverse (one 
being a MSNPSharp client and the other MSN Live account - try the MSNPSharp 
client sending an invitation to the MSN account) and do the same thing with 
that.

Original comment by electk...@gmail.com on 8 Jul 2010 at 9:52

GoogleCodeExporter commented 9 years ago
Wait, is account A provisioned (in bot mode)?

Original comment by electk...@gmail.com on 8 Jul 2010 at 10:21

GoogleCodeExporter commented 9 years ago
This is not the same as issue 165.
I tried adding an MSN Live account from the bot and the MSN Live account got 
the request.
Also, I tried it on MSNPSHARP_312_BETA from the Downloads page an hour ago and 
the issue still seems to exist.

Original comment by SuprD...@gmail.com on 8 Jul 2010 at 10:22

GoogleCodeExporter commented 9 years ago
A is not provisioned and bot mode is off.

Original comment by SuprD...@gmail.com on 8 Jul 2010 at 10:22

GoogleCodeExporter commented 9 years ago
Yes, nothing has been changed. I am still learning sorry. Can you try and 
summarise:

MSN Live -> MSN Live (this is done)
MSN Live -> MSNPSharp account
MSNPSharp account -> MSN Live
MSNPSharp account -> MSNPSharp account

Original comment by electk...@gmail.com on 8 Jul 2010 at 10:33

GoogleCodeExporter commented 9 years ago
MSN Live -> MSN Live (this is done) - OK
MSN Live -> MSNPSharp account - NOT OK (Works sometimes, usually not)
MSNPSharp account -> MSN Live - OK
MSNPSharp account -> MSNPSharp account - Don't Know

Original comment by SuprD...@gmail.com on 8 Jul 2010 at 10:53

GoogleCodeExporter commented 9 years ago
MSNPSharp account -> MSNPSharp account - Not working either

Original comment by SuprD...@gmail.com on 8 Jul 2010 at 11:12

GoogleCodeExporter commented 9 years ago
Thanks. I'll do it when I get the time and need. Pang WU could check this too :)

Original comment by electk...@gmail.com on 8 Jul 2010 at 11:17

GoogleCodeExporter commented 9 years ago
BTW, here's some of my code:

MSN = new Messenger();
MSN.Credentials = new Credentials("****@****.***", "*******", 
MsnProtocol.MSNP18);
MSN.Nameserver.ContactService.ReverseAdded += new 
EventHandler<ContactEventArgs>(ReverseAdded);
/* other events */
MSN.Connect();

void ReverseAdded(object sender, ContactEventArgs e)      
{
Contact c = e.Contact;
MSN.Nameserver.ContactService.AddNewContact(c.Mail);
System.Threading.Thread.Sleep(200);
c.OnAllowedList = true;
System.Threading.Thread.Sleep(200);
c.OnPendingList = false;
}

Original comment by SuprD...@gmail.com on 8 Jul 2010 at 11:21

GoogleCodeExporter commented 9 years ago
Cool, that code should work. Probably it needs looking :)

Original comment by electk...@gmail.com on 8 Jul 2010 at 11:24

GoogleCodeExporter commented 9 years ago
Thanks.

Original comment by SuprD...@gmail.com on 8 Jul 2010 at 11:26

GoogleCodeExporter commented 9 years ago
Please provide the trace log of 
MSN Live -> MSNPSharp account - NOT OK (Works sometimes, usually not)
MSNPSharp account -> MSNPSharp account - Not working either

Original comment by freezing...@gmail.com on 8 Jul 2010 at 4:45

GoogleCodeExporter commented 9 years ago
What trace log? I'm not using the example client...

Original comment by SuprD...@gmail.com on 8 Jul 2010 at 10:51

GoogleCodeExporter commented 9 years ago
Just add this to your ReverseAdded event to make it easier to find out if it 
has been fired.

Trace.WriteLine("ReverseAdded event has been fired \r\n");

This will help you see if it has been triggered on your Output on Visual 
Studio. The example client is recommended to test however, but the code you put 
should work. Just put in the start of the event so you know that it has been 
triggered.

All the information, such as when it logs in, what's up, and such information 
is traced onto the Output of Visual Studio when you debug. Use that as your 
trace log if you don't want to use the example client. 

Original comment by electk...@gmail.com on 9 Jul 2010 at 6:05

GoogleCodeExporter commented 9 years ago
Hello,

You can export the trace log of MSNPSharp to a file. You can see how to do it 
by reading the TraceForm.cs in example client (The example client just redirect 
these trace into a richtextbox). The trace log includes a lot of debug 
information of MSNPSharp, which will help us a lot in solving your problem. 
It's very hard to test for your issue without the log because we don't have so 
much new account for adding.

Original comment by freezing...@gmail.com on 9 Jul 2010 at 6:44

GoogleCodeExporter commented 9 years ago
I'm 100% sure that it never fires the ReverseAdded. I have my own logging 
system, and nothing's getting logged from the ReverseAdded event, plus i have a 
breakpoint at the start of the ReverseAdded method, and it never 'breaks'.

Original comment by SuprD...@gmail.com on 9 Jul 2010 at 8:32

GoogleCodeExporter commented 9 years ago
I tried MSN Live -> MSNSharp account (using the example client) and it seems to 
be working! That means that it's my code that's not working... Any ideas?

Original comment by SuprD...@gmail.com on 9 Jul 2010 at 2:23

GoogleCodeExporter commented 9 years ago
From example clients trace:

...
NSMessageProcessor: Parsing incoming NS command...
NSMessageProcessor: Dispatching incoming NS command: ADL 0 89
<ml><d n="*****.***"><c n="*****" t="1" l="8" f="*****@*****.***" /></d></ml>
<MSNPSharp.IO.XMLContactList>: Saving underlying data...
<MSNPSharp.IO.XMLContactList> serialize time (by ticks): 0
<Compress> Compress time (by ticks): 0
<Encyrpt> Encyrpt time (by ticks): 0
<MSNPSharp.IO.MclFile> Write raw file time (by ticks): 156250
<MSNPSharp.IO.XMLContactList> Total saving time (by ticks): 156250

ADL received, reverse added fired. Contact is in list: PendingList
NSMessageHandler: *****@*****.***:PassportMember was added to your ReverseList
MSNPSharp.MSNWS.MSNABSharingService.SharingServiceBinding is requesting a 
cachekey and preferred host for calling DeleteMember
Get redirect URL by HTTP error succeed, method DeleteMember:
 Original: byrdr.omega.contacts.msn.com
 Redirect: local-sn.contacts.msn.com
...

Original comment by SuprD...@gmail.com on 9 Jul 2010 at 2:28

GoogleCodeExporter commented 9 years ago
"ADL received, reverse added fired. Contact is in list: PendingList"

Have you seen this line of log?
That means the event fired, it's your problem. Please check you code.

Original comment by freezing...@gmail.com on 9 Jul 2010 at 4:16

GoogleCodeExporter commented 9 years ago
Yes I know. But according to you guys, my code is perfectly valid. Any 
suggestions on what could be causing this?

Original comment by SuprD...@gmail.com on 9 Jul 2010 at 4:38

GoogleCodeExporter commented 9 years ago
I think you may encount threading problems? Please export the trace log of 
MSNPSharp in your own program, it will help a lot.

Original comment by freezing...@gmail.com on 11 Jul 2010 at 9:55

GoogleCodeExporter commented 9 years ago
This is still pretty weird, as it does sometimes get fired... I am totally 
clueless. :(

Original comment by SuprD...@gmail.com on 11 Jul 2010 at 8:02

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Actually, even for official WLM, this event will miss sometimes.

Original comment by freezing...@gmail.com on 12 Jul 2010 at 8:24

GoogleCodeExporter commented 9 years ago
Oh OK.. So the only way is to restart the bot every day so new customers get 
added? :(

Original comment by SuprD...@gmail.com on 12 Jul 2010 at 8:46

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Or could I check for friend requests programmatically like:

if (MSN.PendingFriends.Length > 0)
{
// loop through each pending friend and add
}

Original comment by SuprD...@gmail.com on 12 Jul 2010 at 9:34

GoogleCodeExporter commented 9 years ago
I suggest you check out the code from svn and recompile the library again, then 
see whether this problem still exists.

Original comment by freezing...@gmail.com on 13 Jul 2010 at 12:56

GoogleCodeExporter commented 9 years ago
I checked out from svn and recompiled. So far, it's working.

Original comment by SuprD...@gmail.com on 13 Jul 2010 at 9:08

GoogleCodeExporter commented 9 years ago
Nope, still isn't working.

Original comment by SuprD...@gmail.com on 16 Jul 2010 at 11:14