summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-04-18 09:20:41 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-04-18 09:20:41 +0000
commita7a363192b99ef073bcae7dbcba5e6771dd21d09 (patch)
tree01ee8c8ebfdc68acc6b3e333ef4977bd6d3a2192 /protocols
parentb0f39d6de48a41d6fcf2d250b479d1a42954f84e (diff)
SkypeWebSkypeWeb: Chats support part 2.5.
git-svn-id: http://svn.miranda-ng.org/main/trunk@12905 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/SkypeWeb/res/resource.rc70
-rw-r--r--protocols/SkypeWeb/src/requests/history.h4
-rw-r--r--protocols/SkypeWeb/src/resource.h12
-rw-r--r--protocols/SkypeWeb/src/skype_chatrooms.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_history_sync.cpp30
5 files changed, 100 insertions, 18 deletions
diff --git a/protocols/SkypeWeb/res/resource.rc b/protocols/SkypeWeb/res/resource.rc
index a92eb55e83..09f9bbd59c 100644
--- a/protocols/SkypeWeb/res/resource.rc
+++ b/protocols/SkypeWeb/res/resource.rc
@@ -13,7 +13,7 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// Neutral (Default) resources
+// Нейтральный (по умолчанию) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD)
LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT
@@ -27,12 +27,12 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_SKYPE ICON "icons\\skype.ico"
-#endif // Neutral (Default) resources
+#endif // Нейтральный (по умолчанию) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// Russian (Russia) resources
+// Русский (Россия) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
@@ -63,12 +63,70 @@ END
#endif // APSTUDIO_INVOKED
-#endif // Russian (Russia) resources
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_GC_CREATE DIALOGEX 0, 0, 205, 254
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Create group chat"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "ОК",IDOK,96,233,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,148,233,50,14
+ CONTROL "Настраиваемый1",IDC_CLIST,"",WS_TABSTOP,7,20,191,122
+ EDITTEXT IDC_EDIT1,7,161,191,61,ES_AUTOHSCROLL
+ CTEXT "New chat's title:",IDC_STATIC,7,148,191,11
+ CTEXT "Mark users you want to invite to a new chat",IDC_STATIC,7,7,191,8
+END
+
+IDD_GC_INVITE DIALOGEX 0, 0, 220, 78
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+EXSTYLE WS_EX_TOOLWINDOW
+CAPTION "Invite user to chat"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "ОК",IDOK,108,57,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,163,57,50,14
+ COMBOBOX IDC_CONTACT,7,28,206,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ CTEXT "Choose one of your contacts to be invited:",IDC_STATIC,7,7,206,14
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_GC_CREATE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 198
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 247
+ END
+
+ IDD_GC_INVITE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 213
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 71
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+#endif // Русский (Россия) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// English resources
+// Английский resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
@@ -157,7 +215,7 @@ BEGIN
END
#endif // APSTUDIO_INVOKED
-#endif // English resources
+#endif // Английский resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/SkypeWeb/src/requests/history.h b/protocols/SkypeWeb/src/requests/history.h
index 36b97509c9..3f2d3bdf04 100644
--- a/protocols/SkypeWeb/src/requests/history.h
+++ b/protocols/SkypeWeb/src/requests/history.h
@@ -39,8 +39,8 @@ public:
class GetHistoryRequest : public HttpRequest
{
public:
- GetHistoryRequest(const char *regToken, const char *username, LONGLONG timestamp = 0, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", server, ptrA(mir_urlEncode(username)))
+ GetHistoryRequest(const char *regToken, const char *username, LONGLONG timestamp = 0, const char *server = SKYPE_ENDPOINTS_HOST, bool isChat = false) :
+ HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/conversations/%s:%s/messages", server, isChat ? "19" : "8", ptrA(mir_urlEncode(username)))
{
Url
<< INT_VALUE("startTime", timestamp)
diff --git a/protocols/SkypeWeb/src/resource.h b/protocols/SkypeWeb/src/resource.h
index b9e82b8a3c..7b9b729528 100644
--- a/protocols/SkypeWeb/src/resource.h
+++ b/protocols/SkypeWeb/src/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by e:\Projects\C++\MirandaNG\protocols\SkypeWeb\res\resource.rc
+// Used by D:\Others\SVN\MirandaNG\trunk\protocols\SkypeWeb\res\resource.rc
//
#define IDI_SKYPE 100
#define IDC_SKYPENAME 101
@@ -10,6 +10,8 @@
#define IDC_GROUP 106
#define IDD_PASSWORD_EDITOR 107
#define IDC_SAVEPERMANENTLY 108
+#define IDD_GC_CREATE 111
+#define IDD_GC_INVITE 112
#define IDC_AUTOSYNC 1028
#define IDC_LOCALTIME 1029
#define IDC_RADIO1 1030
@@ -17,14 +19,18 @@
#define IDC_RADIO3 1032
#define IDC_RADIO4 1033
#define IDC_STATIC_MARC_AS_READ 1034
+#define IDC_CLIST 1035
+#define IDC_EDIT1 1036
+#define IDC_COMBO1 1037
+#define IDC_CONTACT 1037
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 109
+#define _APS_NEXT_RESOURCE_VALUE 113
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1035
+#define _APS_NEXT_CONTROL_VALUE 1038
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp
index 0ad4479dc8..52519d2ff5 100644
--- a/protocols/SkypeWeb/src/skype_chatrooms.cpp
+++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp
@@ -138,7 +138,7 @@ void CSkypeProto::StartChatRoom(MCONTACT hChatRoom, bool showWindow)
CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gceg);
}
- PushRequest(new GetChatInfoRequest(RegToken, ptrA(mir_t2a(tszChatID)), Server), &CSkypeProto::OnGetChatInfo);
+ SendRequest(new GetChatInfoRequest(RegToken, ptrA(mir_t2a(tszChatID)), Server), &CSkypeProto::OnGetChatInfo);
}
diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp
index c95ea3521a..d8ba51cb75 100644
--- a/protocols/SkypeWeb/src/skype_history_sync.cpp
+++ b/protocols/SkypeWeb/src/skype_history_sync.cpp
@@ -81,6 +81,19 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response)
else
AddMessageToDb(hContact, timestamp, flags, clientMsgId, message, emoteOffset);
}
+ else if (conversationLink != NULL && strstr(conversationLink, "/19:"))
+ {
+ ptrA chatname(ContactUrlToName(conversationLink));
+ GCDEST gcd = { m_szModuleName, ptrT(mir_a2t(chatname)), GC_EVENT_MESSAGE };
+ GCEVENT gce = { sizeof(GCEVENT), &gcd };
+ gce.bIsMe = IsMe(ContactUrlToName(from));
+ gce.ptszUID = ptrT(mir_a2t(ContactUrlToName(from)));
+ gce.time = timestamp;
+ gce.ptszNick = ptrT(mir_a2t(ContactUrlToName(from)));
+ gce.ptszText = ptrT(mir_a2t(ptrA(RemoveHtml(content))));
+ gce.dwFlags = GCEF_NOTNOTIFY;
+ CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ }
}
}
@@ -115,14 +128,19 @@ void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response)
bool isEdited = (skypeEditedId != NULL);
char *conversationLink = mir_t2a(json_as_string(json_get(lastMessage, "conversationLink")));
time_t composeTime(IsoToUnixTime(ptrT(json_as_string(json_get(lastMessage, "conversationLink")))));
-
+ bool isChat = false;
ptrA skypename(ContactUrlToName(conversationLink));
if (skypename == NULL)
- continue;
- MCONTACT hContact = FindContact(skypename);
- if (hContact == NULL && !IsMe(skypename))
- hContact = AddContact(skypename, true);
+ {
+ skypename = ChatUrlToName(conversationLink);
+ if (skypename == NULL)
+ continue;
+ else
+ isChat = true;
+ }
+ MCONTACT hContact = !isChat ? AddContact(skypename) : AddChatRoom(skypename);
+ if (isChat) StartChatRoom(hContact);
if (GetMessageFromDb(hContact, clientMsgId, composeTime) == NULL)
- PushRequest(new GetHistoryRequest(RegToken, skypename, 0, Server), &CSkypeProto::OnGetServerHistory);
+ SendRequest(new GetHistoryRequest(RegToken, skypename, 0, Server, isChat), &CSkypeProto::OnGetServerHistory);
}
} \ No newline at end of file