{"id":203034,"date":"2013-11-21T11:49:03","date_gmt":"2013-11-21T07:49:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=203034"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=203034","title":{"rendered":"<span class=\"post_title\">\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432 \u0441 gmail.com \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Google API<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041e\u0434\u043d\u0430\u0436\u0434\u044b \u043c\u043d\u0435 \u0434\u0430\u043b\u0438 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 (\u0441\u0440\u0435\u0434\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 gmail.com, yahoo.com, aos.com). \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0437\u0430\u043d\u044f\u043b\u0441\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 IMAP \u0438 POP3, \u043d\u043e \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u044d\u0442\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u043d\u0435 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432. \u041e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f API \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u044d\u0442\u0438\u0445 \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u044f \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0441\u044f, \u0442\u0430\u043a-\u043a\u0430\u043a \u044d\u0442\u0438 API \u043d\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u044f\u0437\u044b\u043a\u043e\u0432 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f, \u0430 \u0442\u0430\u043a-\u0436\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0431\u044b \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445.<\/p>\n<p>  \u0420\u0435\u0448\u0438\u043b \u044f \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u043a\u0435\u0442\u043e\u0432 \u2014 \u044d\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432 \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. \u0421\u0443\u0442\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u044d\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430. \u042f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432 \u0441 gmail.com, \u043d\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0438 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f http sniffer. \u042f \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f HTTP Analyzer \u0438 \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e Internet Explorer \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u0434\u043e\u0448\u0451\u043b (Chrome \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0441\u043d\u0438\u0444\u0438\u0442\u0441\u044f, \u0430 Mozilla Firefox \u043c\u043d\u043e\u0433\u043e\u0435 \u043d\u0435 \u0441\u043d\u0438\u0444\u0438\u0442).<\/p>\n<p>  \u041a\u043e\u043d\u0442\u0430\u043a\u0442\u044b \u0434\u0435\u043b\u044f\u0442\u0441\u044f \u043d\u0430 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u0438\u0437 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u00ab\u041a\u043e\u043d\u0442\u0430\u043a\u0442\u044b\u00bb \u0438 \u00ab\u0414\u0440\u0443\u0433\u0438\u0435 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u044b\u00bb. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432, \u043d\u0430\u0434\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b:<\/p>\n<p>  GET \/mail\/?auth=%0 HTTP\/1.1<br \/>  Host: mail.google.com<br \/>  Cookie: SID=%1<\/p>\n<p>  \u00abGET \/mail\/c\/u\/0\/data\/contactstore?ac=false&#038;ccnt=true&#038;cr=true&#038;ct=true&#038;eu=1&#038;ev=true&#038;f=g4&#038;gids=26ae&#038;gp=false&#038;hl=ru&#038;id=personal&#038;max=250&#038;nge=true&#038;out=js&#038;pbd=true&#038;sf=display&#038;st=0&#038;type=4 HTTP\/1.1<br \/>  Host: mail.google.com<br \/>  Cookie: GX=%0<\/p>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 auth \u0438 \u043a\u0443\u043a\u0438 SID \u0438 GX.<\/p>\n<p>  \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c.<br \/>  \u0412\u0445\u043e\u0434\u0438\u043c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 sidt \u0434\u043b\u044f accounts.youtube.com \u0438 \u043a\u0443\u043a SID:  <\/p>\n<pre><code class=\"cpp\">QString GmailCom::postLogin() {     int searchResult  = -1;      QString buffer    = &quot;&quot;;     QString temp      = &quot;&quot;;     QString endString = &quot;\\r\\n&quot;;     QString endHead   = &quot;\\r\\n\\r\\n&quot;;      QString startSidt      = &quot;sidt=&quot;;     QString startCookieSid = &quot;SID=&quot;;     QString autoLogin      = &quot;X-Auto-Login:&quot;;      QSslSocket socket;     socket.connectToHostEncrypted(&quot;accounts.google.com&quot;, 443);      if(!socket.waitForEncrypted(MAX_WAIT))         return &quot;Error 0&quot;;      socket.write(QString(&quot;POST \/ServiceLoginAuth HTTP\/1.1\\r\\n&quot;\\                          &quot;Content-Type: application\/x-www-form-urlencoded\\r\\n&quot;\\                          &quot;Host: accounts.google.com\\r\\n&quot;\\                          &quot;Content-Length: 741\\r\\n&quot;\\                          &quot;Cookie: GALX=P08JFYX33nQ;\\r\\n&quot;\\                          &quot;\\r\\n&quot;\\                          &quot;continue=http%3A%2F%2Fmail.google.com%2Fmail%2F&service=mail&rm=false&dsh=-8197000947972966366&ltmpl=default&scc=1&GALX=P08JFYX33nQ&pstMsg=1&dnConn=&checkConnection=youtube%3A1281%3A0&checkedDomains=youtube&timeStmp=&secTok=&_utf8=%E2%98%83&bgresponse=%21A0KXP079cDPUuUQp6r4pV6akFgIAAAFIUgAAAF4qARD5AbnvQQIZUPsKgyJAteOUThq8meti42P_lSOgXFYCB7HooRpk6np4p5WpvswQrM2ejpn0MjFQxlTHTjWuoyZeWUIsb9xxFDpxCCClPHPv2S3AB416Sq7sUB2IVzG2muVwYSLZ7I_EE99s2k10uDsq9l8nq7IV4QAxMMBRs_SUH-JsiFDBhg0c2xMGGjXvBtoJSGKXuY1d9wTKRx3AQ7hZTyP3vEnLoSX-bj8DruGDteXN1QSMsbLUVd2QQpCSdT6LyDVcEnqo2vJmfxLOvpb898yVrVILjYXona137oYoGy4Lc45CH9c4iicTXIaV4viayj5JlyjgBKPVr7gcYdQVEpLlU6sUGgVuU-RZ64rNLg&Email=%0&Passwd=%1&signIn=%D0%92%D0%BE%D0%B9%D1%82%D0%B8&rmShown=1&quot;).arg(mLogin).arg(mPassword).toUtf8());      while(socket.waitForReadyRead(MAX_WAIT))     {         temp = socket.readAll();         buffer += temp;         if(temp.indexOf(endHead) != -1) break;     }     socket.disconnectFromHost();      searchResult = buffer.indexOf(autoLogin);     if(searchResult != -1) return &quot;Error 1&quot;;      searchResult         = buffer.indexOf(startCookieSid);     if(searchResult == -1) return &quot;Error 2&quot;;     buffer               = buffer.mid(searchResult + startCookieSid.length());     mCookieSid           = buffer.mid(0, buffer.indexOf(endString));      searchResult         = buffer.indexOf(startSidt);     if(searchResult == -1) return &quot;Error 3&quot;;     buffer               = buffer.mid(searchResult + startSidt.length());     mAccountsYoutubeSidt = buffer.mid(0, buffer.indexOf(endString));      return &quot;Ok&quot;; } <\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 sidt \u0434\u043b\u044f accounts.google.com:  <\/p>\n<pre><code class=\"cpp\">QString GmailCom::getAccountsGoogle() {     int searchResult  = -1;      QString buffer    = &quot;&quot;;     QString temp      = &quot;&quot;;     QString endString = &quot;\\r\\n&quot;;     QString endHead   = &quot;\\r\\n\\r\\n&quot;;      QString startSidt = &quot;sidt=&quot;;      QSslSocket socket;     socket.connectToHostEncrypted(&quot;accounts.youtube.com&quot;, 443);      if(!socket.waitForEncrypted(MAX_WAIT))         return &quot;Error 4&quot;;      socket.write(QString(&quot;GET \/accounts\/SetSID?ssdc=1&sidt=%0 HTTP\/1.1\\r\\n&quot;\\                          &quot;Host: accounts.youtube.com\\r\\n&quot;\\                          &quot;\\r\\n&quot;).arg(mAccountsYoutubeSidt).toUtf8());      while(socket.waitForReadyRead(MAX_WAIT))     {         temp = socket.readAll();         buffer += temp;         if(temp.indexOf(endHead) != -1) break;     }     socket.disconnectFromHost();      searchResult        = buffer.indexOf(startSidt);     if(searchResult == -1) return &quot;Error 5&quot;;     buffer              = buffer.mid(searchResult + startSidt.length());     mAccountsGoogleSidt = buffer.mid(0, buffer.indexOf(endString));      return &quot;Ok&quot;; } <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 auth \u0434\u043b\u044f mail.google.com:  <\/p>\n<pre><code class=\"cpp\">QString GmailCom::getAccountsMail() {     int searchResult  = -1;      QString buffer    = &quot;&quot;;     QString temp      = &quot;&quot;;     QString endString = &quot;\\r\\n&quot;;     QString endHead   = &quot;\\r\\n\\r\\n&quot;;      QString startAuth = &quot;auth=&quot;;      QSslSocket socket;     socket.connectToHostEncrypted(&quot;accounts.youtube.com&quot;, 443);      if(!socket.waitForEncrypted(MAX_WAIT))         return &quot;Error 6&quot;;      socket.write(QString(&quot;GET \/accounts\/SetSID?ssdc=1&sidt=%0 HTTP\/1.1\\r\\n&quot;\\                          &quot;Host: accounts.google.md\\r\\n&quot;\\                          &quot;\\r\\n&quot;).arg(mAccountsGoogleSidt).toUtf8());      while(socket.waitForReadyRead(MAX_WAIT))     {         temp = socket.readAll();         buffer += temp;         if(temp.indexOf(endHead) != -1) break;     }     socket.disconnectFromHost();      searchResult    = buffer.indexOf(startAuth);     if(searchResult == -1) return &quot;Error 7&quot;;     buffer          = buffer.mid(searchResult + startAuth.length());     mMailGoogleAuth = buffer.mid(0, buffer.indexOf(endString));      return &quot;Ok&quot;; } <\/code><\/pre>\n<p>  \u0418 \u0434\u043e\u0441\u0442\u0430\u0451\u043c \u043d\u0430\u0448 \u0438\u0441\u043a\u043e\u043c\u044b\u0439 \u043a\u0443\u043a GX:  <\/p>\n<pre><code class=\"cpp\">QString GmailCom::getMailAuth() {     int searchResult = -1;      QString buffer    = &quot;&quot;;     QString temp      = &quot;&quot;;     QString endString = &quot;\\r\\n&quot;;     QString endHead   = &quot;\\r\\n\\r\\n&quot;;      QString startGx = &quot;GX=&quot;;      QSslSocket socket;     socket.connectToHostEncrypted(&quot;mail.google.com&quot;, 443);      if(!socket.waitForEncrypted(MAX_WAIT))         return &quot;Error 8&quot;;      socket.write(QString(&quot;GET \/mail\/?auth=%0 HTTP\/1.1\\r\\n&quot;\\                          &quot;Host: mail.google.com\\r\\n&quot;\\                          &quot;Cookie: SID=%1\\r\\n&quot;\\                          &quot;\\r\\n&quot;).arg(mMailGoogleAuth).arg(mCookieSid).toUtf8());      while(socket.waitForReadyRead(MAX_WAIT))     {         temp = socket.readAll();         buffer += temp;         if(temp.indexOf(endHead) != -1) break;     }     socket.disconnectFromHost();      searchResult = buffer.indexOf(startGx);     if(searchResult == -1) return &quot;Error 9&quot;;     buffer       = buffer.mid(searchResult + startGx.length());     mGxCookie    = buffer.mid(0, buffer.indexOf(endString));      return &quot;Ok&quot;; } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432:  <\/p>\n<pre><code class=\"cpp\">QString GmailCom::getMyContacts() {     int searchResult = -1;      QStringList listContacts;     QString     stringContacts;      QString buffer        = &quot;&quot;;     QString startContacts = &quot;&&&START&&&&quot;;     QString endContacts   = &quot;&&&END&&&&quot;;      QString temp     = &quot;&quot;;     QString rn       = &quot;\\r\\n&quot;;      QSslSocket socket;     socket.connectToHostEncrypted(&quot;mail.google.com&quot;, 443);      if(!socket.waitForEncrypted(MAX_WAIT))         return &quot;Error 10&quot;;      socket.write(QString(&quot;GET \/mail\/c\/u\/0\/data\/contactstore?ac=false&ccnt=true&cr=true&ct=true&eu=1&ev=true&f=g4&gids=6&gp=false&hl=ru&id=personal&max=250&nge=true&out=js&pbd=true&type=4 HTTP\/1.1\\r\\n&quot;\\                          &quot;Host: mail.google.com\\r\\n&quot;\\                          &quot;Cookie: GX=%0\\r\\n&quot;\\                          &quot;\\r\\n&quot;).arg(mGxCookie).toUtf8());      while(socket.waitForReadyRead(MAX_WAIT))     {         temp = socket.readAll();         buffer += temp;         if(temp.indexOf(endContacts) != -1) break;     }     socket.disconnectFromHost();      searchResult = buffer.indexOf(startContacts);     if(searchResult == -1) return &quot;Error 11&quot;;     buffer = buffer.mid(searchResult + startContacts.length());      searchResult = buffer.indexOf(endContacts);     if(searchResult == -1) return &quot;Error 11&quot;;     buffer = buffer.mid(0, searchResult);      while(1)     {         int rn_1 = buffer.indexOf(rn, 0);         int rn_2 = buffer.indexOf(rn, rn_1 + rn.length());         if(rn_1 == -1 || rn_2 == -1)             break;         else             buffer.remove(rn_1, rn_2 - rn_1 + rn.length());     }      listContacts = buffer.split(&quot;\\\\\\&quot;&quot;);     listContacts.removeDuplicates();      for(int i = 0; i &lt; listContacts.size(); i++)         if(listContacts[i].indexOf(&quot;@&quot;) != -1)             stringContacts += listContacts[i] + &quot; &quot;;      return stringContacts; } <\/code><\/pre>\n<p>  \u0418 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432 \u0438\u0437 \u0433\u0440\u0443\u043f\u043f\u044b \u00ab\u0414\u0440\u0443\u0433\u0438\u0435 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u044b\u00bb:  <\/p>\n<pre><code class=\"cpp\">QString GmailCom::getGroupContacts() {     int searchResult = -1;      QStringList listContacts;     QString     stringContacts;      QString buffer        = &quot;&quot;;     QString startContacts = &quot;&&&START&&&&quot;;     QString endContacts   = &quot;&&&END&&&&quot;;      QString temp     = &quot;&quot;;     QString rn       = &quot;\\r\\n&quot;;      QSslSocket socket;     socket.connectToHostEncrypted(&quot;mail.google.com&quot;, 443);      if(!socket.waitForEncrypted(MAX_WAIT))         return &quot;Error 12&quot;;      socket.write(QString(&quot;GET \/mail\/c\/u\/0\/data\/contactstore?ac=false&ccnt=true&cr=true&ct=true&eu=1&ev=true&f=g4&gids=26ae&gp=false&hl=ru&id=personal&max=250&nge=true&out=js&pbd=true&sf=display&st=0&type=4 HTTP\/1.1\\r\\n&quot;\\                          &quot;Host: mail.google.com\\r\\n&quot;\\                          &quot;Cookie: GX=%0\\r\\n&quot;\\                          &quot;\\r\\n&quot;                          ).arg(mGxCookie).toUtf8());      while(socket.waitForReadyRead(MAX_WAIT))     {         temp = socket.readAll();         buffer += temp;         if(temp.indexOf(endContacts) != -1) break;     }     socket.disconnectFromHost();      searchResult = buffer.indexOf(startContacts);     if(searchResult == -1) return &quot;Error 13&quot;;     buffer = buffer.mid(searchResult + startContacts.length());      searchResult = buffer.indexOf(endContacts);     if(searchResult == -1) return &quot;Error 13&quot;;     buffer = buffer.mid(0, searchResult);      while(1)     {         int rn_1 = buffer.indexOf(rn, 0);         int rn_2 = buffer.indexOf(rn, rn_1 + rn.length());         if(rn_1 == -1 || rn_2 == -1)             break;         else             buffer.remove(rn_1, rn_2 - rn_1 + rn.length());     }      listContacts = buffer.split(&quot;\\\\\\&quot;&quot;);     listContacts.removeDuplicates();      for(int i = 0; i &lt; listContacts.size(); i++)         if(listContacts[i].indexOf(&quot;@&quot;) != -1)             stringContacts += listContacts[i] + &quot; &quot;;      return stringContacts; } <\/code><\/pre>\n<p>  \u0415\u0449\u0451 \u0435\u0441\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430:  <\/p>\n<pre><code class=\"cpp\">GmailCom::GmailCom(QString login, QString password):     mLogin(login), mPassword(password) {} <\/code><\/pre>\n<p>  \u0418 \u0441\u0430\u043c \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432:  <\/p>\n<pre><code class=\"cpp\">QString GmailCom::getContacts() {     QString temp;     QString error;      if((error = postLogin())         != &quot;Ok&quot;) return error;     if((error = getAccountsGoogle()) != &quot;Ok&quot;) return error;     if((error = getAccountsMail())   != &quot;Ok&quot;) return error;     if((error = getMailAuth())       != &quot;Ok&quot;) return error;      QString stringContacts = &quot;&quot;;      temp = getMyContacts();     if(temp.split(' ')[0] == &quot;Error&quot;) return temp;     stringContacts += temp;      temp = getGroupContacts();     if(temp.split(' ')[0] == &quot;Error&quot;) return temp;     stringContacts += temp;      stringContacts.remove(stringContacts.length() - 1, 1);      return stringContacts; } <\/code><\/pre>\n<p>  \u0425\u0435\u0434\u0435\u0440 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<pre><code class=\"cpp\">#ifndef GMAILCOM_H #define GMAILCOM_H  #include &lt;QSslSocket&gt; #include &lt;QNetworkProxy&gt; #include &lt;QStringList&gt;  #define MAX_WAIT 3000  class GmailCom { private:     QString mLogin;     QString mPassword;      QString mAccountsYoutubeSidt;     QString mAccountsGoogleSidt;     QString mMailGoogleAuth;      QString mCookieSid;     QString mGxCookie;      QString postLogin();     QString getAccountsGoogle();     QString getAccountsMail();     QString getMailAuth();     QString getMyContacts();     QString getGroupContacts();  public:     explicit GmailCom(QString login, QString password);     explicit GmailCom(QString login, QString password, QString proxyHostName, int proxyPort);     explicit GmailCom(QString login, QString password, QString proxyHostName, int proxyPort, QString proxyUser, QString proxyPassword);      QString getContacts(); };  #endif <\/code><\/pre>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430:  <\/p>\n<pre><code class=\"cpp\">#include &lt;QCoreApplication&gt; #include &quot;GmailCom.h&quot;  int main(int argc, char *argv[]) {     QCoreApplication a(argc, argv);      GmailCom gmailCom(&quot;login&quot;, &quot;password&quot;);     qDebug() &lt;&lt; gmailCom.getContacts();      return a.exec(); } <\/code><\/pre>\n<p>  \u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 *.pro \u0444\u0430\u0439\u043b:  <\/p>\n<pre><code class=\"cpp\">#------------------------------------------------- # # Project created by QtCreator 2013-10-23T09:40:42 # #-------------------------------------------------  QT       += core QT       += network QT       -= gui  TARGET = Mailer CONFIG   += console CONFIG   -= app_bundle  TEMPLATE = app   SOURCES += main.cpp \\     GmailCom.cpp  HEADERS += \\     GmailCom.h <\/code><\/pre>\n<p>  \u0412\u0441\u0451 \u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0437\u0430\u0449\u0438\u0449\u0451\u043d\u043d\u043e\u043c\u0443 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044e. \u041a\u043e\u0434 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0430\u0431\u043e\u0447\u0438\u0439. \u0415\u0441\u043b\u0438 \u0441\u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0438\u0442\u044c \u043f\u043e\u043e\u0447\u0435\u0440\u0451\u0434\u043d\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0431\u043b\u043e\u043a \u043a\u043e\u0434\u0430 \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u2014 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 g++, \u0441\u0440\u0435\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 Qt creator, \u0432\u0435\u0440\u0441\u0438\u044f 5.1 \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/203034\/\"> http:\/\/habrahabr.ru\/post\/203034\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041e\u0434\u043d\u0430\u0436\u0434\u044b \u043c\u043d\u0435 \u0434\u0430\u043b\u0438 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 (\u0441\u0440\u0435\u0434\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 gmail.com, yahoo.com, aos.com). \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0437\u0430\u043d\u044f\u043b\u0441\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 IMAP \u0438 POP3, \u043d\u043e \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u044d\u0442\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u043d\u0435 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432. \u041e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f API \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u044d\u0442\u0438\u0445 \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u044f \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0441\u044f, \u0442\u0430\u043a-\u043a\u0430\u043a \u044d\u0442\u0438 API \u043d\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u044f\u0437\u044b\u043a\u043e\u0432 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f, \u0430 \u0442\u0430\u043a-\u0436\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0431\u044b \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445.<\/p>\n<p>  \u0420\u0435\u0448\u0438\u043b \u044f \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u043a\u0435\u0442\u043e\u0432 \u2014 \u044d\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432 \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. \u0421\u0443\u0442\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u044d\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430. \u042f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432 \u0441 gmail.com, \u043d\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0438 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-203034","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/203034","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=203034"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/203034\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=203034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=203034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=203034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}