diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-04-10 18:57:01 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-04-10 18:57:01 +0000 |
commit | 0ad9fe63585e924f1e840a121b477035b6e844e4 (patch) | |
tree | a19f6efb9131077970351b64dfbc96d8e08a7afe /protocols/SkypeWeb/src | |
parent | d7973b17de4eba3419a084920909c65b123c0d03 (diff) |
SkypeWeb:
- fixed login
- some code for chats
git-svn-id: http://svn.miranda-ng.org/main/trunk@12753 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src')
-rw-r--r-- | protocols/SkypeWeb/src/request_queue.cpp | 3 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_accounts.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_chatrooms.cpp | 71 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 9 |
4 files changed, 68 insertions, 17 deletions
diff --git a/protocols/SkypeWeb/src/request_queue.cpp b/protocols/SkypeWeb/src/request_queue.cpp index ac10e9c9c7..2a7e384a8f 100644 --- a/protocols/SkypeWeb/src/request_queue.cpp +++ b/protocols/SkypeWeb/src/request_queue.cpp @@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. RequestQueue::RequestQueue(HANDLE hConnection) :
hConnection(hConnection), requests(1)
{
- isTerminated = false;
+ isTerminated = true;
hRequestQueueThread = NULL;
hRequestQueueEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
}
@@ -36,6 +36,7 @@ void RequestQueue::Start() if (!isTerminated)
return;
+ isTerminated = false;
if (hRequestQueueThread == NULL)
hRequestQueueThread = mir_forkthread((pThreadFunc)&RequestQueue::WorkerThread, this);
}
diff --git a/protocols/SkypeWeb/src/skype_accounts.cpp b/protocols/SkypeWeb/src/skype_accounts.cpp index 7c86944bd9..413e745565 100644 --- a/protocols/SkypeWeb/src/skype_accounts.cpp +++ b/protocols/SkypeWeb/src/skype_accounts.cpp @@ -51,6 +51,8 @@ int CSkypeProto::OnAccountLoaded(WPARAM, LPARAM) HookProtoEvent(ME_OPT_INITIALISE, &CSkypeProto::OnOptionsInit);
HookProtoEvent(ME_MSG_PRECREATEEVENT, &CSkypeProto::OnPreCreateMessage);
+ InitGroupChatModule();
+
return 0;
}
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index b49dff041a..29be01d500 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -21,15 +21,15 @@ void CSkypeProto::InitGroupChatModule() {
GCREGISTER gcr = { sizeof(gcr) };
gcr.iMaxText = 0;
- gcr.ptszDispName = this->m_tszUserName;
- gcr.pszModule = this->m_szModuleName;
+ gcr.ptszDispName = m_tszUserName;
+ gcr.pszModule = m_szModuleName;
CallServiceSync(MS_GC_REGISTER, 0, (LPARAM)&gcr);
- //HookProtoEvent(ME_GC_EVENT, &CSkypeProto::OnGroupChatEventHook);
- //HookProtoEvent(ME_GC_BUILDMENU, &CSkypeProto::OnGroupChatMenuHook);
+ HookProtoEvent(ME_GC_EVENT, &CSkypeProto::OnGroupChatEventHook);
+ HookProtoEvent(ME_GC_BUILDMENU, &CSkypeProto::OnGroupChatMenuHook);
- //CreateProtoService(PS_JOINCHAT, &CSkypeProto::OnJoinChatRoom);
- //CreateProtoService(PS_LEAVECHAT, &CSkypeProto::OnLeaveChatRoom);
+ CreateProtoService(PS_JOINCHAT, &CSkypeProto::OnJoinChatRoom);
+ CreateProtoService(PS_LEAVECHAT, &CSkypeProto::OnLeaveChatRoom);
}
void CSkypeProto::CloseAllChatChatSessions()
@@ -93,27 +93,68 @@ MCONTACT CSkypeProto::AddChatRoom(const char *chatname) return hContact;
}
-void CSkypeProto::SetChatStatus(MCONTACT hContact, int iStatus)
+int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam)
{
- ptrT tszChatID(getTStringA(hContact, "ChatID"));
- ptrT tszNick(getTStringA(hContact, "Nick"));
+ GCHOOK *gch = (GCHOOK*)lParam;
+ if (!gch)
+ {
+ return 1;
+ }
+ else if (strcmp(gch->pDest->pszModule, m_szModuleName) != 0)
+ {
+ return 0;
+ }
+ return 0;
+}
+
+void CSkypeProto::StartChatRoom(MCONTACT hChatRoom, bool showWindow)
+{
+ ptrT tszChatID(getTStringA(hChatRoom, "ChatID"));
+ ptrT tszNick(getTStringA(hChatRoom, "Nick"));
if (tszChatID == NULL)
return;
// start chat session
- GCSESSION gcw = {0};
+ GCSESSION gcw = { 0 };
gcw.cbSize = sizeof(gcw);
gcw.iType = GCW_CHATROOM;
gcw.pszModule = m_szModuleName;
gcw.ptszName = tszNick;
- gcw.ptszID = tszChatID;
+ gcw.ptszID = tszChatID;
gcw.dwItemData = (DWORD)tszChatID;
CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
GCDEST gcd = { m_szModuleName, tszChatID, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallServiceSync(MS_GC_EVENT, true ? SESSION_INITDONE : WINDOW_HIDDEN, (LPARAM)&gce);
+ CallServiceSync(MS_GC_EVENT, showWindow ? SESSION_INITDONE : WINDOW_HIDDEN, (LPARAM)&gce);
CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
+
+}
+
+int CSkypeProto::OnGroupChatMenuHook(MCONTACT, LPARAM lParam)
+{
+ GCMENUITEMS *gcmi = (GCMENUITEMS*)lParam;
+ if (stricmp(gcmi->pszModule, m_szModuleName) != 0)
+ {
+ return 0;
+ }
+ return 0;
+}
+
+INT_PTR CSkypeProto::OnJoinChatRoom(MCONTACT hContact, LPARAM)
+{
+ if (hContact)
+ {
+ }
+ return 0;
+}
+
+INT_PTR CSkypeProto::OnLeaveChatRoom(MCONTACT hContact, LPARAM)
+{
+ if (hContact)
+ {
+ }
+ return 0;
}
/* CHAT EVENT */
@@ -129,15 +170,15 @@ void CSkypeProto::OnChatEvent(JSONNODE *node) time_t timestamp = IsoToUnixTime(composeTime);
ptrA content(mir_t2a(ptrT(json_as_string(json_get(node, "content")))));
- int emoteOffset = json_as_int(json_get(node, "skypeemoteoffset"));
+ //int emoteOffset = json_as_int(json_get(node, "skypeemoteoffset"));
ptrA conversationLink(mir_t2a(ptrT(json_as_string(json_get(node, "conversationLink")))));
ptrA chatname(ChatUrlToName(conversationLink));
ptrA topic(mir_t2a(ptrT(json_as_string(json_get(node, "threadtopic")))));
- MCONTACT chatContact = AddChatRoom(chatname);
- //SetChatStatus(chatContact, ID_STATUS_ONLINE);
+ MCONTACT hChatRoom = AddChatRoom(chatname);
+ StartChatRoom(hChatRoom);
ptrA messageType(mir_t2a(ptrT(json_as_string(json_get(node, "messagetype")))));
if (!mir_strcmpi(messageType, "Text") || !mir_strcmpi(messageType, "RichText"))
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 07acb2ec1e..4b43992e03 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -237,7 +237,14 @@ private: MCONTACT FindChatRoom(const char *chatname);
MCONTACT AddChatRoom(const char *chatname);
- void SetChatStatus(MCONTACT hContact, int iStatus);
+
+ int __cdecl OnGroupChatEventHook(WPARAM, LPARAM lParam);
+ int __cdecl OnGroupChatMenuHook(WPARAM, LPARAM lParam);
+
+ void StartChatRoom(MCONTACT hChatRoom, bool showWindow = false);
+
+ INT_PTR __cdecl OnJoinChatRoom(MCONTACT hContact, LPARAM);
+ INT_PTR __cdecl OnLeaveChatRoom(MCONTACT hContact, LPARAM);
void OnChatEvent(JSONNODE *node);
|