summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/Skype/src/skype_chat.cpp23
-rw-r--r--protocols/Skype/src/skype_contacts.cpp65
-rw-r--r--protocols/Skype/src/skype_events.cpp62
-rw-r--r--protocols/Skype/src/skype_proto.h4
4 files changed, 74 insertions, 80 deletions
diff --git a/protocols/Skype/src/skype_chat.cpp b/protocols/Skype/src/skype_chat.cpp
index 7f583d39bf..ebd8120218 100644
--- a/protocols/Skype/src/skype_chat.cpp
+++ b/protocols/Skype/src/skype_chat.cpp
@@ -148,7 +148,7 @@ void CSkypeProto::InitChat()
gcr.pColors = (COLORREF*)crCols;
gcr.ptszModuleDispName = this->m_tszUserName;
gcr.pszModule = this->m_szModuleName;
- CallServiceSync(MS_GC_REGISTER, 0, (LPARAM)&gcr);
+ ::CallServiceSync(MS_GC_REGISTER, 0, (LPARAM)&gcr);
this->HookEvent(ME_GC_EVENT, &CSkypeProto::OnGCEventHook);
this->HookEvent(ME_GC_BUILDMENU, &CSkypeProto::OnGCMenuHook);
@@ -185,15 +185,16 @@ wchar_t *CSkypeProto::StartChat(const wchar_t *cid, const SEStringList &invitedC
conversation->AddConsumers(invitedContacts);
conversation->GetPropDisplayname(data);
- TCHAR *chatName;
+ wchar_t *chatName;
if (data.length())
chatName = ::mir_utf8decodeT(data);
else
- chatName = TranslateT("New conference");
+ chatName = ::TranslateT("New conference");
GCSESSION gcw = {0};
gcw.cbSize = sizeof(gcw);
gcw.iType = GCW_CHATROOM;
+ gcw.dwFlags = GC_TCHAR;
gcw.pszModule = this->m_szModuleName;
gcw.ptszName = chatName;
gcw.ptszID = chatID;
@@ -204,10 +205,11 @@ wchar_t *CSkypeProto::StartChat(const wchar_t *cid, const SEStringList &invitedC
GCEVENT gce = {0};
gce.cbSize = sizeof(GCEVENT);
+ gce.dwFlags = GC_TCHAR;
gce.pDest = &gcd;
for (int i = 0; i < SIZEOF(CSkypeProto::Groups); i++)
{
- gce.ptszStatus = TranslateW(CSkypeProto::Groups[i]);
+ gce.ptszStatus =:: TranslateW(CSkypeProto::Groups[i]);
::CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
}
@@ -237,13 +239,14 @@ void CSkypeProto::JoinToChat(const wchar_t *cid, bool showWindow)
conversation->Join();
conversation->GetPropDisplayname(data);
- char *chatName = ::mir_utf8decodeA((const char *)data);
+ wchar_t *chatName = ::mir_utf8decodeW(data);
GCSESSION gcw = {0};
gcw.cbSize = sizeof(gcw);
gcw.iType = GCW_CHATROOM;
+ gcw.dwFlags = GC_TCHAR;
gcw.pszModule = this->m_szModuleName;
- gcw.pszName = chatName;
+ gcw.ptszName = chatName;
gcw.ptszID = chatID;
::CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
@@ -252,6 +255,7 @@ void CSkypeProto::JoinToChat(const wchar_t *cid, bool showWindow)
GCEVENT gce = {0};
gce.cbSize = sizeof(GCEVENT);
+ gce.dwFlags = GC_TCHAR;
gce.pDest = &gcd;
gcd.iType = GC_EVENT_ADDGROUP;
@@ -300,6 +304,7 @@ void CSkypeProto::LeaveChat(const wchar_t *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);
@@ -314,7 +319,7 @@ void CSkypeProto::RaiseChatEvent(const wchar_t *cid, const wchar_t *sid, int evt
HANDLE hContact = this->GetContactBySid(sid);
wchar_t *nick = hContact ?
- (wchar_t *)::CallService(MS_CLIST_GETCONTACTDISPLAYNAME, WPARAM(hContact), 0) :
+ ::mir_a2u((char *)::CallService(MS_CLIST_GETCONTACTDISPLAYNAME, WPARAM(hContact), 0)) :
snt;
GCDEST gcd = { this->m_szModuleName, { NULL }, evt };
@@ -322,7 +327,7 @@ void CSkypeProto::RaiseChatEvent(const wchar_t *cid, const wchar_t *sid, int evt
GCEVENT gce = {0};
gce.cbSize = sizeof(gce);
- gce.dwFlags = GCEF_ADDTOLOG;
+ gce.dwFlags = GCEF_ADDTOLOG | GC_TCHAR;
gce.pDest = &gcd;
gce.ptszNick = nick;
gce.ptszUID = snt;
@@ -449,7 +454,7 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam)
MAKEINTRESOURCE(IDD_CHATROOM_INVITE),
NULL,
CSkypeProto::InviteToChatProc,
- LPARAM(new InviteChatParam(chatID, NULL, this)));
+ (LPARAM)new InviteChatParam(chatID, NULL, this));
break;
case 20:
diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp
index 4e9090cbd7..c29580d1bc 100644
--- a/protocols/Skype/src/skype_contacts.cpp
+++ b/protocols/Skype/src/skype_contacts.cpp
@@ -265,37 +265,40 @@ void __cdecl CSkypeProto::LoadContactList(void*)
void __cdecl CSkypeProto::LoadChatList(void*)
{
- //CConversation::Refs conversations;
- //this->skype->GetConversationList(conversations);
- //for (uint i = 0; i < conversations.size(); i++)
- //{
- // CConversation::TYPE type;
- // conversations[i]->GetPropType(type);
-
- // CConversation::MY_STATUS status;
- // conversations[i]->GetPropMyStatus(status);
- // if (type == CConversation::CONFERENCE)
- // {
- // SEString data;
-
- // conversations[i]->GetPropIdentity(data);
- // char *cid = ::mir_strdup(data);
-
- // conversations[i]->GetPropDisplayname(data);
- // char *name = ::mir_utf8decodeA(data);
-
- // HANDLE hContact = this->AddChatRoomByID(cid, name);
- // //::DBWriteContactSettingString(hContact, this->m_szModuleName, "Nick", name);
-
- // CConversation::LOCAL_LIVESTATUS live;
- // conversations[i]->GetPropLocalLivestatus(live);
-
- // if (status == CConversation::CONSUMER)// && live != CConversation::NONE)
- // {
- // this->JoinToChat(cid, false);
- // }
- // }
- //}
+ CConversation::Refs conversations;
+ this->skype->GetConversationList(conversations);
+ for (uint i = 0; i < conversations.size(); i++)
+ {
+ CConversation::TYPE type;
+ conversations[i]->GetPropType(type);
+
+ CConversation::MY_STATUS status;
+ conversations[i]->GetPropMyStatus(status);
+ if (type == CConversation::CONFERENCE)
+ {
+ SEString data;
+
+ conversations[i]->GetPropIdentity(data);
+ wchar_t *cid = ::mir_utf8decodeW(data);
+
+ conversations[i]->GetPropDisplayname(data);
+ wchar_t *name = ::mir_utf8decodeW(data);
+
+ HANDLE hContact = this->AddChatRoomByID(cid, name);
+ //::DBWriteContactSettingString(hContact, this->m_szModuleName, "Nick", name);
+
+ ::mir_free(cid);
+ ::mir_free(name);
+
+ CConversation::LOCAL_LIVESTATUS live;
+ conversations[i]->GetPropLocalLivestatus(live);
+
+ if (status == CConversation::CONSUMER)// && live != CConversation::NONE)
+ {
+ this->JoinToChat(cid, false);
+ }
+ }
+ }
/*CConversation::Refs conversations;
this->skype->GetConversationList(conversations);
diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp
index 3b2d781ccc..55aba660ca 100644
--- a/protocols/Skype/src/skype_events.cpp
+++ b/protocols/Skype/src/skype_events.cpp
@@ -63,7 +63,7 @@ int CSkypeProto::OnMessagePreCreate(WPARAM, LPARAM lParam)
return 1;
}
-void CSkypeProto::OnMessageSended(CConversation::Ref conversation, CMessage::Ref message, CContact::Ref receiver)
+void CSkypeProto::OnMessageSended(CConversation::Ref conversation, CMessage::Ref message)
{
SEString data;
@@ -83,6 +83,13 @@ void CSkypeProto::OnMessageSended(CConversation::Ref conversation, CMessage::Ref
conversation->GetPropType(type);
if (type == CConversation::DIALOG)
{
+ CParticipant::Refs participants;
+ conversation->GetParticipants(participants, CConversation::OTHER_CONSUMERS);
+ participants[0]->GetPropIdentity(data);
+
+ CContact::Ref receiver;
+ this->skype->GetContact(data, receiver);
+
HANDLE hContact = this->AddContact(receiver);
//if (sstatus != CMessage::SENDING)
@@ -105,33 +112,25 @@ void CSkypeProto::OnMessageSended(CConversation::Ref conversation, CMessage::Ref
}
else
{
- receiver->GetIdentity(data);
- wchar_t *sid = ::mir_utf8decodeW(data);
-
conversation->GetPropIdentity(data);
wchar_t *cid = ::mir_utf8decodeW(data);
- //this->SendChatMessage(cid, sid, ::mir_utf8decodeA(text));
-
- wchar_t *nick = (wchar_t *)::db_get_wsa(NULL, this->m_szModuleName, "Nick");
+ wchar_t *nick = ::db_get_wsa(NULL, this->m_szModuleName, "Nick");
if (::wcsicmp(nick, L"") == 0)
{
- nick = sid;
+ nick = ::db_get_wsa(NULL, this->m_szModuleName, "sid");
}
- this->SendChatMessage(
- cid,
- nick,
- text);
+ this->SendChatMessage(cid, nick, text);
- ::mir_free(sid);
+ ::mir_free(nick);
::mir_free(cid);
}
::mir_free(text);
}
-void CSkypeProto::OnMessageReceived(CConversation::Ref conversation, CMessage::Ref message, CContact::Ref author)
+void CSkypeProto::OnMessageReceived(CConversation::Ref conversation, CMessage::Ref message)
{
SEString data;
@@ -148,6 +147,11 @@ void CSkypeProto::OnMessageReceived(CConversation::Ref conversation, CMessage::R
conversation->GetPropType(type);
if (type == CConversation::DIALOG)
{
+ message->GetPropAuthor(data);
+
+ CContact::Ref author;
+ this->skype->GetContact(data, author);
+
HANDLE hContact = this->AddContact(author);
SEBinary guid;
@@ -315,12 +319,6 @@ void CSkypeProto::OnMessage(CConversation::Ref conversation, CMessage::Ref messa
CMessage::TYPE messageType;
message->GetPropType(messageType);
- //CMessage::SENDING_STATUS sendingStatus;
- //message->GetPropSendingStatus(sendingStatus);
-
- //CMessage::CONSUMPTION_STATUS status;
- //message->GetPropConsumptionStatus(status);
-
switch (messageType)
{
case CMessage::POSTED_EMOTE:
@@ -329,25 +327,13 @@ void CSkypeProto::OnMessage(CConversation::Ref conversation, CMessage::Ref messa
case CMessage::POSTED_TEXT:
{
- SEString identity;
- message->GetPropAuthor(identity);
- wchar_t *sid = ::mir_utf8decodeW(identity);
- if (::wcsicmp(sid, this->login) == 0)
- {
- CParticipant::Refs participants;
- conversation->GetParticipants(participants, CConversation::OTHER_CONSUMERS);
- participants[0]->GetPropIdentity(identity);
- CContact::Ref receiver;
- this->skype->GetContact(identity, receiver);
- this->OnMessageSended(conversation, message, receiver);
- }
+ SEString author;
+ message->GetPropAuthor(author);
+
+ if (::wcsicmp(mir_ptr<wchar_t>(::mir_utf8decodeW(author)), this->login) == 0)
+ this->OnMessageSended(conversation, message);
else
- {
- CContact::Ref author;
- this->skype->GetContact(identity, author);
- this->OnMessageReceived(conversation, message, author);
- }
- ::mir_free(sid);
+ this->OnMessageReceived(conversation, message);
}
break;
diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h
index 333ba1f89e..dd3981f0d2 100644
--- a/protocols/Skype/src/skype_proto.h
+++ b/protocols/Skype/src/skype_proto.h
@@ -303,8 +303,8 @@ protected:
// messages
void OnMessage(CConversation::Ref conversation, CMessage::Ref message);
- void OnMessageSended(CConversation::Ref conversation, CMessage::Ref message, CContact::Ref receiver);
- void OnMessageReceived(CConversation::Ref conversation, CMessage::Ref message, CContact::Ref author);
+ void OnMessageSended(CConversation::Ref conversation, CMessage::Ref message);
+ void OnMessageReceived(CConversation::Ref conversation, CMessage::Ref message);
// file transfer
LIST<FileTransfer> fileTransferList;