FACT++  1.0
int SkypeClient::HandleConnect ( )
inlineprivate

Definition at line 552 of file skypeclient.cc.

References Error(), and Tools::Split().

Referenced by SkypeClient().

553  {
554  fLastConnect = Time();
555 
556  // Enable client connection to Skype
557  if (SendDBusMessage("NAME FACT++")!="OK")
558  return kStateDisconnected;
559 
560  // Negotiate protocol version
561  if (SendDBusMessage("PROTOCOL 5")!="PROTOCOL 5")
562  return kStateDisconnected;
563 
564  // Now we are connected: Minimize the window...
565  SendDBusMessageNB("MINIMIZE");
566 
567  // ... and switch off the away message
568  SendDBusMessageNB("SET AUTOAWAY OFF");
569 
570  // Check for unauthorized users and...
571  const string rc = SendDBusMessage("SEARCH USERSWAITINGMYAUTHORIZATION");
572 
573  // ...authorize them
574  vector<string> users = Split(rc);
575 
576  if (users[0]!="USERS")
577  {
578  Error("Unexpected answer received '"+rc+"'");
579  return kStateDisconnected;
580  }
581 
582  for (auto it=users.begin()+1; it!=users.end(); it++)
583  {
584  const size_t p = it->length()-1;
585  if (it->at(p)==',')
586  it->erase(p);
587 
588  SendDBusMessageNB("SET USER "+*it+" BUDDYSTATUS 2 "+fAuthorizationMsg);
589  }
590 
591  return kStateConnected;
592  }
Adds some functionality to boost::posix_time::ptime for our needs.
Definition: Time.h:30
string SendDBusMessage(const string &cmd, bool display=true)
Definition: skypeclient.cc:197
vector< string > Split(const string &msg)
Definition: skypeclient.cc:335
int Error(const std::string &str)
Definition: MessageImp.h:49
static const string fAuthorizationMsg
Definition: skypeclient.cc:17
bool SendDBusMessageNB(const string &cmd)
Definition: skypeclient.cc:298
Time fLastConnect
Definition: skypeclient.cc:24

+ Here is the call graph for this function:

+ Here is the caller graph for this function: