Exemplo n.º 1
0
 private async Task MSNP12LoginToMessengerAsync()
 {
     httpClient = new HttpClient();
     nsSocket   = new SocketCommands(NsAddress, port);
     Action loginAction = new Action(() =>
     {
         //sequence of commands to login to escargot
         nsSocket.ConnectSocket();
         nsSocket.SetReceiveTimeout(25000);
         UserInfo.Email = email;
         GetContactsFromDatabase();
         //begin receiving from escargot
         nsSocket.BeginReceiving(receivedBytes, new AsyncCallback(ReceivingCallback), this);
         TransactionId++;
         nsSocket.SendCommand($"VER {TransactionId} MSNP12 CVR0\r\n");                                  //send msnp version
         TransactionId++;
         nsSocket.SendCommand($"CVR {TransactionId} 0x0409 winnt 10 i386 UWPMESSENGER 0.6 msmsgs\r\n"); //send client information
         TransactionId++;
         nsSocket.SendCommand($"USR {TransactionId} TWN I {email}\r\n");                                //sends email to get a string for use in authentication
         TransactionId++;
         Task <string> tokenTask = GetNexusTokenAsync(httpClient);
         token = tokenTask.Result;
         nsSocket.SendCommand($"USR {TransactionId} TWN S t={token}\r\n");                           //sending authentication token
         TransactionId++;
         nsSocket.SendCommand($"SYN {TransactionId} 0 0\r\n");                                       //sync contact list
         TransactionId++;
         nsSocket.SendCommand($"CHG {TransactionId} {UserPresenceStatus} {ClientCapabilities}\r\n"); //setting selected presence status
     });
     await Task.Run(loginAction);
 }
 private async Task MSNP15LoginToMessengerAsync()
 {
     nsSocket = new SocketCommands(NsAddress, port);
     Action loginAction = new Action(() =>
     {
         nsSocket.ConnectSocket();
         nsSocket.SetReceiveTimeout(25000);
         TransactionId++;
         nsSocket.SendCommand($"VER {TransactionId} MSNP15 CVR0\r\n");
         outputString = nsSocket.ReceiveMessage(receivedBytes);//receive VER response
         TransactionId++;
         nsSocket.SendCommand($"CVR {TransactionId} 0x0409 winnt 10 i386 UWPMESSENGER 0.6 msmsgs\r\n");
         outputString = nsSocket.ReceiveMessage(receivedBytes);//receive CVR response
         TransactionId++;
         nsSocket.SendCommand($"USR {TransactionId} SSO I {email}\r\n");
         outputString = nsSocket.ReceiveMessage(receivedBytes); //receive GCF
         outputString = nsSocket.ReceiveMessage(receivedBytes); //receive USR response with nonce
         TransactionId++;
         UserInfo.Email = email;
         GetMbiKeyOldNonce();
         soapResult = soapRequests.SsoRequest(email, password, mbiKeyOldNonce);
         GetContactsFromDatabase();
         string responseStruct = GetSsoReturnValue();
         nsSocket.SendCommand($"USR {TransactionId} SSO S {ssoTicket} {responseStruct}\r\n"); //sending response to USR
         outputString = nsSocket.ReceiveMessage(receivedBytes);                               //receive USR OK
         nsSocket.BeginReceiving(receivedBytes, new AsyncCallback(ReceivingCallback), this);
         membershipLists = soapRequests.FindMembership();
         addressBook     = soapRequests.AbFindAll();
         FillContactListFromSOAP();
         FillContactsInForwardListFromSOAP();
         SendBLP();
         SendInitialADL();
         SendUserDisplayName();
         TransactionId++;
         nsSocket.SendCommand($"CHG {TransactionId} {UserPresenceStatus} {ClientCapabilities}\r\n");//setting selected presence status
     });
     await Task.Run(loginAction);
 }