本文整理汇总了C++中ContactRef类的典型用法代码示例。如果您正苦于以下问题:C++ ContactRef类的具体用法?C++ ContactRef怎么用?C++ ContactRef使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ContactRef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnContactListChanged
void CSkypeProto::OnContactListChanged(const ContactRef &contact)
{
bool result;
contact->IsMemberOfHardwiredGroup(CContactGroup::ALL_BUDDIES, result);
if (result)
{
if ( !this->contactList.contains(contact))
{
CContact::Ref newContact(contact);
this->contactList.append(newContact);
newContact.fetch();
}
}
contact->IsMemberOfHardwiredGroup(CContactGroup::CONTACTS_WAITING_MY_AUTHORIZATION, result);
if (result)
{
SEString data;
uint newTS = 0;
contact->GetPropAuthreqTimestamp(newTS);
this->RaiseAuthRequestEvent(newTS, contact);
}
}
示例2: ConfirmUIN
void FileTransferClient::ConfirmUIN()
{
if ( m_contact_list->exists(m_remote_uin) )
{
ContactRef c = (*m_contact_list)[ m_remote_uin ];
if ( (c->getExtIP() == m_local_ext_ip && c->getLanIP() == getIP() )
/* They are behind the same masquerading box,
* and the Lan IP matches
*/
|| c->getExtIP() == getIP())
{
m_contact = c;
}
else
{
// spoofing attempt most likely
ostringstream ostr;
ostr << "Refusing direct connection from someone that claims to be UIN "
<< m_remote_uin << " since their IP " << IPtoString( getIP() ) << " != " << IPtoString( c->getExtIP() );
throw DisconnectedException( ostr.str() );
}
}
else
{
// don't accept direct connections from contacts not on contact list
throw DisconnectedException("Refusing direct connection to contact not on contact list");
}
}
示例3: OnContactChanged
void CSkypeProto::OnContactChanged(const ContactRef &contact, int prop)
{
SEString data;
contact->GetPropSkypename(data);
wchar_t *sid = ::mir_utf8decodeW(data);
MCONTACT hContact = this->GetContactBySid(sid);
::mir_free(sid);
SEObject *contactObj = contact.fetch();
if (hContact)
{
switch(prop)
{
case Contact::P_AUTHREQ_TIMESTAMP:
{
uint newTS = 0;
contact->GetPropAuthreqTimestamp(newTS);
DWORD oldTS = this->getDword(hContact, "AuthTS", 0);
if (newTS > oldTS)
this->RaiseAuthRequestEvent(newTS, contact);
}
break;
case Contact::P_AUTHREQUEST_COUNT:
// todo: all authrequests after first should be catch here
this->UpdateContactAuthState(hContact, contact);
break;
case Contact::P_AVAILABILITY:
this->UpdateContactStatus(hContact, contact);
this->UpdateChatUserStatus(contact);
break;
//case CContact::P_AVATAR_IMAGE:
case Contact::P_AVATAR_TIMESTAMP:
this->UpdateProfileAvatar(contactObj, hContact);
break;
//case CContact::P_MOOD_TEXT:
case Contact::P_MOOD_TIMESTAMP:
this->UpdateProfileStatusMessage(contactObj, hContact);
break;
case Contact::P_FULLNAME:
this->UpdateChatUserNick(contact);
break;
case Contact::P_PROFILE_TIMESTAMP:
this->UpdateProfile(contactObj, hContact);
break;
}
}
}
示例4: ContactRef
ContactRef MessageHandler::lookupMobile(const string& m) {
ContactRef ret;
if (m_contact_list->mobile_exists(m)) {
ret = m_contact_list->lookup_mobile(m);
} else {
ret = ContactRef( new Contact(m) );
ret->setMobileNo(m);
}
return ret;
}
示例5: sid
int CSkypeProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
{
MCONTACT hContact = (MCONTACT)wParam;
if ( !hContact)
return 0;
if ( !this->IsOnline() || ::lstrcmpA(::GetContactProto(hContact), m_szModuleName))
return 0;
if ( !this->isChatRoom(hContact))
{
bool ctrlPressed = (::GetKeyState(VK_CONTROL) & 0x8000) != 0;
bool authNeed = this->getByte(hContact, "Auth", 0) > 0;
bool grantNeed = this->getByte(hContact, "Grant", 0) > 0;
::Menu_ShowItem(CSkypeProto::contactMenuItems[CMI_AUTH_REQUEST], ctrlPressed || authNeed);
::Menu_ShowItem(CSkypeProto::contactMenuItems[CMI_AUTH_GRANT], ctrlPressed || grantNeed);
::Menu_ShowItem(CSkypeProto::contactMenuItems[CMI_AUTH_REVOKE], ctrlPressed || (!grantNeed && !authNeed));
::Menu_ShowItem(CSkypeProto::contactMenuItems[CMI_HISTORY], TRUE);
{
SEString sid(_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
ContactRef contact;
this->GetContact(sid, contact);
bool isBlocked = false;
contact->IsMemberOfHardwiredGroup(ContactGroup::CONTACTS_BLOCKED_BY_ME, isBlocked);
CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_FLAGS;
if (isBlocked)
{
clmi.flags |= CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
clmi.icolibItem = CSkypeProto::GetSkinIconHandle("contact");
clmi.ptszName = LPGENT("Unblock this person...");
}
else
{
clmi.flags |= CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
clmi.icolibItem = CSkypeProto::GetSkinIconHandle("block");
clmi.ptszName = LPGENT("Block this person...");
}
::CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)CSkypeProto::contactMenuItems[CMI_BLOCK], (LPARAM)&clmi);
}
}
return 0;
}
示例6: UpdateContactClient
void CSkypeProto::UpdateContactClient(MCONTACT hContact, const ContactRef &contact)
{
bool isMobile = false;
contact->HasCapability(Contact::CAPABILITY_MOBILE_DEVICE, isMobile/*, true*/);
this->setTString(hContact, "MirVer", isMobile ? L"SkypeMobile" : L"Skype");
}
示例7: UpdateContactLastEventDate
void CSkypeProto::UpdateContactLastEventDate(MCONTACT hContact, const ContactRef &contact)
{
uint newTS = 0;
contact->GetPropLastusedTimestamp(newTS);
DWORD oldTS = this->getDword(hContact, "LastEventDateTS", 0);
if (newTS > oldTS)
this->setDword(hContact, "LastEventDateTS", newTS);
}
示例8: UpdateContactOnlineSinceTime
void CSkypeProto::UpdateContactOnlineSinceTime(MCONTACT hContact, const ContactRef &contact)
{
uint newTS = 0;
contact->GetPropLastonlineTimestamp(newTS);
DWORD oldTS = ::db_get_dw(hContact, this->m_szModuleName, "OnlineSinceTS", 0);
if (newTS > oldTS)
this->setDword(hContact, "OnlineSinceTS", newTS);
}
示例9: add
ContactRef ContactList::add(ContactRef ct) {
m_cmap.insert( std::make_pair(ct->getUIN(), ct) );
// fire off signal
UserAddedEvent uev( ct );
// contactlist_signal.emit( &uev );
contactlist_signal_cb(client, signal_type,&uev );
return ct;
}
示例10: OnChange
void CContactGroup::OnChange(const ContactRef& contact)
{
// if multiple contacts added or removed
if (!contact.present())
return;
String identity;
bool added = false;
contact->GetIdentity(identity);
contact->IsMemberOf(ref(), added);
String mTypeName = getPropDebug(ContactGroup::P_TYPE, GetUintProp(ContactGroup::P_TYPE))[2];
printf("CONTACTGROUP.%s contact %s was %s\n",
(const char*)mTypeName,
(const char*)identity, added ? "added" : "removed");
if ((ContactGroup::TYPE)GetUintProp(ContactGroup::P_TYPE) == ContactGroup::CONTACTS_WAITING_MY_AUTHORIZATION) {
printf("New auth request from %s is received\n", (const char*)identity);
printf("To view/accept/decline pending contact authorization request(s), use the aA account command.\n");
}
}
示例11: add
ContactRef ContactList::add(ContactRef ct) {
m_cmap.insert( std::make_pair(ct->getUIN(), ct) );
// fire off signal
ContactTree::Group *gp = new ContactTree::Group();
UserAddedEvent uev( ct, *gp );
contactlist_signal.emit( &uev );
delete gp;
return ct;
}
示例12: UpdateContactAuthState
void CSkypeProto::UpdateContactAuthState(MCONTACT hContact, const ContactRef &contact)
{
uint newTS = 0;
contact->GetPropAuthreqTimestamp(newTS);
DWORD oldTS = this->getDword("AuthTS", 0);
if (newTS > oldTS)
{
bool result;
if (contact->HasAuthorizedMe(result) && !result)
this->setByte(hContact, "Auth", !result);
else
{
this->delSetting(hContact, "Auth");
if (contact->IsMemberOfHardwiredGroup(CContactGroup::ALL_BUDDIES, result) && !result)
this->setByte(hContact, "Grant", !result);
else
this->delSetting(hContact, "Grant");
}
this->setDword(hContact, "AuthTS", newTS);
}
}
示例13: OnChange
void MyContactGroup::OnChange(const ContactRef& contact)
{
ContactGroup::TYPE groupType;
this->GetPropType(groupType);
if (groupType == ContactGroup::SKYPE_BUDDIES)
{
SEString contactName;
contact->GetPropDisplayname(contactName);
if (!contactList.contains(contact))
{
contactList.append(contact);
contact.fetch();
printf("%s was added.\n", (const char*)contactName);
}
else
{
contactList.remove_val(contact);
printf("%s was removed.\n", (const char*)contactName);
};
};
};
示例14: OnChange
//MYCONTACTGROUP
void MyContactGroup::OnChange(const ContactRef& contact){
ContactGroup::TYPE groupType;
if (!GetPropType(groupType)) throw SkypeException("Can't obtain group type.\n");
if (groupType == ContactGroup::SKYPE_BUDDIES)
{
SEString contactName;
if (!contact->GetPropDisplayname(contactName)) throw SkypeException("Can't obtain contact name.\n");
if (!contactList.contains(contact))
{
contactList.append(contact);
contact.fetch();
printf("[SKYPE]: %s was added.\n", (const char*)contactName);
}
else
{
contactList.remove_val(contact);
printf("[SKYPE]: %s was removed.\n", (const char*)contactName);
};
};
}
示例15: UpdateContactStatus
void CSkypeProto::UpdateContactStatus(MCONTACT hContact, const ContactRef &contact)
{
Contact::AVAILABILITY availability;
contact->GetPropAvailability(availability);
this->setWord(hContact, SKYPE_SETTINGS_STATUS, CSkypeProto::SkypeToMirandaStatus(availability));
if (availability == Contact::SKYPEOUT)
this->setWord(hContact, SKYPE_SETTINGS_STATUS, ID_STATUS_ONTHEPHONE);
else
{
if (availability == Contact::PENDINGAUTH)
this->setByte(hContact, "Auth", 1);
else
this->delSetting(hContact, "Auth");
}
}