diff options
-rw-r--r-- | protocols/Skype/src/skype_avatars.cpp | 10 | ||||
-rw-r--r-- | protocols/Skype/src/skype_chat.cpp | 302 | ||||
-rw-r--r-- | protocols/Skype/src/skype_chat.h | 21 | ||||
-rw-r--r-- | protocols/Skype/src/skype_contacts.cpp | 79 | ||||
-rw-r--r-- | protocols/Skype/src/skype_dialogs.cpp | 2 | ||||
-rw-r--r-- | protocols/Skype/src/skype_events.cpp | 58 | ||||
-rw-r--r-- | protocols/Skype/src/skype_hooks.cpp | 3 | ||||
-rw-r--r-- | protocols/Skype/src/skype_ignore_list.cpp | 20 | ||||
-rw-r--r-- | protocols/Skype/src/skype_messages.cpp | 10 | ||||
-rw-r--r-- | protocols/Skype/src/skype_own_info.cpp | 40 | ||||
-rw-r--r-- | protocols/Skype/src/skype_profile.cpp | 62 | ||||
-rw-r--r-- | protocols/Skype/src/skype_proto.cpp | 2 | ||||
-rw-r--r-- | protocols/Skype/src/skype_proto.h | 67 | ||||
-rw-r--r-- | protocols/Skype/src/skype_services.cpp | 2 | ||||
-rw-r--r-- | protocols/Skype/src/skype_utils.cpp | 69 | ||||
-rw-r--r-- | protocols/Skype/src/skypekit/contact.cpp | 11 |
16 files changed, 397 insertions, 361 deletions
diff --git a/protocols/Skype/src/skype_avatars.cpp b/protocols/Skype/src/skype_avatars.cpp index 867b20f537..bf9fae9136 100644 --- a/protocols/Skype/src/skype_avatars.cpp +++ b/protocols/Skype/src/skype_avatars.cpp @@ -62,7 +62,7 @@ wchar_t * CSkypeProto::GetContactAvatarFilePath(HANDLE hContact) if (m_hAvatarsFolder == NULL || FoldersGetCustomPathT(m_hAvatarsFolder, path, MAX_PATH, _T("")))
{
- mir_ptr<wchar_t> tmpPath( ::Utils_ReplaceVarsT(L"%miranda_avatarcache%"));
+ ptrW tmpPath( ::Utils_ReplaceVarsT(L"%miranda_avatarcache%"));
::mir_sntprintf(path, MAX_PATH, _T("%s\\%S"), tmpPath, this->m_szModuleName);
}
@@ -70,7 +70,7 @@ wchar_t * CSkypeProto::GetContactAvatarFilePath(HANDLE hContact) if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)path);
- mir_ptr<wchar_t> sid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
+ ptrW sid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
if (hContact != NULL)
::mir_sntprintf(path, MAX_PATH, _T("%s\\%s.jpg"), path, sid);
else if (sid != NULL)
@@ -93,10 +93,10 @@ INT_PTR __cdecl CSkypeProto::GetAvatarInfo(WPARAM, LPARAM lParam) return GAIR_NOAVATAR;
}
- mir_ptr<wchar_t> sid = ::db_get_wsa(pai->hContact, this->m_szModuleName, SKYPE_SETTINGS_SID);
+ ptrW sid = ::db_get_wsa(pai->hContact, this->m_szModuleName, SKYPE_SETTINGS_SID);
if (sid)
{
- mir_ptr<wchar_t> path( this->GetContactAvatarFilePath(pai->hContact));
+ ptrW path( this->GetContactAvatarFilePath(pai->hContact));
if (path && !_waccess(path, 0))
{
::wcsncpy(pai->filename, path, SIZEOF(pai->filename));
@@ -171,7 +171,7 @@ INT_PTR __cdecl CSkypeProto::SetMyAvatar(WPARAM, LPARAM lParam) wchar_t *path = (wchar_t *)lParam;
if (path)
{
- mir_ptr<wchar_t> avatarPath( this->GetContactAvatarFilePath(NULL));
+ ptrW avatarPath( this->GetContactAvatarFilePath(NULL));
if ( !::wcscmp(path, avatarPath))
{
this->Log(L"New avatar path are same with old.");
diff --git a/protocols/Skype/src/skype_chat.cpp b/protocols/Skype/src/skype_chat.cpp index 14d22d1955..8339ad386e 100644 --- a/protocols/Skype/src/skype_chat.cpp +++ b/protocols/Skype/src/skype_chat.cpp @@ -79,7 +79,7 @@ static void ResetChatMenuItem() }
}
-void CSkypeProto::InitChat()
+void CSkypeProto::InitChatModule()
{
GCREGISTER gcr = {0};
gcr.cbSize = sizeof(gcr);
@@ -187,7 +187,51 @@ void ChatRoom::CreateChatSession(bool showWindow) this->ppro->Log(L"Created new chat session %s", this->cid);
}
-void ChatRoom::Create(const StringList &invitedMembers, CSkypeProto *ppro, const ChatRoomParam *param)
+void ChatRoom::SetTopic(const wchar_t *topic)
+{
+ if (this->conversation)
+ this->conversation->SetTopic((char *)ptrA(::mir_utf8encodeW(topic)));
+}
+
+wchar_t *ChatRoom::GetUri()
+{
+ SEString data;
+ this->conversation->GetJoinBlob(data);
+ ptrW blob = ::mir_utf8decodeW(data);
+
+ wchar_t *uri = (wchar_t *)::mir_alloc(sizeof(wchar_t) * MAX_PATH);
+ ::mir_sntprintf(uri, SIZEOF(uri), L"skype:?chat&blob=%s", blob);
+
+ return uri;
+}
+
+void ChatRoom::ShowWindow()
+{
+ GCDEST gcd = { this->ppro->m_szModuleName, { NULL }, GC_EVENT_CONTROL };
+ gcd.ptszID = this->cid;
+
+ GCEVENT gce = {0};
+ gce.cbSize = sizeof(GCEVENT);
+ gce.dwFlags = GC_TCHAR;
+ gce.pDest = &gcd;
+
+ // show window
+ gcd.iType = GC_EVENT_CONTROL;
+ ::CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gce);
+}
+
+void ChatRoom::Invite(const StringList &contacts)
+{
+ SEStringList needToAdd;
+ for (size_t i = 0; i < contacts.size(); i++)
+ {
+ if ( !contacts.contains(contacts[i]))
+ needToAdd.append((char *)_T2A(contacts[i]));
+ }
+ this->conversation->AddConsumers(needToAdd);
+}
+
+void ChatRoom::Create(const ChatRoomParam *param, CSkypeProto *ppro)
{
SEString data;
ChatRoom *room = NULL;
@@ -210,9 +254,9 @@ void ChatRoom::Create(const StringList &invitedMembers, CSkypeProto *ppro, const }
SEStringList consumers;
- for (size_t i = 0; i < invitedMembers.size(); i++)
+ for (size_t i = 0; i < param->invitedContacts.size(); i++)
{
- data = ::mir_utf8encodeW(invitedMembers[i]);
+ data = ::mir_utf8encodeW(param->invitedContacts[i]);
consumers.append(data);
}
conversation->AddConsumers(consumers);
@@ -280,13 +324,61 @@ void ChatRoom::Start(const ConversationRef &conversation, bool showWindow) }
}
+void ChatRoom::Join(const wchar_t *joinBlob, CSkypeProto *ppro)
+{
+ SEString data;
+ ConversationRef conversation;
+ if (ppro->GetConversationByBlob(data, conversation))
+ {
+ conversation->GetPropIdentity(data);
+ ptrW cid(::mir_utf8decodeW(data));
+
+ conversation->GetPropDisplayname(data);
+ ptrW name(::mir_utf8decodeW(data));
+
+ CSkypeProto::ReplaceSpecialChars(cid);
+ ChatRoom *room = new ChatRoom(cid, name, ppro);
+ room->Start(conversation, true);
+ }
+}
+
+void ChatRoom::SendMessage(const wchar_t *text)
+{
+ this->ppro->Log(L"Sending chat message %s", this->cid);
+
+ CMessage::Ref message;
+ if (this->conversation->PostText((char *)ptrA(::mir_utf8encodeW(text)), message))
+ this->ppro->Log(L"Chat message sended %s", this->cid);
+}
+
void ChatRoom::LeaveChat()
{
+ this->ppro->Log(L"Leaving chat session %s", this->cid);
+
+ if (this->conversation->RetireFrom())
+ this->ppro->Log(L"Retired from conversation %s", this->cid);
+
+ GCDEST gcd = { ppro->m_szModuleName, { NULL }, GC_EVENT_CONTROL };
+ gcd.ptszID = this->cid;
+
+ GCEVENT gce = {0};
+ gce.cbSize = sizeof(GCEVENT);
+ gce.dwFlags = GC_TCHAR;
+ gce.pDest = &gcd;
+ ::CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
+ ::CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
+}
+
+void ChatRoom::LeaveChatAndDelete()
+{
this->ppro->Log(L"Leavind chat session %s", this->cid);
if (this->conversation->RetireFrom())
this->ppro->Log(L"Retired from conversation %s", this->cid);
+ if (this->conversation->Delete())
+ this->ppro->Log(L"Delete conversation %s", this->cid);
+
GCDEST gcd = { ppro->m_szModuleName, { NULL }, GC_EVENT_CONTROL };
gcd.ptszID = this->cid;
@@ -481,6 +573,13 @@ void ChatRoom::UpdateMember(const ChatMember &item, DWORD timestamp) }
}
+void ChatRoom::AddApplicant(const ChatMember *member)
+{
+ SEStringList consumers;
+ consumers.append((char *)ptrA(::mir_utf8encodeW(member->GetSid())));
+ this->conversation->AddConsumers(consumers);
+}
+
void ChatRoom::KickMember(const ChatMember &item, const ChatMember *author, DWORD timestamp)
{
if ( !this->IsMe(item))
@@ -875,7 +974,7 @@ void ChatRoom::OnChange(const ConversationRef &conversation, int prop) GCEF_ADDTOLOG,
0,
NULL,
- ::TranslateT("Incoming group call received"));
+ ::TranslateT("Incoming group call started"));
}
}
break;
@@ -1018,16 +1117,12 @@ INT_PTR CALLBACK CSkypeProto::ChatRoomProc(HWND hwndDlg, UINT msg, WPARAM wParam {
case CLN_NEWCONTACT:
if (param && (nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0)
- {
param->ppro->ChatValidateContact(nmc->hItem, nmc->hdr.hwndFrom, param->invitedContacts);
- }
break;
case CLN_LISTREBUILT:
if (param)
- {
param->ppro->ChatPrepare(NULL, nmc->hdr.hwndFrom, param->invitedContacts);
- }
break;
}
}
@@ -1035,7 +1130,8 @@ INT_PTR CALLBACK CSkypeProto::ChatRoomProc(HWND hwndDlg, UINT msg, WPARAM wParam break;
case WM_COMMAND:
- switch (LOWORD(wParam)) {
+ switch (LOWORD(wParam))
+ {
case IDC_ADDSCR:
if (param->ppro->IsOnline())
{
@@ -1047,12 +1143,7 @@ INT_PTR CALLBACK CSkypeProto::ChatRoomProc(HWND hwndDlg, UINT msg, WPARAM wParam cii.flags = CLCIIF_CHECKBOX | CLCIIF_BELOWCONTACTS;
cii.pszText = ::wcslwr(sid);
- HANDLE hItem = (HANDLE)::SendDlgItemMessage(
- hwndDlg,
- IDC_CCLIST,
- CLM_ADDINFOITEM,
- 0,
- (LPARAM)&cii);
+ HANDLE hItem = (HANDLE)::SendDlgItemMessage(hwndDlg, IDC_CCLIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
::SendDlgItemMessage(hwndDlg, IDC_CCLIST, CLM_SETCHECKMARK, (LPARAM)hItem, 1);
}
break;
@@ -1123,46 +1214,19 @@ bool CSkypeProto::IsChatRoom(HANDLE hContact) return ::db_get_b(hContact, this->m_szModuleName, "ChatRoom", 0) == 1;
}
-HANDLE CSkypeProto::GetChatRoomByCid(const wchar_t *cid)
-{
- HANDLE hContact = NULL;
-
- ::EnterCriticalSection(&this->contact_search_lock);
-
- for (hContact = ::db_find_first(this->m_szModuleName); hContact; hContact = ::db_find_next(hContact, this->m_szModuleName))
- {
- if (this->IsChatRoom(hContact))
- {
- ptrW chatSid( ::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID"));
- if (::lstrcmpi(chatSid, cid) == 0)
- break;
- }
- }
-
- ::LeaveCriticalSection(&this->contact_search_lock);
-
- return hContact;
-}
-
-void CSkypeProto::StartChat(StringList &invitedContacts)
+INT_PTR CSkypeProto::CreateChatRoomCommand(WPARAM, LPARAM)
{
- ChatRoomParam *param = new ChatRoomParam(NULL, invitedContacts, this);
+ ChatRoomParam *param = new ChatRoomParam(NULL, NULL, this);
if (::DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHATROOM_CREATE), NULL, CSkypeProto::ChatRoomProc, (LPARAM)param) == IDOK && param->invitedContacts.size() > 0)
- ChatRoom::Create(param->invitedContacts, this, param);
+ ChatRoom::Create(param, this);
delete param;
-}
-
-INT_PTR CSkypeProto::CreateChatRoomCommand(WPARAM, LPARAM)
-{
- StringList empty;
- this->StartChat(empty);
return 0;
}
-void CSkypeProto::InviteToChatRoom(HANDLE hContact)
+void CSkypeProto::ChatRoomInvite(HANDLE hContact)
{
GC_INFO gci = {0};
gci.Flags = BYID | USERS | DATA;
@@ -1177,15 +1241,8 @@ void CSkypeProto::InviteToChatRoom(HANDLE hContact) ChatRoomParam *param = new ChatRoomParam(NULL, invitedContacts, this);
if (::DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, CSkypeProto::ChatRoomProc, (LPARAM)param) == IDOK && param->invitedContacts.size() > 0)
- {
- SEStringList needToAdd;
- for (size_t i = 0; i < param->invitedContacts.size(); i++)
- {
- if (!invitedContacts.contains(param->invitedContacts[i]))
- needToAdd.append((char *)_T2A(param->invitedContacts[i]));
- }
- room->conversation->AddConsumers(needToAdd);
- }
+ room->Invite(param->invitedContacts);
+
delete param;
}
}
@@ -1211,8 +1268,9 @@ void CSkypeProto::CloseAllChatSessions() gce.cbSize = sizeof(GCEVENT);
gce.dwFlags = GC_TCHAR;
gce.pDest = &gcd;
- CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
+
+ ::CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
+ ::CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
}
}
}
@@ -1230,30 +1288,6 @@ ChatRoom *CSkypeProto::FindChatRoom(const wchar_t *cid) return NULL;
}
-void CSkypeProto::DeleteChatRoom(HANDLE hContact)
-{
- ptrW cid(::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID"));
- ChatRoom *room = this->FindChatRoom(cid);
- if (room != NULL && room->conversation)
- {
- room->LeaveChat();
- room->conversation->Delete();
- }
- else
- {
- cid = ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID);
- if (cid != NULL)
- {
- ConversationRef conversation;
- if (this->GetConversationByIdentity((char *)_T2A(cid), conversation) && conversation)
- {
- conversation->RetireFrom();
- conversation->Delete();
- }
- }
- }
-}
-
int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam)
{
GCHOOK *gch = (GCHOOK *)lParam;
@@ -1270,11 +1304,7 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam) {
case GC_USER_MESSAGE:
if (gch->ptszText && gch->ptszText[0])
- {
- CMessage::Ref message;
- ptrA text(::mir_utf8encodeW(gch->ptszText));
- room->conversation->PostText((char *)text, message);
- }
+ room->SendMessage(gch->ptszText);
break;
/*case GC_USER_CHANMGR:
@@ -1330,11 +1360,7 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam) {
ChatMember *member = room->FindChatMember(gch->ptszUID);
if (member != NULL)
- {
- SEStringList consumers;
- consumers.append((char *)ptrA(::mir_utf8encodeW(gch->ptszUID)));
- room->conversation->AddConsumers(consumers);
- }
+ room->AddApplicant(member);
}
break;
@@ -1373,15 +1399,8 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam) ChatRoomParam *param = new ChatRoomParam(NULL, invitedContacts, this);
if (::DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, CSkypeProto::ChatRoomProc, (LPARAM)param) == IDOK && param->invitedContacts.size() > 0)
- {
- SEStringList needToAdd;
- for (size_t i = 0; i < param->invitedContacts.size(); i++)
- {
- if (!invitedContacts.contains(param->invitedContacts[i]))
- needToAdd.append((char *)_T2A(param->invitedContacts[i]));
- }
- room->conversation->AddConsumers(needToAdd);
- }
+ room->Invite(param->invitedContacts);
+
delete param;
}
}
@@ -1417,16 +1436,7 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam) break;
case CHAT_LIST_MENU::ICM_COPY_URI:
- {
- SEString data;
- room->conversation->GetJoinBlob(data);
- ptrW blob = ::mir_utf8decodeW(data);
-
- wchar_t uri[MAX_PATH];
- ::mir_sntprintf(uri, SIZEOF(uri), L"skype:?chat&blob=%s", blob);
-
- CSkypeProto::CopyToClipboard(uri);
- }
+ CSkypeProto::CopyToClipboard(ptrW(room->GetUri()));
break;
}
break;
@@ -1510,7 +1520,7 @@ int __cdecl CSkypeProto::OnGCMenuHook(WPARAM, LPARAM lParam) return 0;
}
-void CSkypeProto::UpdateChatUserStatus(CContact::Ref contact)
+void CSkypeProto::UpdateChatUserStatus(const ContactRef &contact)
{
CContact::AVAILABILITY availability;
contact->GetPropAvailability(availability);
@@ -1539,7 +1549,7 @@ void CSkypeProto::UpdateChatUserStatus(CContact::Ref contact) }
}
-void CSkypeProto:: UpdateChatUserNick(CContact::Ref contact)
+void CSkypeProto::UpdateChatUserNick(const ContactRef &contact)
{
SEString data;
@@ -1571,64 +1581,29 @@ void CSkypeProto:: UpdateChatUserNick(CContact::Ref contact) }
}
-void CSkypeProto::CreateChat(const ChatRoomParam *param)
-{
- ChatRoom::Create(param->invitedContacts, this, param);
-}
-
-void CSkypeProto::JoinToChat(const wchar_t *joinBlob)
-{
- SEString data;
- ConversationRef conversation;
- if (this->GetConversationByBlob(data, conversation))
- {
- conversation->GetPropIdentity(data);
- ptrW cid(::mir_utf8decodeW(data));
-
- conversation->GetPropDisplayname(data);
- ptrW name(::mir_utf8decodeW(data));
-
- CSkypeProto::ReplaceSpecialChars(cid);
- ChatRoom *room = new ChatRoom(cid, name, this);
- room->Start(conversation, true);
- }
-}
-
INT_PTR __cdecl CSkypeProto::OnJoinChat(WPARAM wParam, LPARAM)
{
HANDLE hContact = (HANDLE)wParam;
if (hContact)
{
- if (::db_get_w(hContact, this->m_szModuleName, SKYPE_SETTINGS_STATUS, ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
- {
- ptrW cid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
- ptrA cidA(::mir_utf8encodeW(cid));
+ ptrW cid(::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID"));
+ ChatRoom *room = this->FindChatRoom(cid);
+ if ( !room)
+ {
ConversationRef conversation;
- if (this->GetConversationByIdentity((char *)cidA, conversation))
+ if (this->GetConversationByIdentity(
+ (char *)_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)),
+ conversation))
{
SEString data;
conversation->GetJoinBlob(data);
ptrW joinBlob(::mir_utf8decodeW(data));
- this->JoinToChat(joinBlob);
+ ChatRoom::Join(joinBlob, this);
}
}
else
- {
- ptrW cid(::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID"));
-
- GCDEST gcd = { this->m_szModuleName, { NULL }, GC_EVENT_CONTROL };
- gcd.ptszID = cid;
-
- GCEVENT gce = {0};
- gce.cbSize = sizeof(GCEVENT);
- gce.dwFlags = GC_TCHAR;
- gce.pDest = &gcd;
-
- // show window
- gcd.iType = GC_EVENT_CONTROL;
- ::CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gce);
- }
+ room->ShowWindow();
}
return 0;
@@ -1665,12 +1640,9 @@ void __cdecl CSkypeProto::LoadChatList(void*) uint convoType = conversation->GetUintProp(Conversation::P_TYPE);
if (convoType == CConversation::CONFERENCE)
{
- bool isBookmarked;
- conversation->GetPropIsBookmarked(isBookmarked);
-
CConversation::MY_STATUS status;
conversation->GetPropMyStatus(status);
- if (status == Conversation::APPLICANT || status == Conversation::CONSUMER || isBookmarked)
+ if (status == Conversation::APPLICANT || status == Conversation::CONSUMER )
{
conversation->GetPropIdentity(data);
ptrW cid = ::mir_utf8decodeW(data);
@@ -1729,7 +1701,7 @@ void CSkypeProto::OnConversationListChange( ptrW cid = ::mir_utf8decodeW(data);
CSkypeProto::ReplaceSpecialChars(cid);
- if ( !this->GetChatRoomByCid(cid))
+ if ( !this->FindChatRoom(cid))
{
conversation->GetPropDisplayname(data);
ptrW name = ::mir_utf8decodeW(data);
@@ -1738,4 +1710,8 @@ void CSkypeProto::OnConversationListChange( room->Start(conversation, true);
}
}
-}
\ No newline at end of file +}
+
+void CSkypeProto::ChatRoomParseUriComands(const wchar_t *commands)
+{
+}
diff --git a/protocols/Skype/src/skype_chat.h b/protocols/Skype/src/skype_chat.h index 29e27e8885..c639f2942f 100644 --- a/protocols/Skype/src/skype_chat.h +++ b/protocols/Skype/src/skype_chat.h @@ -126,6 +126,8 @@ class ChatRoom private:
wchar_t *cid;
wchar_t *name;
+
+ CConversation::Ref conversation;
HANDLE hContact;
@@ -150,7 +152,6 @@ private: public:
ChatMember *me;
ChatMember *sys;
- CConversation::Ref conversation;
static wchar_t *Roles[];
@@ -159,18 +160,24 @@ public: HANDLE GetContactHandle() const;
- static void Create(const StringList &invitedMembers, CSkypeProto *ppro, const ChatRoomParam *param);
+ void SetTopic(const wchar_t *topic);
+ wchar_t *GetUri();
+ void ShowWindow();
+ void Invite(const StringList &contacts);
void Start(const ConversationRef &conversation, bool showWindow = false);
+ //void Join(const wchar_t *joinBlob, bool showWindow = false);
+
+ void SendMessage(const wchar_t *text);
void LeaveChat();
+ void LeaveChatAndDelete();
void SendEvent(const wchar_t *sid, int eventType, DWORD timestamp = time(NULL), DWORD flags = GCEF_ADDTOLOG, DWORD itemData = 0, const wchar_t *status = NULL, const wchar_t *message = NULL);
bool IsMe(const wchar_t *sid) const;
bool IsSys(const wchar_t *sid) const;
- //
ChatMember *FindChatMember(const wchar_t *sid);
void AddMember(const ChatMember &item, const ChatMember &author, DWORD timestamp = time(NULL));
@@ -181,6 +188,9 @@ public: void UpdateMember(const wchar_t *sid, const wchar_t *nick, int role, int status, DWORD timestamp = time(NULL));
+ //void GiveMember(const wchar_t *sid);
+ void AddApplicant(const ChatMember *sid);
+
void KickMember(const wchar_t *sid, const wchar_t *author, DWORD timestamp = time(NULL));
void RemoveMember(const wchar_t *sid, DWORD timestamp = time(NULL));
@@ -189,5 +199,6 @@ public: void OnParticipantChanged(const ParticipantRef &participant, int prop);
- static ChatRoom *FindChatRoom(const wchar_t *cid);
-};
\ No newline at end of file + static void Create(const ChatRoomParam *param, CSkypeProto *ppro);
+ static void Join(const wchar_t *joinBlob, CSkypeProto *ppro);
+};
diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp index 38ce398a23..932cc30c5f 100644 --- a/protocols/Skype/src/skype_contacts.cpp +++ b/protocols/Skype/src/skype_contacts.cpp @@ -1,6 +1,6 @@ #include "skype.h"
-void CSkypeProto::UpdateContactAuthState(HANDLE hContact, CContact::Ref contact)
+void CSkypeProto::UpdateContactAuthState(HANDLE hContact, const ContactRef &contact)
{
uint newTS = 0;
contact->GetPropAuthreqTimestamp(newTS);
@@ -25,60 +25,50 @@ void CSkypeProto::UpdateContactAuthState(HANDLE hContact, CContact::Ref contact) }
}
-void CSkypeProto::UpdateContactStatus(HANDLE hContact, CContact::Ref contact)
+void CSkypeProto::UpdateContactStatus(HANDLE hContact, const ContactRef &contact)
{
- CContact::AVAILABILITY availability;
+ Contact::AVAILABILITY availability;
contact->GetPropAvailability(availability);
::db_set_w(hContact, this->m_szModuleName, SKYPE_SETTINGS_STATUS, CSkypeProto::SkypeToMirandaStatus(availability));
- if (availability == CContact::SKYPEOUT)
- {
+ if (availability == Contact::SKYPEOUT)
::db_set_w(hContact, this->m_szModuleName, SKYPE_SETTINGS_STATUS, ID_STATUS_ONTHEPHONE);
- }
else
{
- if (availability == CContact::PENDINGAUTH)
+ if (availability == Contact::PENDINGAUTH)
::db_set_b(hContact, this->m_szModuleName, "Auth", 1);
else
::db_unset(hContact, this->m_szModuleName, "Auth");
}
}
-void CSkypeProto::UpdateContactClient(SEObject *obj, HANDLE hContact)
+void CSkypeProto::UpdateContactClient(HANDLE hContact, const ContactRef &contact)
{
bool isMobile = false;
- ((CContact *)obj)->HasCapability(Contact::CAPABILITY_MOBILE_DEVICE, isMobile/*, true*/);
+ contact->HasCapability(Contact::CAPABILITY_MOBILE_DEVICE, isMobile/*, true*/);
::db_set_ws(hContact, this->m_szModuleName, "MirVer", isMobile ? L"SkypeMobile" : L"Skype");
}
-void CSkypeProto::UpdateContactNickName(SEObject *obj, HANDLE hContact)
-{
- // todo: P_DISPLAYNAME = 21 is unworked
- ptrW nick( ::mir_utf8decodeW(obj->GetStrProp(/* *::P_FULLNAME */ 5)));
- if ( !::wcslen(nick))
- ::db_unset(hContact, this->m_szModuleName, "Nick");
- else
- ::db_set_ws(hContact, this->m_szModuleName, "Nick", nick);
-}
-
-void CSkypeProto::UpdateContactOnlineSinceTime(SEObject *obj, HANDLE hContact)
+void CSkypeProto::UpdateContactOnlineSinceTime(HANDLE hContact, const ContactRef &contact)
{
- uint newTS = obj->GetUintProp(/* CContact::P_LASTONLINE_TIMESTAMP */35);
+ uint newTS = 0;
+ contact->GetPropLastonlineTimestamp(newTS);
DWORD oldTS = ::db_get_dw(hContact, this->m_szModuleName, "OnlineSinceTS", 0);
if (newTS > oldTS)
::db_set_dw(hContact, this->m_szModuleName, "OnlineSinceTS", newTS);
}
-void CSkypeProto::UpdateContactLastEventDate(SEObject *obj, HANDLE hContact)
+void CSkypeProto::UpdateContactLastEventDate(HANDLE hContact, const ContactRef &contact)
{
- uint newTS = obj->GetUintProp(/* CContact::P_LASTUSED_TIMESTAMP */39);
+ uint newTS = 0;
+ contact->GetPropLastusedTimestamp(newTS);
DWORD oldTS = ::db_get_dw(hContact, this->m_szModuleName, "LastEventDateTS", 0);
if (newTS > oldTS)
::db_set_dw(hContact, this->m_szModuleName, "LastEventDateTS", newTS);
}
-void CSkypeProto::OnContactChanged(CContact::Ref contact, int prop)
+void CSkypeProto::OnContactChanged(const ContactRef &contact, int prop)
{
SEString data;
contact->GetPropSkypename(data);
@@ -90,51 +80,50 @@ void CSkypeProto::OnContactChanged(CContact::Ref contact, int prop) if (hContact)
{
- switch(prop) {
- case CContact::P_AUTHREQ_TIMESTAMP:
+ switch(prop)
+ {
+ case Contact::P_AUTHREQ_TIMESTAMP:
{
uint newTS = 0;
contact->GetPropAuthreqTimestamp(newTS);
DWORD oldTS = ::db_get_dw(hContact, this->m_szModuleName, "AuthTS", 0);
if (newTS > oldTS)
- {
this->RaiseAuthRequestEvent(newTS, contact);
- }
}
break;
- case CContact::P_AUTHREQUEST_COUNT:
+ case Contact::P_AUTHREQUEST_COUNT:
// todo: all authrequests after first should be catch here
this->UpdateContactAuthState(hContact, contact);
break;
- case CContact::P_AVAILABILITY:
+ case Contact::P_AVAILABILITY:
this->UpdateContactStatus(hContact, contact);
this->UpdateChatUserStatus(contact);
break;
//case CContact::P_AVATAR_IMAGE:
- case CContact::P_AVATAR_TIMESTAMP:
+ case Contact::P_AVATAR_TIMESTAMP:
this->UpdateProfileAvatar(contactObj, hContact);
break;
//case CContact::P_MOOD_TEXT:
- case CContact::P_MOOD_TIMESTAMP:
+ case Contact::P_MOOD_TIMESTAMP:
this->UpdateProfileStatusMessage(contactObj, hContact);
break;
- case CContact::P_FULLNAME:
+ case Contact::P_FULLNAME:
this->UpdateChatUserNick(contact);
break;
- case CContact::P_PROFILE_TIMESTAMP:
+ case Contact::P_PROFILE_TIMESTAMP:
this->UpdateProfile(contactObj, hContact);
break;
}
}
}
-void CSkypeProto::OnContactListChanged(CContact::Ref contact)
+void CSkypeProto::OnContactListChanged(const ContactRef &contact)
{
bool result;
@@ -163,7 +152,8 @@ void CSkypeProto::OnContactListChanged(CContact::Ref contact) bool CSkypeProto::IsProtoContact(HANDLE hContact)
{
- return ::CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)this->m_szModuleName) < 0;
+ return ::lstrcmpiA(::GetContactProto(hContact), this->m_szModuleName) == 0;
+ //return ::CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)this->m_szModuleName) < 0;
}
HANDLE CSkypeProto::GetContactBySid(const wchar_t *sid)
@@ -174,12 +164,9 @@ HANDLE CSkypeProto::GetContactBySid(const wchar_t *sid) for (hContact = ::db_find_first(this->m_szModuleName); hContact; hContact = ::db_find_next(hContact, this->m_szModuleName))
{
- //if ( !this->IsChatRoom(hContact))
- {
- ptrW contactSid( ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
- if (::lstrcmpi(contactSid, sid) == 0)
- break;
- }
+ ptrW contactSid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
+ if (::lstrcmpi(contactSid, sid) == 0)
+ break;
}
::LeaveCriticalSection(&this->contact_search_lock);
@@ -239,7 +226,7 @@ HANDLE CSkypeProto::AddContact(CContact::Ref contact) default:
::db_unset(hContact, this->m_szModuleName, "IsSkypeOut");
- //::db_unset(hContact, "CList", "Hidden");
+ ::db_unset(hContact, "CList", "Hidden");
::db_unset(hContact, "CList", "NotOnList");
}
@@ -247,10 +234,10 @@ HANDLE CSkypeProto::AddContact(CContact::Ref contact) ::db_set_ws(hContact, this->m_szModuleName, "Nick", nick);
DBVARIANT dbv;
- if(!db_get_ts(NULL, m_szModuleName, SKYPE_SETTINGS_DEF_GROUP, &dbv))
+ if ( !::db_get_ts(NULL, this->m_szModuleName, SKYPE_SETTINGS_DEF_GROUP, &dbv))
{
- db_set_ts(hContact, "CList", "Group", dbv.ptszVal);
- db_free(&dbv);
+ ::db_set_ts(hContact, "CList", "Group", dbv.ptszVal);
+ ::db_free(&dbv);
}
}
diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp index 2a0b48b4f4..d088754d0f 100644 --- a/protocols/Skype/src/skype_dialogs.cpp +++ b/protocols/Skype/src/skype_dialogs.cpp @@ -524,7 +524,7 @@ INT_PTR CALLBACK CSkypeProto::PersonalSkypeDlgProc(HWND hwndDlg, UINT msg, WPARA // language
int i = 0;
- mir_ptr<wchar_t> lang( ::db_get_wsa(NULL, ppro->m_szModuleName, "Language1"));
+ ptrW lang( ::db_get_wsa(NULL, ppro->m_szModuleName, "Language1"));
for (auto it = CSkypeProto::languages.begin(); it != CSkypeProto::languages.end(); ++it)
{
::SendMessage(
diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp index f63cbed0c5..d61e5d2dcf 100644 --- a/protocols/Skype/src/skype_events.cpp +++ b/protocols/Skype/src/skype_events.cpp @@ -2,17 +2,22 @@ int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM)
{
- this->InitChat();
- this->InitNetLib();
- this->InitCustomFolders();
- this->InitInstanceHookList();
-
- /*if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE))
+ /*if (::ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE))
{
::CreateServiceFunction(MODULE"/ParseSkypeURI", &CSkypeProto::ParseSkypeUri);
- ::AssocMgr_AddNewUrlTypeT("skype:", TranslateT("Skype URI"), g_hInstance, IDI_SKYPE, MODULE"/ParseSkypeURI", 0);
+ ::AssocMgr_AddNewUrlTypeT("skype:", TranslateT("Skype URI API"), g_hInstance, IDI_SKYPE, MODULE"/ParseSkypeURI", 0);
}*/
+ return 0;
+}
+
+int CSkypeProto::OnProtoModulesLoaded(WPARAM, LPARAM)
+{
+ this->InitNetLib();
+ this->InitChatModule();
+ this->InitCustomFolders();
+ this->InitInstanceHookList();
+
if (::ServiceExists(MS_BB_ADDBUTTON))
{
BBButton bbd = { sizeof(bbd) };
@@ -62,10 +67,19 @@ int CSkypeProto::OnPreShutdown(WPARAM, LPARAM) int CSkypeProto::OnContactDeleted(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact = (HANDLE)wParam;
- if (hContact && this->IsOnline())
+ if (hContact)
{
if (this->IsChatRoom(hContact))
- this->DeleteChatRoom(hContact);
+ {
+ this->OnLeaveChat(wParam, 0);
+ ptrW cid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
+ if (cid != NULL)
+ {
+ ConversationRef conversation;
+ if (this->GetConversationByIdentity((char *)_T2A(cid), conversation))
+ conversation->Delete();
+ }
+ }
else
this->RevokeAuth(wParam, lParam);
}
@@ -175,16 +189,32 @@ int __cdecl CSkypeProto::OnTabSRMMButtonPressed(WPARAM wParam, LPARAM lParam) {
case BBB_ID_CONF_INVITE:
if (this->IsOnline() && this->IsChatRoom(hContact))
- this->InviteToChatRoom(hContact);
+ this->ChatRoomInvite(hContact);
break;
case BBB_ID_CONF_SPAWN:
if (this->IsOnline() && !this->IsChatRoom(hContact))
{
- StringList targets;
- targets.insert(ptrW(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
-
- this->StartChat(targets);
+ SEStringList targets;
+ ptrW sid(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID));
+ targets.append((char *)_T2A(sid));
+
+ ConversationRef conversation, conference;
+ this->GetConversationByParticipants(targets, conversation);
+
+ StringList invitedContacts(sid);
+ ChatRoomParam *param = new ChatRoomParam(NULL, invitedContacts, this);
+
+ if (::DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHATROOM_CREATE), NULL, CSkypeProto::ChatRoomProc, (LPARAM)param) == IDOK && param->invitedContacts.size() > 0)
+ {
+ for (size_t i = 0; i < param->invitedContacts.size(); i++)
+ {
+ SEString contact(_T2A(param->invitedContacts[i]));
+ if ( !targets.contains(contact))
+ targets.append(contact);
+ }
+ conversation->SpawnConference(targets, conference);
+ }
}
break;
}
diff --git a/protocols/Skype/src/skype_hooks.cpp b/protocols/Skype/src/skype_hooks.cpp index 5a0d3cfa61..a1184cc325 100644 --- a/protocols/Skype/src/skype_hooks.cpp +++ b/protocols/Skype/src/skype_hooks.cpp @@ -2,7 +2,8 @@ void CSkypeProto::InitHookList()
{
- ::HookEvent(ME_CLIST_PREBUILDCONTACTMENU, &CSkypeProto::PrebuildContactMenu);
+ ::HookEvent(ME_SYSTEM_MODULESLOADED, &CSkypeProto::OnModulesLoaded);
+ ::HookEvent(ME_CLIST_PREBUILDCONTACTMENU, &CSkypeProto::PrebuildContactMenu);
}
HANDLE CSkypeProto::HookEvent(const char* szEvent, SkypeEventFunc handler)
diff --git a/protocols/Skype/src/skype_ignore_list.cpp b/protocols/Skype/src/skype_ignore_list.cpp index 008fd85045..b37f6787e0 100644 --- a/protocols/Skype/src/skype_ignore_list.cpp +++ b/protocols/Skype/src/skype_ignore_list.cpp @@ -211,7 +211,7 @@ INT_PTR CALLBACK CSkypeProto::IgnoreListWndProc(HWND hwndDlg, UINT msg, WPARAM w }
}
- ::Utils_RestoreWindowPosition(hwndDlg, 0, MODULE, "BookmarksWindow");
+ ::Utils_RestoreWindowPosition(hwndDlg, 0, MODULE, "IgnoreListWindow");
}
break;
@@ -239,26 +239,14 @@ INT_PTR CALLBACK CSkypeProto::IgnoreListWndProc(HWND hwndDlg, UINT msg, WPARAM w ptrW sid(::mir_utf8decodeW(data));
::CallService(MS_MSG_SENDMESSAGE, (WPARAM)ppro->GetContactBySid(sid), 0);
}
- else if (lvi.iGroupId == 2)
+ /*else if (lvi.iGroupId == 2)
{
CConversation *conversation = (CConversation *)lvi.lParam;
conversation->GetPropIdentity(data);
ptrW cid(::mir_utf8decodeW(data));
CSkypeProto::ReplaceSpecialChars(cid);
-
- ChatRoom *room = ppro->FindChatRoom(cid);
- if (room != NULL)
- ::CallProtoService(ppro->m_szModuleName, PS_JOINCHAT, (WPARAM)room->GetContactHandle(), 0);
- else
- {
- conversation->GetPropDisplayname(data);
- ptrW name = ::mir_utf8decodeW(data);
-
- ChatRoom *room = new ChatRoom(cid, name, ppro);
- room->Start(conversation->ref(), true);
- }
- }
+ }*/
}
}
}
@@ -270,7 +258,7 @@ INT_PTR CALLBACK CSkypeProto::IgnoreListWndProc(HWND hwndDlg, UINT msg, WPARAM w switch(LOWORD(wParam))
{
case IDCANCEL:
- ::Utils_SaveWindowPosition(hwndDlg, NULL, MODULE, "BookmarksWindow");
+ ::Utils_SaveWindowPosition(hwndDlg, NULL, MODULE, "IgnoreListWindow");
::Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
::Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0));
::DestroyWindow(hwndDlg);
diff --git a/protocols/Skype/src/skype_messages.cpp b/protocols/Skype/src/skype_messages.cpp index b4788e98a5..2c398de2b0 100644 --- a/protocols/Skype/src/skype_messages.cpp +++ b/protocols/Skype/src/skype_messages.cpp @@ -49,7 +49,7 @@ void CSkypeProto::OnMessageReceived(const ConversationRef &conversation, const M message->GetPropBodyXml(data);
char *text = CSkypeProto::RemoveHtml(data);
- message->GetPropAuthor(data);
+ message->GetPropAuthor(data);
CContact::Ref author;
this->GetContact(data, author);
@@ -161,7 +161,7 @@ void CSkypeProto::OnMessageEvent(const ConversationRef &conversation, const Mess HANDLE hContact = this->AddContact(author);
- char *message = ::mir_utf8encode(::Translate("Incoming call received"));
+ char *message = ::mir_utf8encode(::Translate("Incoming call started"));
this->AddDBEvent(
hContact,
@@ -171,9 +171,9 @@ void CSkypeProto::OnMessageEvent(const ConversationRef &conversation, const Mess (DWORD)::strlen(message) + 1,
(PBYTE)message);
//temp popup
- TCHAR popuptext[MAX_PATH];
- mir_sntprintf(popuptext, SIZEOF(popuptext), TranslateT("Incoming call from %s. Use offical skype for calling."), mir_ptr<wchar_t>(::mir_utf8decodeW(identity)));
- this->ShowNotification(popuptext);
+ /*TCHAR popuptext[MAX_PATH];
+ mir_sntprintf(popuptext, SIZEOF(popuptext), TranslateT("Incoming call from %s. Use offical skype for calling."), ptrW(::mir_utf8decodeW(identity)));
+ this->ShowNotification(popuptext);*/
}
break;
diff --git a/protocols/Skype/src/skype_own_info.cpp b/protocols/Skype/src/skype_own_info.cpp index 7682b2722b..57e2da24f5 100644 --- a/protocols/Skype/src/skype_own_info.cpp +++ b/protocols/Skype/src/skype_own_info.cpp @@ -2,7 +2,7 @@ void __cdecl CSkypeProto::LoadOwnInfo(void *)
{
- mir_ptr<wchar_t> nick( ::db_get_wsa(NULL, this->m_szModuleName, "Nick"));
+ /*ptrW nick( ::db_get_wsa(NULL, this->m_szModuleName, "Nick"));
if ( !nick)
{
SEString data;
@@ -15,11 +15,25 @@ void __cdecl CSkypeProto::LoadOwnInfo(void *) nick = ::mir_utf8decodeW(data);
::db_set_ws(NULL, this->m_szModuleName, "Nick", nick);
- }
+ }*/
this->UpdateProfile(this->account.fetch());
}
+INT_PTR __cdecl CSkypeProto::SetMyNickName(WPARAM wParam, LPARAM lParam)
+{
+ wchar_t *nick = (wParam & SMNN_UNICODE) ? ::mir_wstrdup((wchar_t *)lParam) : ::mir_a2t((char*) lParam);
+
+ //::db_set_ws(NULL, this->m_szModuleName, "Nick", nick);
+
+ if ( !this->IsOnline())
+ return 0;
+
+ this->account->SetStrProperty(Account::P_FULLNAME, (char *)ptrA(::mir_utf8encodeW(nick)));
+
+ return 0;
+}
+
void CSkypeProto::SaveOwnInfoToServer(HWND hwndPage, int iPage)
{
wchar_t text[2048];
@@ -30,17 +44,17 @@ void CSkypeProto::SaveOwnInfoToServer(HWND hwndPage, int iPage) case 0:
{
::GetDlgItemText(hwndPage, IDC_FULLNAME, text, SIZEOF(text));
- if (this->account->SetStrProperty(Account::P_FULLNAME, (char*)mir_ptr<char>(::mir_utf8encodeW(text))))
+ if (this->account->SetStrProperty(Account::P_FULLNAME, (char *)ptrA(::mir_utf8encodeW(text))))
::db_set_ws(NULL, this->m_szModuleName, "Nick", text);
::GetDlgItemText(hwndPage, IDC_MOOD, text, SIZEOF(text));
- this->account->SetStrProperty(Account::P_MOOD_TEXT, (char*)mir_ptr<char>(::mir_utf8encodeW(text)));
+ this->account->SetStrProperty(Account::P_MOOD_TEXT, (char *)ptrA(::mir_utf8encodeW(text)));
::GetDlgItemText(hwndPage, IDC_ABOUT, text, SIZEOF(text));
- this->account->SetStrProperty(Account::P_ABOUT, (char*)mir_ptr<char>(::mir_utf8encodeW(text)));
+ this->account->SetStrProperty(Account::P_ABOUT, (char *)ptrA(::mir_utf8encodeW(text)));
::GetDlgItemText(hwndPage, IDC_HOMEPAGE, text, SIZEOF(text));
- this->account->SetStrProperty(Account::P_HOMEPAGE, (char*)mir_ptr<char>(::mir_utf8encodeW(text)));
+ this->account->SetStrProperty(Account::P_HOMEPAGE, (char *)ptrA(::mir_utf8encodeW(text)));
this->account->SetIntProperty(
Account::P_GENDER,
@@ -59,7 +73,7 @@ void CSkypeProto::SaveOwnInfoToServer(HWND hwndPage, int iPage) std::wstring key = *(std::wstring *)SendMessage(GetDlgItem(hwndPage, IDC_LANGUAGE), CB_GETITEMDATA, lang, 0);
this->account->SetStrProperty(
Account::P_LANGUAGES,
- (char *)mir_ptr<char>(::mir_utf8encodeW(key.c_str())));
+ (char *)ptrA(::mir_utf8encodeW(key.c_str())));
}
}
break;
@@ -80,26 +94,26 @@ void CSkypeProto::SaveOwnInfoToServer(HWND hwndPage, int iPage) ::wcscat(emails, L" ");
::wcscat(emails, text);
}
- this->account->SetStrProperty(Account::P_EMAILS, (char*)mir_ptr<char>(::mir_utf8encodeW(emails)));
+ this->account->SetStrProperty(Account::P_EMAILS, (char *)ptrA(::mir_utf8encodeW(emails)));
::GetDlgItemText(hwndPage, IDC_MOBPHONE, text, SIZEOF(text));
- this->account->SetStrProperty(Account::P_PHONE_MOBILE, (char*)mir_ptr<char>(::mir_utf8encodeW(text)));
+ this->account->SetStrProperty(Account::P_PHONE_MOBILE, (char *)ptrA(::mir_utf8encodeW(text)));
::GetDlgItemText(hwndPage, IDC_HOMEPHONE, text, SIZEOF(text));
- this->account->SetStrProperty(Account::P_PHONE_HOME, (char*)mir_ptr<char>(::mir_utf8encodeW(text)));
+ this->account->SetStrProperty(Account::P_PHONE_HOME, (char *)ptrA(::mir_utf8encodeW(text)));
::GetDlgItemText(hwndPage, IDC_OFFICEPHONE, text, SIZEOF(text));
- this->account->SetStrProperty(Account::P_PHONE_OFFICE, (char*)mir_ptr<char>(::mir_utf8encodeW(text)));
+ this->account->SetStrProperty(Account::P_PHONE_OFFICE, (char *)ptrA(::mir_utf8encodeW(text)));
break;
// Page 2: Home
case 2:
::GetDlgItemText(hwndPage, IDC_CITY, text, SIZEOF(text));
- this->account->SetStrProperty(Account::P_CITY, (char*)mir_ptr<char>(::mir_utf8encodeW(text)));
+ this->account->SetStrProperty(Account::P_CITY, (char *)ptrA(::mir_utf8encodeW(text)));
::GetDlgItemText(hwndPage, IDC_STATE, text, SIZEOF(text));
- this->account->SetStrProperty(Account::P_PROVINCE, (char*)mir_ptr<char>(::mir_utf8encodeW(text)));
+ this->account->SetStrProperty(Account::P_PROVINCE, (char *)ptrA(::mir_utf8encodeW(text)));
int i = ::SendMessage(::GetDlgItem(hwndPage, IDC_COUNTRY), CB_GETCURSEL, 0, 0);
char *iso = (char *)::SendMessage(::GetDlgItem(hwndPage, IDC_COUNTRY), CB_GETITEMDATA, i, 0);
diff --git a/protocols/Skype/src/skype_profile.cpp b/protocols/Skype/src/skype_profile.cpp index d7b12d1acd..b1870c5856 100644 --- a/protocols/Skype/src/skype_profile.cpp +++ b/protocols/Skype/src/skype_profile.cpp @@ -3,7 +3,7 @@ void CSkypeProto::UpdateProfileAvatar(SEObject *obj, HANDLE hContact)
{
- uint newTS = hContact ? obj->GetUintProp(Contact::P_AVATAR_TIMESTAMP) : obj->GetUintProp(Account::P_AVATAR_TIMESTAMP);
+ uint newTS = obj->GetUintProp(/* *::P_AVATAR_TIMESTAMP */ 182);
//if (!newTS) return; //uncomment when skypekit will be work correctly
DWORD oldTS = ::db_get_dw(hContact, this->m_szModuleName, "AvatarTS", 0);
@@ -12,7 +12,7 @@ void CSkypeProto::UpdateProfileAvatar(SEObject *obj, HANDLE hContact) bool isAvatarFileExists = CSkypeProto::FileExists(path);
if (newTS > oldTS || !isAvatarFileExists)
{
- SEBinary data = hContact ? obj->GetBinProp(Contact::P_AVATAR_IMAGE) : obj->GetBinProp(Account::P_AVATAR_IMAGE);
+ SEBinary data = obj->GetBinProp(/* *::P_AVATAR_IMAGE */ 37);
if (data.size() > 0)
{
FILE *fp = ::_wfopen(path, L"wb");
@@ -53,7 +53,7 @@ void CSkypeProto::UpdateProfileAvatar(SEObject *obj, HANDLE hContact) void CSkypeProto::UpdateProfileAboutText(SEObject *obj, HANDLE hContact)
{
- ptrW aboutText(hContact ? ::mir_utf8decodeW(obj->GetStrProp(Contact::P_ABOUT)) : ::mir_utf8decodeW(obj->GetStrProp(Account::P_ABOUT)));
+ ptrW aboutText(::mir_utf8decodeW(obj->GetStrProp(/* *::P_ABOUT */ 18)));
if ( !::wcslen(aboutText))
::db_unset(hContact, this->m_szModuleName, "About");
else
@@ -62,7 +62,7 @@ void CSkypeProto::UpdateProfileAboutText(SEObject *obj, HANDLE hContact) void CSkypeProto::UpdateProfileBirthday(SEObject *obj, HANDLE hContact)
{
- uint data = hContact ? obj->GetUintProp(Contact::P_BIRTHDAY) : obj->GetUintProp(Account::P_BIRTHDAY);
+ uint data = obj->GetUintProp(/* *::P_BIRTHDAY */ 7);
if (data > 0)
{
TCHAR date[20];
@@ -99,7 +99,7 @@ void CSkypeProto::UpdateProfileBirthday(SEObject *obj, HANDLE hContact) void CSkypeProto::UpdateProfileCity(SEObject *obj, HANDLE hContact)
{
- mir_ptr<wchar_t> city(hContact ? ::mir_utf8decodeW(obj->GetStrProp(Contact::P_CITY)) : ::mir_utf8decodeW(obj->GetStrProp(Account::P_CITY)));
+ ptrW city(::mir_utf8decodeW(obj->GetStrProp(/* *::P_CITY */ 12)));
if ( !::wcslen(city))
::db_unset(hContact, this->m_szModuleName, "City");
else
@@ -109,7 +109,7 @@ void CSkypeProto::UpdateProfileCity(SEObject *obj, HANDLE hContact) void CSkypeProto::UpdateProfileCountry(SEObject *obj, HANDLE hContact)
{
char *country;
- mir_ptr<char> isocode(hContact ? ::mir_strdup(obj->GetStrProp(Contact::P_COUNTRY)) : ::mir_strdup(obj->GetStrProp(Account::P_COUNTRY)));
+ ptrA isocode(::mir_strdup(obj->GetStrProp(/* *::P_COUNTRY */ 10)));
if ( !::strlen(isocode))
{
::db_unset(hContact, this->m_szModuleName, "Country");
@@ -123,7 +123,7 @@ void CSkypeProto::UpdateProfileCountry(SEObject *obj, HANDLE hContact) void CSkypeProto::UpdateProfileEmails(SEObject *obj, HANDLE hContact)
{
- mir_ptr<wchar_t> emails(hContact ? ::mir_a2u(obj->GetStrProp(Contact::P_EMAILS)) : ::mir_a2u(obj->GetStrProp(Account::P_EMAILS)));
+ ptrW emails(::mir_utf8decodeW(obj->GetStrProp(/* *::P_EMAILS */ 16)));
if (::wcscmp(emails, L"") == 0)
{
::db_unset(hContact, this->m_szModuleName, "e-mail0");
@@ -146,7 +146,7 @@ void CSkypeProto::UpdateProfileEmails(SEObject *obj, HANDLE hContact) void CSkypeProto::UpdateProfileFullName(SEObject *obj, HANDLE hContact)
{
- mir_ptr<wchar_t> fullname(hContact ? ::mir_utf8decodeW(obj->GetStrProp(Contact::P_FULLNAME)) : ::mir_utf8decodeW(obj->GetStrProp(Account::P_FULLNAME)));
+ ptrW fullname(::mir_utf8decodeW(obj->GetStrProp(/* *::P_FULLNAME */ 5)));
if ( !::wcslen(fullname))
{
::db_unset(hContact, this->m_szModuleName, "FirstName");
@@ -164,7 +164,7 @@ void CSkypeProto::UpdateProfileFullName(SEObject *obj, HANDLE hContact) void CSkypeProto::UpdateProfileGender(SEObject *obj, HANDLE hContact)
{
- uint data = hContact ? obj->GetUintProp(Contact::P_GENDER) : obj->GetUintProp(Account::P_GENDER);
+ uint data = obj->GetUintProp(/* *::P_GENDER */ 8);
if (data)
::db_set_b(hContact, this->m_szModuleName, "Gender", (BYTE)(data == 1 ? 'M' : 'F'));
else
@@ -173,7 +173,7 @@ void CSkypeProto::UpdateProfileGender(SEObject *obj, HANDLE hContact) void CSkypeProto::UpdateProfileHomepage(SEObject *obj, HANDLE hContact)
{
- mir_ptr<wchar_t> homepage(hContact ? ::mir_a2u(obj->GetStrProp(Contact::P_HOMEPAGE)) : ::mir_a2u(obj->GetStrProp(Account::P_HOMEPAGE)));
+ ptrW homepage(::mir_utf8decodeW(obj->GetStrProp(/* *::P_HOMEPAGE */ 17)));
if (::wcscmp(homepage, L"") == 0)
::db_unset(hContact, this->m_szModuleName, "Homepage");
else
@@ -182,7 +182,7 @@ void CSkypeProto::UpdateProfileHomepage(SEObject *obj, HANDLE hContact) void CSkypeProto::UpdateProfileLanguages(SEObject *obj, HANDLE hContact)
{
- mir_ptr<wchar_t> isocodes(hContact ? ::mir_utf8decodeW(obj->GetStrProp(Contact::P_LANGUAGES)) : ::mir_utf8decodeW(obj->GetStrProp(Account::P_LANGUAGES)));
+ ptrW isocodes(::mir_utf8decodeW(obj->GetStrProp(/* *::P_LANGUAGES */ 9)));
::db_unset(hContact, this->m_szModuleName, "Language1");
::db_unset(hContact, this->m_szModuleName, "Language2");
@@ -204,16 +204,33 @@ void CSkypeProto::UpdateProfileLanguages(SEObject *obj, HANDLE hContact) void CSkypeProto::UpdateProfileMobilePhone(SEObject *obj, HANDLE hContact)
{
- mir_ptr<wchar_t> phone(hContact ? ::mir_a2u(obj->GetStrProp(Contact::P_PHONE_MOBILE)) : ::mir_a2u(obj->GetStrProp(Account::P_PHONE_MOBILE)));
+ ptrW phone(::mir_utf8decodeW(obj->GetStrProp(/* *::P_PHONE_MOBILE */ 15)));
if ( !::wcslen(phone))
::db_unset(hContact, this->m_szModuleName, "Cellular");
else
::db_set_ws(hContact, this->m_szModuleName, "Cellular", phone);
}
+void CSkypeProto::UpdateProfileNick(SEObject *obj, HANDLE hContact)
+{
+ ptrW nick;
+ if (hContact)
+ {
+ CContact *contact = (CContact *)obj;
+ nick = ::mir_utf8decodeW(contact->GetNick());
+ }
+ else
+ nick = ::mir_utf8decodeW(obj->GetStrProp(Account::P_FULLNAME));
+
+ if ( !::wcslen(nick))
+ ::db_unset(hContact, this->m_szModuleName, "Nick");
+ else
+ ::db_set_ws(hContact, this->m_szModuleName, "Nick", nick);
+}
+
void CSkypeProto::UpdateProfilePhone(SEObject *obj, HANDLE hContact)
{
- mir_ptr<wchar_t> phone(hContact ? ::mir_a2u(obj->GetStrProp(Contact::P_PHONE_HOME)) : ::mir_a2u(obj->GetStrProp(Account::P_PHONE_HOME)));
+ ptrW phone(::mir_utf8decodeW(obj->GetStrProp(/* *::P_PHONE_MOBILE */ 13)));
if ( !::wcslen(phone))
::db_unset(hContact, this->m_szModuleName, "Phone");
else
@@ -222,7 +239,7 @@ void CSkypeProto::UpdateProfilePhone(SEObject *obj, HANDLE hContact) void CSkypeProto::UpdateProfileOfficePhone(SEObject *obj, HANDLE hContact)
{
- mir_ptr<wchar_t> phone(hContact ? ::mir_a2u(obj->GetStrProp(Contact::P_PHONE_OFFICE)) : ::mir_a2u(obj->GetStrProp(Account::P_PHONE_OFFICE)));
+ ptrW phone(::mir_utf8decodeW(obj->GetStrProp(/* *::P_PHONE_OFFICE */ 14)));
if ( !::wcslen(phone))
::db_unset(hContact, this->m_szModuleName, "CompanyPhone");
else
@@ -231,7 +248,7 @@ void CSkypeProto::UpdateProfileOfficePhone(SEObject *obj, HANDLE hContact) void CSkypeProto::UpdateProfileState(SEObject *obj, HANDLE hContact)
{
- mir_ptr<wchar_t> state(hContact ? ::mir_utf8decodeW(obj->GetStrProp(Contact::P_PROVINCE)) : ::mir_utf8decodeW(obj->GetStrProp(Account::P_PROVINCE)));
+ ptrW state(::mir_utf8decodeW(obj->GetStrProp(/* *::P_PROVINCE */ 11)));
if ( !::wcslen(state))
::db_unset(hContact, this->m_szModuleName, "State");
else
@@ -240,7 +257,7 @@ void CSkypeProto::UpdateProfileState(SEObject *obj, HANDLE hContact) void CSkypeProto::UpdateProfileStatusMessage(SEObject *obj, HANDLE hContact)
{
- mir_ptr<wchar_t> statusMessage(hContact ? ::mir_utf8decodeW(obj->GetStrProp(Contact::P_MOOD_TEXT)) : ::mir_utf8decodeW(obj->GetStrProp(Account::P_MOOD_TEXT)));
+ ptrW statusMessage(::mir_utf8decodeW(obj->GetStrProp(/* *::P_MOOD_TEXT */ 26)));
if ( !::wcslen(statusMessage))
::db_unset(hContact, this->m_szModuleName, "XStatusMsg");
else
@@ -249,7 +266,7 @@ void CSkypeProto::UpdateProfileStatusMessage(SEObject *obj, HANDLE hContact) void CSkypeProto::UpdateProfileTimezone(SEObject *obj, HANDLE hContact)
{
- LONG data = hContact ? obj->GetUintProp(Contact::P_TIMEZONE) : obj->GetUintProp(Account::P_TIMEZONE);
+ LONG data = obj->GetUintProp(/* *::P_TIMEZONE */ 27);
if (data > 0)
{
LONG diffmin = (data - 24*3600) / 60;
@@ -291,6 +308,7 @@ void CSkypeProto::UpdateProfile(SEObject *obj, HANDLE hContact) this->UpdateProfileHomepage(obj, hContact);
this->UpdateProfileLanguages(obj, hContact);
this->UpdateProfileMobilePhone(obj, hContact);
+ this->UpdateProfileNick(obj, hContact);
this->UpdateProfilePhone(obj, hContact);
this->UpdateProfileOfficePhone(obj, hContact);
this->UpdateProfileState(obj, hContact);
@@ -299,12 +317,10 @@ void CSkypeProto::UpdateProfile(SEObject *obj, HANDLE hContact) if (hContact)
{
- this->UpdateContactNickName(obj, hContact);
- this->UpdateContactOnlineSinceTime(obj, hContact);
- this->UpdateContactLastEventDate(obj, hContact);
-
- this->UpdateContactClient(obj, hContact);
- //::db_set_ws(hContact, this->m_szModuleName, "MirVer", L"Skype");
+ ContactRef ref(obj->getOID());
+ this->UpdateContactClient(hContact, ref);
+ this->UpdateContactLastEventDate(hContact, ref);
+ this->UpdateContactOnlineSinceTime(hContact, ref);
}
::db_set_dw(hContact, this->m_szModuleName, "ProfileTS", newTS);
diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index b98ffc640d..394adc997d 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -536,7 +536,7 @@ int __cdecl CSkypeProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM switch (eventType)
{
case EV_PROTO_ONLOAD:
- return this->OnModulesLoaded(wParam, lParam);
+ return this->OnProtoModulesLoaded(wParam, lParam);
case EV_PROTO_ONEXIT:
return this->OnPreShutdown(wParam, lParam);
diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index 7ffc125101..80e350a9ec 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -36,6 +36,20 @@ struct ChatRoomParam wchar_t confirmation[32];
wchar_t hint[32];
+ ChatRoomParam(CSkypeProto *ppro)
+ : ppro(ppro)
+ {
+ this->id = NULL;
+ this->topic[0] = 0;
+ this->guidline[0] = 0;
+ this->password[0] = 0;
+ this->confirmation[0] = 0;
+ this->hint[0] = 0;
+ this->enableJoining = true;
+ this->joinRank = Participant::WRITER;
+ this->passwordProtection = false;
+ }
+
ChatRoomParam(const wchar_t *id, const StringList &contacts, CSkypeProto *ppro)
: id(::mir_wstrdup(id)), invitedContacts(contacts), ppro(ppro)
{
@@ -177,6 +191,8 @@ public: // languages
static void InitLanguages();
+ static INT_PTR __cdecl ParseSkypeUri(WPARAM wParam, LPARAM lParam);
+
private:
// Skype
CAccount *newAccount(int oid);
@@ -244,6 +260,8 @@ protected: void OnAccountChanged(int prop);
+ INT_PTR __cdecl SetMyNickName(WPARAM, LPARAM);
+
// avatars
bool IsAvatarChanged(const SEBinary &avatar, HANDLE hContact = NULL);
@@ -274,30 +292,25 @@ protected: void OnTransferChanged(CTransfer::Ref transfer, int prop);
// chat
+ void InitChatModule();
+
bool IsChatRoom(HANDLE hContact);
- HANDLE GetChatRoomByCid(const wchar_t *cid);
- HANDLE AddChatRoom(CConversation::Ref conversation);
- void UpdateChatUserStatus(CContact::Ref contact);
- void UpdateChatUserNick(CContact::Ref contact);
+ void UpdateChatUserStatus(const ContactRef &contact);
+ void UpdateChatUserNick(const ContactRef &contact);
void ChatValidateContact(HANDLE hItem, HWND hwndList, const StringList &contacts);
void ChatPrepare(HANDLE hItem, HWND hwndList, const StringList &contacts);
- void GetInvitedContacts(HANDLE hItem, HWND hwndList, StringList &invitedContacts);
+ void GetInvitedContacts(HANDLE hItem, HWND hwndList, StringList &invitedContacts);
- void InitChat();
-
- void StartChat(StringList &invitedContacts);
- void InviteToChatRoom(HANDLE hContact);
+ void ChatRoomParseUriComands(const wchar_t *commands);
+
+ void ChatRoomInvite(HANDLE hContact);
void CloseAllChatSessions();
ChatRoom *FindChatRoom(const wchar_t *cid);
- void DeleteChatRoom(HANDLE hContact);
-
- void CreateChat(const ChatRoomParam *param);
- void JoinToChat(const wchar_t *joinBlob);
INT_PTR __cdecl CreateChatRoomCommand(WPARAM, LPARAM);
INT_PTR __cdecl OnJoinChat(WPARAM wParam, LPARAM);
@@ -309,20 +322,17 @@ protected: void OnChatEvent(const ConversationRef &conversation, const MessageRef &message);
// contacts
- void UpdateContactAuthState(HANDLE hContact, CContact::Ref contact);
- void UpdateContactAvatar(HANDLE hContact, CContact::Ref contact);
- void UpdateContactStatus(HANDLE hContact, CContact::Ref contact);
- void UpdateContactClient(SEObject *obj, HANDLE hContact);
-
- void UpdateContactNickName(SEObject *obj, HANDLE hContact);
- void UpdateContactOnlineSinceTime(SEObject *obj, HANDLE hContact);
- void UpdateContactLastEventDate(SEObject *obj, HANDLE hContact);
+ void UpdateContactAuthState(HANDLE hContact, const ContactRef &contact);
+ void UpdateContactStatus(HANDLE hContact, const ContactRef &contact);
+ void UpdateContactClient(HANDLE hContact, const ContactRef &contact);
+ void UpdateContactOnlineSinceTime(HANDLE hContact, const ContactRef &contact);
+ void UpdateContactLastEventDate(HANDLE hContact, const ContactRef &contact);
void OnSearchCompleted(HANDLE hSearch);
void OnContactFinded(CContact::Ref contact, HANDLE hSearch);
- void OnContactChanged(CContact::Ref contact, int prop);
- void OnContactListChanged(CContact::Ref contact);
+ void OnContactChanged(const ContactRef &contact, int prop);
+ void OnContactListChanged(const ContactRef &contact);
bool IsProtoContact(HANDLE hContact);
HANDLE GetContactBySid(const wchar_t* sid);
@@ -341,7 +351,6 @@ protected: void __cdecl SearchByEmailAsync(void*);
// profile
- //static std::map<std::wstring, std::wstring> FillLanguages();
void UpdateProfileAvatar(SEObject *obj, HANDLE hContact = NULL);
void UpdateProfileAboutText(SEObject *obj, HANDLE hContact = NULL);
@@ -354,7 +363,7 @@ protected: void UpdateProfileHomepage(SEObject *obj, HANDLE hContact = NULL);
void UpdateProfileLanguages(SEObject *obj, HANDLE hContact = NULL);
void UpdateProfileMobilePhone(SEObject *obj, HANDLE hContact = NULL);
- void UpdateProfileNickName(SEObject *obj, HANDLE hContact = NULL);
+ void UpdateProfileNick(SEObject *obj, HANDLE hContact = NULL);
void UpdateProfilePhone(SEObject *obj, HANDLE hContact = NULL);
void UpdateProfileOfficePhone(SEObject *obj, HANDLE hContact = NULL);
void UpdateProfileState(SEObject *obj, HANDLE hContact = NULL);
@@ -389,9 +398,7 @@ protected: static void CopyToClipboard(const wchar_t *text);
- static void ReplaceSpecialChars(wchar_t *text, wchar_t replaceWith = L'_');
-
- static INT_PTR __cdecl ParseSkypeUri(WPARAM wParam, LPARAM lParam);
+ static void ReplaceSpecialChars(wchar_t *text, wchar_t replaceWith = L'_');
// languages
static std::map<std::wstring, std::wstring> languages;
@@ -485,7 +492,9 @@ protected: void StopSkypeRuntime();
// events
- int __cdecl OnModulesLoaded(WPARAM, LPARAM);
+ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam);
+
+ int __cdecl OnProtoModulesLoaded(WPARAM, LPARAM);
int __cdecl OnPreShutdown(WPARAM, LPARAM);
int __cdecl OnContactDeleted(WPARAM, LPARAM);
int __cdecl OnOptionsInit(WPARAM, LPARAM);
diff --git a/protocols/Skype/src/skype_services.cpp b/protocols/Skype/src/skype_services.cpp index b2f50ca917..5ab0deb67f 100644 --- a/protocols/Skype/src/skype_services.cpp +++ b/protocols/Skype/src/skype_services.cpp @@ -12,6 +12,8 @@ void CSkypeProto::InitInstanceServiceList() // Chat API
this->CreateServiceObj(PS_JOINCHAT, &CSkypeProto::OnJoinChat);
this->CreateServiceObj(PS_LEAVECHAT, &CSkypeProto::OnLeaveChat);
+ // Own info
+ this->CreateServiceObj(PS_SETMYNICKNAME, &CSkypeProto::SetMyNickName);
// Avatar API
this->CreateServiceObj(PS_GETAVATARINFOT, &CSkypeProto::GetAvatarInfo);
this->CreateServiceObj(PS_GETAVATARCAPS, &CSkypeProto::GetAvatarCaps);
diff --git a/protocols/Skype/src/skype_utils.cpp b/protocols/Skype/src/skype_utils.cpp index eb5eb1e4f1..dc7c5b4abd 100644 --- a/protocols/Skype/src/skype_utils.cpp +++ b/protocols/Skype/src/skype_utils.cpp @@ -543,12 +543,9 @@ void CSkypeProto::ReplaceSpecialChars(wchar_t *text, wchar_t replaceWith) INT_PTR CSkypeProto::ParseSkypeUri(WPARAM wParam, LPARAM lParam)
{
- return 1;
if (CSkypeProto::instanceList.getCount() == 0 || !CSkypeProto::instanceList[0]->IsOnline())
return 1;
- CSkypeProto::ShowNotification((wchar_t *)lParam);
-
CSkypeProto *ppro = CSkypeProto::instanceList[0];
wchar_t *args = ::mir_wstrdup((wchar_t *)lParam);
@@ -560,49 +557,45 @@ INT_PTR CSkypeProto::ParseSkypeUri(WPARAM wParam, LPARAM lParam) if (q == NULL)
return 1;
- wchar_t *c = q + 1; q = 0;
+ wchar_t *c = q + 1; *q = 0;
+ StringList commands = StringList(c, L"&");
StringList participants = StringList(args, L";");
- StringList commands = StringList(q + 1, L"&");
-
ptrW command, arg, commandAndParam;
- if (::lstrcmpiW( commands[0], L"chat") != 0)
+ if ( !::lstrcmpiW(commands[0], L"chat"))
+ ppro->ChatRoomParseUriComands(c);
+ else
{
wchar_t message[1024];
- ::mir_sntprintf(message, SIZEOF(message), ::TranslateT("Command\"%s\" is unsupported"), args);
+ ::mir_sntprintf(message, SIZEOF(message), ::TranslateT("Command \"%s\" is unsupported"), args);
CSkypeProto::ShowNotification(message);
return 1;
}
-
- ChatRoomParam *param = new ChatRoomParam(NULL, participants, ppro);
-
- for (size_t i = 1; i < commands.size(); i++)
- {
- commandAndParam = command = ::mir_wstrdup(commands[i]);
- wchar_t * p = ::wcschr(commandAndParam, L'=');
- if (p != NULL)
- {
- arg = p + 1;
- p = 0;
- }
-
- if ( !::lstrcmpiW(commands[0], L"blob"))
- {
- ppro->JoinToChat(arg);
- break;
- }
- if ( !::lstrcmpiW( commands[0], L"topic"))
- {
- ::wcscpy(param->topic, arg);
- ppro->CreateChat(param);
- break;
-
- }
- //param
- }
-
- delete param;
+ //for (size_t i = 1; i < commands.size(); i++)
+ //{
+ // command = ::mir_wstrdup(commands[i]);
+ // wchar_t * p = ::wcschr(command, L'=');
+ // if (p != NULL)
+ // {
+ // arg = p + 1;
+ // *p = 0;
+ // }
+
+ // if ( !::lstrcmpiW(command, L"blob"))
+ // {
+ // ppro->JoinToChat(arg);
+ // break;
+ // }
+ // else if ( !::lstrcmpiW(command, L"topic") && !participants.empty())
+ // {
+ // ChatRoomParam param(NULL, participants, ppro);
+ // ::wcscpy(param.topic, arg);
+ // ppro->CreateChatRoom(¶m);
+ // break;
+ //
+ // }
+ //}
return 0;
-}
\ No newline at end of file +}
diff --git a/protocols/Skype/src/skypekit/contact.cpp b/protocols/Skype/src/skypekit/contact.cpp index 07104e8dd7..622023a040 100644 --- a/protocols/Skype/src/skypekit/contact.cpp +++ b/protocols/Skype/src/skypekit/contact.cpp @@ -27,7 +27,16 @@ SEString CContact::GetNick() if (availability == CContact::SKYPEOUT)
this->GetPropPstnnumber(result);
else
- this->GetPropFullname(result);
+ {
+ this->GetPropDisplayname(result);
+ if (this->proto && this->proto->login)
+ {
+ SEString sid;
+ this->GetIdentity(sid);
+ if (sid.equals(result))
+ this->GetPropFullname(result);
+ }
+ }
return result;
}
|