From b35ee0b14ec252c54e122a563404c4b808edcf3b Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Tue, 30 Oct 2012 18:59:52 +0000 Subject: added page in userinfo with additional data git-svn-id: http://svn.miranda-ng.org/main/trunk@2116 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/res/Resource.rc | 30 ++ protocols/Skype/src/resource.h | 14 +- protocols/Skype/src/skype_contacts.cpp | 90 +++--- protocols/Skype/src/skype_dialogs.cpp | 70 +++++ protocols/Skype/src/skype_proto.cpp | 38 +-- protocols/Skype/src/skype_proto.h | 2 + protocols/Skype/src/skype_subclassing.cpp | 446 +++++++++++++++--------------- protocols/Skype/src/skype_subclassing.h | 114 ++++---- 8 files changed, 466 insertions(+), 338 deletions(-) diff --git a/protocols/Skype/res/Resource.rc b/protocols/Skype/res/Resource.rc index cadd7377e2..e9a9b81c2d 100644 --- a/protocols/Skype/res/Resource.rc +++ b/protocols/Skype/res/Resource.rc @@ -36,6 +36,22 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,84,66,50,14 END +IDD_INFO_SKYPE DIALOGEX 0, 0, 222, 132 +STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + LTEXT "Skype name:",IDC_STATIC,5,5,71,8 + EDITTEXT IDC_SID,74,5,143,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + LTEXT "Status text:",IDC_STATIC,5,18,71,8 + EDITTEXT IDC_STATUSTEXT,74,18,74,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + LTEXT "Online since:",IDC_STATIC,5,31,71,8 + EDITTEXT IDC_ONLINESINCE,74,31,139,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + LTEXT "Last event date:",IDC_STATIC,5,44,71,8 + EDITTEXT IDC_LASTEVENTDATE,74,44,141,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + LTEXT "Last profile change:",IDC_STATIC,5,57,71,8 + EDITTEXT IDC_LASTPROFILECHANGE,74,57,142,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER +END ///////////////////////////////////////////////////////////////////////////// // @@ -52,6 +68,20 @@ BEGIN TOPMARGIN, 7 BOTTOMMARGIN, 80 END + + IDD_INFO_SKYPE, DIALOG + BEGIN + LEFTMARGIN, 5 + RIGHTMARGIN, 217 + VERTGUIDE, 61 + TOPMARGIN, 5 + BOTTOMMARGIN, 129 + HORZGUIDE, 22 + HORZGUIDE, 35 + HORZGUIDE, 48 + HORZGUIDE, 61 + HORZGUIDE, 74 + END END #endif // APSTUDIO_INVOKED diff --git a/protocols/Skype/src/resource.h b/protocols/Skype/src/resource.h index d2f91471cd..c0d3786ec0 100644 --- a/protocols/Skype/src/resource.h +++ b/protocols/Skype/src/resource.h @@ -4,6 +4,7 @@ // #define IDD_SKYPEACCOUNT 9 #define IDD_OPTIONS 10 +#define IDD_INFO_SKYPE 11 #define IDI_ICON 101 #define IDR_RUNTIME 102 #define IDI_AUTH_GRANT 103 @@ -15,9 +16,14 @@ #define IDC_PW 1002 #define IDC_SL 1003 #define IDC_SAVEPASS 1004 -#define IDC_SAVEPASSWORD 1004 -#define IDC_PASSWORD 1018 -#define IDC_INSTRUCTION 1019 +#define IDC_SAVEPASSWORD 1005 +#define IDC_PASSWORD 1006 +#define IDC_INSTRUCTION 1007 +#define IDC_SID 1008 +#define IDC_STATUSTEXT 1009 +#define IDC_ONLINESINCE 1010 +#define IDC_LASTEVENTDATE 1011 +#define IDC_LASTPROFILECHANGE 1012 // Next default values for new objects // @@ -25,7 +31,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 108 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1004 +#define _APS_NEXT_CONTROL_VALUE 1013 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp index a83ee412da..e79855b6f1 100644 --- a/protocols/Skype/src/skype_contacts.cpp +++ b/protocols/Skype/src/skype_contacts.cpp @@ -317,6 +317,24 @@ void CSkypeProto::UpdateContactTimezone(HANDLE hContact, CContact::Ref contact) this->DeleteSetting(hContact, "TimeZone"); } +void CSkypeProto::UpdateContactOnlineSinceTime(HANDLE hContact, CContact::Ref contact) +{ + uint data; + contact->GetPropLastonlineTimestamp(data); + if (data > 0) + { + } +} + +void CSkypeProto::UpdateContactLastEventDate(HANDLE hContact, CContact::Ref contact) +{ + uint data; + contact->GetPropLastusedTimestamp(data); + if (data > 0) + { + } +} + void CSkypeProto::UpdateFullName(HANDLE hContact, CContact::Ref contact) { SEString data; @@ -361,6 +379,8 @@ void CSkypeProto::UpdateContactProfile(HANDLE hContact, CContact::Ref contact) this->UpdateContactOfficePhone(hContact, contact); this->UpdateContactState(hContact, contact); this->UpdateContactTimezone(hContact, contact); + this->UpdateContactOnlineSinceTime(hContact, contact); + this->UpdateContactLastEventDate(hContact, contact); this->UpdateFullName(hContact, contact); this->SetSettingDword(hContact, "ProfileTS", newTS); @@ -478,10 +498,10 @@ void CSkypeProto::OnContactListChanged(const ContactRef& contact) contact->IsMemberOfHardwiredGroup(CContactGroup::ALL_BUDDIES, result); if (result) { - if ( !this->contactList.contains(contact)) - { - CContact::Ref newContact(contact); - this->contactList.append(newContact); + if ( !this->contactList.contains(contact)) + { + CContact::Ref newContact(contact); + this->contactList.append(newContact); newContact.fetch(); newContact->SetOnContactChangedCallback( (CContact::OnContactChanged)&CSkypeProto::OnContactChanged, @@ -808,43 +828,43 @@ void __cdecl CSkypeProto::SearchBySidAsync(void* arg) return; } - CContactSearch::Ref search; - g_skype->CreateIdentitySearch(::mir_u2a(sid), search); - search.fetch(); - search->SetProtoInfo(this, (HANDLE)SKYPE_SEARCH_BYSID); - search->SetOnContactFindedCallback( - (CContactSearch::OnContactFinded)&CSkypeProto::OnContactFinded); - search->SetOnSearchCompleatedCallback( - (CContactSearch::OnSearchCompleted)&CSkypeProto::OnSearchCompleted); - - bool valid; - if (!search->IsValid(valid) || !valid || !search->Submit()) - { - return; - } - search->BlockWhileSearch(); - search->Release(); + CContactSearch::Ref search; + g_skype->CreateIdentitySearch(::mir_u2a(sid), search); + search.fetch(); + search->SetProtoInfo(this, (HANDLE)SKYPE_SEARCH_BYSID); + search->SetOnContactFindedCallback( + (CContactSearch::OnContactFinded)&CSkypeProto::OnContactFinded); + search->SetOnSearchCompleatedCallback( + (CContactSearch::OnSearchCompleted)&CSkypeProto::OnSearchCompleted); + + bool valid; + if (!search->IsValid(valid) || !valid || !search->Submit()) + { + return; + } + search->BlockWhileSearch(); + search->Release(); } void __cdecl CSkypeProto::SearchByEmailAsync(void* arg) { const wchar_t *email = (wchar_t *)arg; - CContactSearch::Ref search; - g_skype->CreateContactSearch(search); - search.fetch(); - search->SetProtoInfo(this, (HANDLE)SKYPE_SEARCH_BYEMAIL); - search->SetOnContactFindedCallback( - (CContactSearch::OnContactFinded)&CSkypeProto::OnContactFinded); - search->SetOnSearchCompleatedCallback( - (CContactSearch::OnSearchCompleted)&CSkypeProto::OnSearchCompleted); - - bool valid; - if (!search->AddEmailTerm(::mir_u2a(email), valid) || !valid || !search->Submit()) - { - return; - } - search->BlockWhileSearch(); + CContactSearch::Ref search; + g_skype->CreateContactSearch(search); + search.fetch(); + search->SetProtoInfo(this, (HANDLE)SKYPE_SEARCH_BYEMAIL); + search->SetOnContactFindedCallback( + (CContactSearch::OnContactFinded)&CSkypeProto::OnContactFinded); + search->SetOnSearchCompleatedCallback( + (CContactSearch::OnSearchCompleted)&CSkypeProto::OnSearchCompleted); + + bool valid; + if (!search->AddEmailTerm(::mir_u2a(email), valid) || !valid || !search->Submit()) + { + return; + } + search->BlockWhileSearch(); search->Release(); } diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp index 600007d25f..89b4214489 100644 --- a/protocols/Skype/src/skype_dialogs.cpp +++ b/protocols/Skype/src/skype_dialogs.cpp @@ -233,7 +233,77 @@ int __cdecl CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) return 0; } +static INT_PTR CALLBACK SkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + break; + + case WM_NOTIFY: + switch (((LPNMHDR)lParam)->idFrom) { + case 0: + switch (((LPNMHDR)lParam)->code) { + case PSN_PARAMCHANGED: + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (( PSHNOTIFY* )lParam )->lParam ); + break; + + case PSN_INFOCHANGED: + { + CSkypeProto* ppro = (CSkypeProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + if (!ppro) + break; + + char* szProto; + HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam; + + if (hContact == NULL) + szProto = ppro->m_szModuleName; + else + szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + + if (!szProto) + break; + + //SetDlgItemText(GetDlgItem(hwndDlg, IDC_SID), IDC_SID, ppro->GetSettingString(hContact, "sid")); + //SetDlgItemText(GetDlgItem(hwndDlg, IDC_STATUSTEXT), IDC_STATUSTEXT, ppro->GetSettingString(hContact, "XStatusMsg") ? ppro->GetSettingString(hContact, "XStatusMsg") : TranslateT("")); + //SetDlgItemText(GetDlgItem(hwndDlg, IDC_ONLINESINCE), IDC_ONLINESINCE, ppro->GetSettingDword(hContact, "OnlineSinceTS") ? ppro->GetSettingString(hContact, "OnlineSinceTS") : TranslateT("")); + //SetDlgItemText(GetDlgItem(hwndDlg, IDC_LASTEVENTDATE), IDC_LASTEVENTDATE, ppro->GetSettingDword(hContact, "LastEventDateTS") ? ppro->GetSettingString(hContact, "LastEventDateTS") : TranslateT("")); + //SetDlgItemText(GetDlgItem(hwndDlg, IDC_LASTPROFILECHANGE), IDC_LASTPROFILECHANGE, ppro->GetSettingDword(hContact, "ProfileTS") ? ppro->GetSettingDword(hContact, "ProfileTS") : TranslateT("")); + } + break; + } + break; + } + break; + + case WM_COMMAND: + switch(LOWORD(wParam)) { + case IDCANCEL: + SendMessage(GetParent(hwndDlg), msg, wParam, lParam); + break; + } + break; + } + + return FALSE; +} + int __cdecl CSkypeProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) { + if ((!this->IsProtoContact((HANDLE)lParam)) && lParam) + return 0; + + OPTIONSDIALOGPAGE odp = {0}; + odp.cbSize = sizeof(odp); + odp.flags = ODPF_TCHAR | ODPF_DONTTRANSLATE; + odp.hInstance = g_hInstance; + odp.dwInitParam = LPARAM(this); + odp.pfnDlgProc = SkypeDlgProc; + odp.position = -1900000000; + odp.ptszTitle = m_tszUserName; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_SKYPE); + UserInfo_AddPage(wParam, &odp); + return 0; } \ No newline at end of file diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index 7a46169cb0..9a5acff9dd 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -178,9 +178,9 @@ HANDLE __cdecl CSkypeProto::SearchBasic(const TCHAR* id) return 0; wchar_t *data = ::mir_tstrdup(id); - this->ForkThread(&CSkypeProto::SearchBySidAsync, data); - - return (HANDLE)SKYPE_SEARCH_BYSID; + this->ForkThread(&CSkypeProto::SearchBySidAsync, data); + + return (HANDLE)SKYPE_SEARCH_BYSID; } HANDLE __cdecl CSkypeProto::SearchByEmail(const TCHAR* email) @@ -189,8 +189,8 @@ HANDLE __cdecl CSkypeProto::SearchByEmail(const TCHAR* email) return 0; wchar_t *data = ::mir_tstrdup(email); - this->ForkThread(&CSkypeProto::SearchByEmailAsync, data); - + this->ForkThread(&CSkypeProto::SearchByEmailAsync, data); + return (HANDLE)SKYPE_SEARCH_BYEMAIL; } HANDLE __cdecl CSkypeProto::SearchByName(const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName) @@ -227,21 +227,21 @@ HANDLE __cdecl CSkypeProto::SendFile( HANDLE hContact, const TCHAR* szDescriptio int __cdecl CSkypeProto::SendMsg(HANDLE hContact, int flags, const char* msg) { int result = ::InterlockedIncrement((LONG volatile*)&dwCMDNum); - + CConversation::Ref conversation; g_skype->GetConversationByIdentity(::mir_u2a(this->GetSettingString(hContact, "sid")), conversation); - if (conversation) - { - Message::Ref message; - conversation->PostText(msg, message); - } - - this->SendBroadcastAsync( - hContact, - ACKTYPE_MESSAGE, - ACKRESULT_SUCCESS, - (HANDLE)result, - 0); + if (conversation) + { + Message::Ref message; + conversation->PostText(msg, message); + } + + this->SendBroadcastAsync( + hContact, + ACKTYPE_MESSAGE, + ACKRESULT_SUCCESS, + (HANDLE)result, + 0); return result; } @@ -308,7 +308,7 @@ int __cdecl CSkypeProto::UserIsTyping( HANDLE hContact, int type ) { CConversation::Ref conversation; g_skype->GetConversationByIdentity(::mir_u2a(this->GetSettingString(hContact, "sid")), conversation); - if (conversation) + if (conversation) { switch (type) { diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index e4514f1668..124a8300b1 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -152,6 +152,8 @@ protected: void UpdateContactStatusMessage(HANDLE hContact, CContact::Ref contact); void UpdateContactTimezone(HANDLE hContact, CContact::Ref contact); void UpdateContactProfile(HANDLE hContact, CContact::Ref contact); + void UpdateContactOnlineSinceTime(HANDLE hContact, CContact::Ref contact); + void UpdateContactLastEventDate(HANDLE hContact, CContact::Ref contact); void UpdateFullName(HANDLE hContact, CContact::Ref contact); void OnSearchCompleted(HANDLE hSearch); diff --git a/protocols/Skype/src/skype_subclassing.cpp b/protocols/Skype/src/skype_subclassing.cpp index 3dbf36d12b..0058f0a5a5 100644 --- a/protocols/Skype/src/skype_subclassing.cpp +++ b/protocols/Skype/src/skype_subclassing.cpp @@ -1,38 +1,38 @@ -#include "skype_subclassing.h" - -// CSkype - -CSkype::CSkype(int num_threads) : Skype(num_threads) -{ - this->proto = NULL; - this->callback == NULL; -} - -CAccount* CSkype::newAccount(int oid) -{ - return new CAccount(oid, this); -} - -CContactGroup* CSkype::newContactGroup(int oid) -{ - return new CContactGroup(oid, this); -} - -CContact* CSkype::newContact(int oid) -{ - return new CContact(oid, this); -} - -CConversation* CSkype::newConversation(int oid) -{ - return new CConversation(oid, this); -} - -CContactSearch* CSkype::newContactSearch(int oid) -{ - return new CContactSearch(oid, this); -} - +#include "skype_subclassing.h" + +// CSkype + +CSkype::CSkype(int num_threads) : Skype(num_threads) +{ + this->proto = NULL; + this->callback == NULL; +} + +CAccount* CSkype::newAccount(int oid) +{ + return new CAccount(oid, this); +} + +CContactGroup* CSkype::newContactGroup(int oid) +{ + return new CContactGroup(oid, this); +} + +CContact* CSkype::newContact(int oid) +{ + return new CContact(oid, this); +} + +CConversation* CSkype::newConversation(int oid) +{ + return new CConversation(oid, this); +} + +CContactSearch* CSkype::newContactSearch(int oid) +{ + return new CContactSearch(oid, this); +} + void CSkype::OnConversationListChange( const ConversationRef &conversation, const Conversation::LIST_TYPE &type, @@ -45,193 +45,193 @@ void CSkype::OnConversationListChange( if (this->proto) (proto->*callback)(conversation->ref()); } -} - -void CSkype::SetOnConversationAddedCallback(OnConversationAdded callback, CSkypeProto* proto) -{ - this->proto = proto; - this->callback = callback; -} - -// CAccount - -CAccount::CAccount(unsigned int oid, SERootObject* root) : Account(oid, root) -{ - this->isLoggedIn = false; - this->isLoggedOut = false; - - this->proto = NULL; - this->callback == NULL; -} - -void CAccount::SetOnAccountChangedCallback(OnAccountChanged callback, CSkypeProto* proto) -{ - this->proto = proto; - this->callback = callback; -} - -void CAccount::OnChange(int prop) -{ - if (prop == CAccount::P_STATUS) - { - CAccount::STATUS loginStatus; - this->GetPropStatus(loginStatus); - if (loginStatus == CAccount::LOGGED_IN) - this->isLoggedIn = true; - - if (loginStatus == CAccount::LOGGED_OUT) - { - CAccount::LOGOUTREASON whyLogout; - this->GetPropLogoutreason(whyLogout); - this->logoutReason = whyLogout; - if (whyLogout != Account::LOGOUT_CALLED) - { - // todo: rewrite!! - strcpy(this->logoutReasonString, (const char*)tostring(whyLogout)); - } - this->isLoggedIn = false; - this->isLoggedOut = true; +} + +void CSkype::SetOnConversationAddedCallback(OnConversationAdded callback, CSkypeProto* proto) +{ + this->proto = proto; + this->callback = callback; +} + +// CAccount + +CAccount::CAccount(unsigned int oid, SERootObject* root) : Account(oid, root) +{ + this->isLoggedIn = false; + this->isLoggedOut = false; + + this->proto = NULL; + this->callback == NULL; +} + +void CAccount::SetOnAccountChangedCallback(OnAccountChanged callback, CSkypeProto* proto) +{ + this->proto = proto; + this->callback = callback; +} + +void CAccount::OnChange(int prop) +{ + if (prop == CAccount::P_STATUS) + { + CAccount::STATUS loginStatus; + this->GetPropStatus(loginStatus); + if (loginStatus == CAccount::LOGGED_IN) + this->isLoggedIn = true; + + if (loginStatus == CAccount::LOGGED_OUT) + { + CAccount::LOGOUTREASON whyLogout; + this->GetPropLogoutreason(whyLogout); + this->logoutReason = whyLogout; + if (whyLogout != Account::LOGOUT_CALLED) + { + // todo: rewrite!! + strcpy(this->logoutReasonString, (const char*)tostring(whyLogout)); + } + this->isLoggedIn = false; + this->isLoggedOut = true; + } + } + else + { + if (this->proto) + (proto->*callback)(prop); + } +} + +void CAccount::BlockWhileLoggingIn() +{ + this->isLoggedIn = false; + this->isLoggedOut = false; + while (!this->isLoggedIn && !this->isLoggedOut) + Sleep(1); +} + +void CAccount::BlockWhileLoggingOut() +{ + this->isLoggedOut = false; + while ( !this->isLoggedOut) + Sleep(1); +} + +bool CAccount::IsOnline() +{ + return this->isLoggedIn; + //(CAccount::STATUS)this->GetUintProp(CAccount::P_STATUS) == Account::LOGGED_IN; +} + +// CContactGroup + +CContactGroup::CContactGroup(unsigned int oid, SERootObject* root) : ContactGroup(oid, root) +{ + this->proto = NULL; + this->callback == NULL; +} + +void CContactGroup::SetOnContactListChangedCallback(OnContactListChanged callback, CSkypeProto* proto) +{ + this->proto = proto; + this->callback = callback; +} + +//bool CContactGroup::Contains(const ContactRef& contact) +//{ +// return this->ContactList.contains(contact); +//} + +void CContactGroup::OnChange(const ContactRef& contact) +{ + if (this->proto) + (proto->*callback)(contact); +} + +// CContactSearch + +CContactSearch::CContactSearch(unsigned int oid, SERootObject* root) : ContactSearch(oid, root) +{ + this->proto = NULL; + this->SearchCompletedCallback == NULL; + this->ContactFindedCallback == NULL; +} + +void CContactSearch::OnChange(int prop) +{ + if (prop == P_CONTACT_SEARCH_STATUS) + { + CContactSearch::STATUS status; + this->GetPropContactSearchStatus(status); + if (status == FINISHED || status == FAILED) + { + this->isSeachFinished = true; + if (this->proto) + (proto->*SearchCompletedCallback)(this->hSearch); } - } - else - { - if (this->proto) - (proto->*callback)(prop); - } -} - -void CAccount::BlockWhileLoggingIn() -{ - this->isLoggedIn = false; - this->isLoggedOut = false; - while (!this->isLoggedIn && !this->isLoggedOut) - Sleep(1); -} - -void CAccount::BlockWhileLoggingOut() -{ - this->isLoggedOut = false; - while ( !this->isLoggedOut) - Sleep(1); -} - -bool CAccount::IsOnline() -{ - return this->isLoggedIn; - //(CAccount::STATUS)this->GetUintProp(CAccount::P_STATUS) == Account::LOGGED_IN; -} - -// CContactGroup - -CContactGroup::CContactGroup(unsigned int oid, SERootObject* root) : ContactGroup(oid, root) -{ - this->proto = NULL; - this->callback == NULL; -} - -void CContactGroup::SetOnContactListChangedCallback(OnContactListChanged callback, CSkypeProto* proto) -{ - this->proto = proto; - this->callback = callback; -} - -//bool CContactGroup::Contains(const ContactRef& contact) -//{ -// return this->ContactList.contains(contact); -//} - -void CContactGroup::OnChange(const ContactRef& contact) -{ - if (this->proto) - (proto->*callback)(contact); -} - -// CContactSearch - -CContactSearch::CContactSearch(unsigned int oid, SERootObject* root) : ContactSearch(oid, root) -{ - this->proto = NULL; - this->SearchCompletedCallback == NULL; - this->ContactFindedCallback == NULL; -} - -void CContactSearch::OnChange(int prop) -{ - if (prop == P_CONTACT_SEARCH_STATUS) - { - CContactSearch::STATUS status; - this->GetPropContactSearchStatus(status); - if (status == FINISHED || status == FAILED) - { - this->isSeachFinished = true; - if (this->proto) - (proto->*SearchCompletedCallback)(this->hSearch); - } - } - - //SEString value = GetProp(prop); - //List_String dbg = getPropDebug(prop, value); - //fprintf(stdout,"CONTACTSEARCH.%d:%s = %s\n", getOID(), (const char*)dbg[1], (const char*)dbg[2]); -} - -void CContactSearch::OnNewResult(const ContactRef& contact, const uint& rankValue) -{ - if (this->proto) - (proto->*ContactFindedCallback)(this->hSearch, contact->ref()); -} - -void CContactSearch::BlockWhileSearch() -{ - this->isSeachFinished = false; - this->isSeachFailed = false; - while (!this->isSeachFinished && !this->isSeachFailed) - Sleep(1); -} - -void CContactSearch::SetProtoInfo(CSkypeProto* proto, HANDLE hSearch) -{ - this->proto = proto; - this->hSearch = hSearch; -} - -void CContactSearch::SetOnSearchCompleatedCallback(OnSearchCompleted callback) -{ - this->SearchCompletedCallback = callback; -} - -void CContactSearch::SetOnContactFindedCallback(OnContactFinded callback) -{ - this->ContactFindedCallback = callback; -} - -// CContact - -CContact::CContact(unsigned int oid, SERootObject* root) : Contact(oid, root) -{ - this->proto = NULL; - this->callback == NULL; -} - -void CContact::SetOnContactChangedCallback(OnContactChanged callback, CSkypeProto* proto) -{ - this->proto = proto; - this->callback = callback; -} - -void CContact::OnChange(int prop) -{ - if (this->proto) - (proto->*callback)(this->ref(), prop); -} - -// Conversation - -CConversation::CConversation(unsigned int oid, SERootObject* root) : Conversation(oid, root) -{ - this->proto = NULL; - this->callback == NULL; -} - + } + + //SEString value = GetProp(prop); + //List_String dbg = getPropDebug(prop, value); + //fprintf(stdout,"CONTACTSEARCH.%d:%s = %s\n", getOID(), (const char*)dbg[1], (const char*)dbg[2]); +} + +void CContactSearch::OnNewResult(const ContactRef& contact, const uint& rankValue) +{ + if (this->proto) + (proto->*ContactFindedCallback)(this->hSearch, contact->ref()); +} + +void CContactSearch::BlockWhileSearch() +{ + this->isSeachFinished = false; + this->isSeachFailed = false; + while (!this->isSeachFinished && !this->isSeachFailed) + Sleep(1); +} + +void CContactSearch::SetProtoInfo(CSkypeProto* proto, HANDLE hSearch) +{ + this->proto = proto; + this->hSearch = hSearch; +} + +void CContactSearch::SetOnSearchCompleatedCallback(OnSearchCompleted callback) +{ + this->SearchCompletedCallback = callback; +} + +void CContactSearch::SetOnContactFindedCallback(OnContactFinded callback) +{ + this->ContactFindedCallback = callback; +} + +// CContact + +CContact::CContact(unsigned int oid, SERootObject* root) : Contact(oid, root) +{ + this->proto = NULL; + this->callback == NULL; +} + +void CContact::SetOnContactChangedCallback(OnContactChanged callback, CSkypeProto* proto) +{ + this->proto = proto; + this->callback = callback; +} + +void CContact::OnChange(int prop) +{ + if (this->proto) + (proto->*callback)(this->ref(), prop); +} + +// Conversation + +CConversation::CConversation(unsigned int oid, SERootObject* root) : Conversation(oid, root) +{ + this->proto = NULL; + this->callback == NULL; +} + void CConversation::OnMessage(const MessageRef & message) { Message::TYPE messageType; @@ -250,7 +250,7 @@ void CConversation::OnMessage(const MessageRef & message) //if (propValues[0] != myAccountName) { - if (this->proto) + if (this->proto) (proto->*callback)((const char*)propValues[0], (const char*)propValues[1]); } } @@ -258,6 +258,6 @@ void CConversation::OnMessage(const MessageRef & message) void CConversation::SetOnMessageReceivedCallback(OnMessageReceived callback, CSkypeProto* proto) { - this->proto = proto; + this->proto = proto; this->callback = callback; } \ No newline at end of file diff --git a/protocols/Skype/src/skype_subclassing.h b/protocols/Skype/src/skype_subclassing.h index 17b8f1f1c2..16ea04f276 100644 --- a/protocols/Skype/src/skype_subclassing.h +++ b/protocols/Skype/src/skype_subclassing.h @@ -19,13 +19,13 @@ public: void SetOnMessageReceivedCallback(OnMessageReceived callback, CSkypeProto* proto); -private: +private: CSkypeProto* proto; OnMessageReceived callback; void OnMessage(const MessageRef & message); }; -class CContact : public Contact +class CContact : public Contact { public: typedef void (CSkypeProto::* OnContactChanged)(CContact::Ref contact, int); @@ -33,44 +33,44 @@ public: typedef DRef Ref; typedef DRefs Refs; - CContact(unsigned int oid, SERootObject* root); - - void SetOnContactChangedCallback(OnContactChanged callback, CSkypeProto* proto); - -private: + CContact(unsigned int oid, SERootObject* root); + + void SetOnContactChangedCallback(OnContactChanged callback, CSkypeProto* proto); + +private: CSkypeProto* proto; - OnContactChanged callback; - - void OnChange(int prop); + OnContactChanged callback; + + void OnChange(int prop); }; -class CContactSearch : public ContactSearch -{ -public: - typedef void (CSkypeProto::* OnSearchCompleted)(HANDLE hSearch); - typedef void (CSkypeProto::* OnContactFinded)(HANDLE hSearch, CContact::Ref contact); - - typedef DRef Ref; - typedef DRefs Refs; - - bool isSeachFinished; - bool isSeachFailed; - - CContactSearch(unsigned int oid, SERootObject* root); - - void OnChange(int prop); - void OnNewResult(const ContactRef& contact, const uint& rankValue); - - void SetProtoInfo(CSkypeProto* proto, HANDLE hSearch); - void SetOnSearchCompleatedCallback(OnSearchCompleted callback); - void SetOnContactFindedCallback(OnContactFinded callback); - - void BlockWhileSearch(); +class CContactSearch : public ContactSearch +{ +public: + typedef void (CSkypeProto::* OnSearchCompleted)(HANDLE hSearch); + typedef void (CSkypeProto::* OnContactFinded)(HANDLE hSearch, CContact::Ref contact); + + typedef DRef Ref; + typedef DRefs Refs; + + bool isSeachFinished; + bool isSeachFailed; + + CContactSearch(unsigned int oid, SERootObject* root); + + void OnChange(int prop); + void OnNewResult(const ContactRef& contact, const uint& rankValue); + + void SetProtoInfo(CSkypeProto* proto, HANDLE hSearch); + void SetOnSearchCompleatedCallback(OnSearchCompleted callback); + void SetOnContactFindedCallback(OnContactFinded callback); + + void BlockWhileSearch(); private: HANDLE hSearch; CSkypeProto* proto; - OnSearchCompleted SearchCompletedCallback; - OnContactFinded ContactFindedCallback; + OnSearchCompleted SearchCompletedCallback; + OnContactFinded ContactFindedCallback; }; class CContactGroup : public ContactGroup @@ -92,36 +92,36 @@ private: OnContactListChanged callback; void OnChange(const ContactRef& contact); -}; - +}; + class CAccount : public Account { -public: - typedef void (CSkypeProto::* OnAccountChanged)(int); - - typedef DRef Ref; - typedef DRefs Refs; - - bool isLoggedIn; - bool isLoggedOut; - LOGOUTREASON logoutReason; - char logoutReasonString[2048]; - - CAccount(unsigned int oid, SERootObject* root); - - void BlockWhileLoggingIn(); - void BlockWhileLoggingOut(); +public: + typedef void (CSkypeProto::* OnAccountChanged)(int); + + typedef DRef Ref; + typedef DRefs Refs; + + bool isLoggedIn; + bool isLoggedOut; + LOGOUTREASON logoutReason; + char logoutReasonString[2048]; + + CAccount(unsigned int oid, SERootObject* root); + + void BlockWhileLoggingIn(); + void BlockWhileLoggingOut(); bool IsOnline(); - void SetOnAccountChangedCallback(OnAccountChanged callback, CSkypeProto* proto); - -private: + void SetOnAccountChangedCallback(OnAccountChanged callback, CSkypeProto* proto); + +private: CSkypeProto* proto; OnAccountChanged callback; - void OnChange(int prop); -}; - + void OnChange(int prop); +}; + class CSkype : public Skype { public: -- cgit v1.2.3