示例#1
0
void AddBuddyImpl::commit()
{
  QString name, group, message;
  
  name = ID->text();
  if ( name.isEmpty() )
    {
      main_window->warnmsg("Please enter a buddy name.");
      reject();
    }

  group = Group->currentText();
  if ( group.isEmpty() )
    {
      main_window->warnmsg("Please enter a group name.");
      reject();
    }

  message = Msg->text();
  imstate->AddNewBuddy( name, group );

  yahoo_add_buddy( context->id, (const char*)name, (const char*)group, (const char*)message );

  accept();
}
示例#2
0
void
YahooConnection::AddBuddy(const char* who)
{
	if (!fGotBuddyList) {
		fBuddiesToAdd.push_back( who );
		return;
	}

	std::list<std::string>::iterator iter = find( fBuddies.begin(), fBuddies.end(), who );

	if (iter == fBuddies.end()) { // not in list, adding
		yahoo_add_buddy(fID, who, "Communicator", "");
		fBuddies.push_back(who);
		printf("Yahoo: Added buddy\n");
	}
}