From d44364a07a1213424fe0a6b14d948b43768137df Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Wed, 6 May 2015 12:46:27 +0000 Subject: SkypeWeb: Setting for mark all messages as unread. Other fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@13459 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/SkypeWeb.vcxproj | 1 + protocols/SkypeWeb/SkypeWeb.vcxproj.filters | 4 +++ protocols/SkypeWeb/res/resource.rc | 18 +++++-------- protocols/SkypeWeb/src/requests/reg_info.h | 36 ------------------------- protocols/SkypeWeb/src/resource.h | 21 ++++++--------- protocols/SkypeWeb/src/skype_events.cpp | 38 +++++++++++++++++++++++++-- protocols/SkypeWeb/src/skype_history_sync.cpp | 10 ++++--- protocols/SkypeWeb/src/skype_options.cpp | 4 ++- protocols/SkypeWeb/src/skype_options.h | 1 + protocols/SkypeWeb/src/skype_proto.cpp | 29 -------------------- 10 files changed, 67 insertions(+), 95 deletions(-) delete mode 100644 protocols/SkypeWeb/src/requests/reg_info.h (limited to 'protocols/SkypeWeb') diff --git a/protocols/SkypeWeb/SkypeWeb.vcxproj b/protocols/SkypeWeb/SkypeWeb.vcxproj index 728211e3df..25cf16511d 100644 --- a/protocols/SkypeWeb/SkypeWeb.vcxproj +++ b/protocols/SkypeWeb/SkypeWeb.vcxproj @@ -31,6 +31,7 @@ + diff --git a/protocols/SkypeWeb/SkypeWeb.vcxproj.filters b/protocols/SkypeWeb/SkypeWeb.vcxproj.filters index cb9ede3ade..0b41c204e3 100644 --- a/protocols/SkypeWeb/SkypeWeb.vcxproj.filters +++ b/protocols/SkypeWeb/SkypeWeb.vcxproj.filters @@ -4,6 +4,10 @@ {957f1f93-0eaa-46b2-8f18-5df27d47239e} + + + {5FAEFAD1-A7C5-452F-A497-4ECA0C2D0CDA} + ico;cur;bmp;gif;jpg;jpeg diff --git a/protocols/SkypeWeb/res/resource.rc b/protocols/SkypeWeb/res/resource.rc index d5e8e40afd..a111e51824 100644 --- a/protocols/SkypeWeb/res/resource.rc +++ b/protocols/SkypeWeb/res/resource.rc @@ -29,10 +29,10 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT IDI_SKYPE ICON "Icons\\skype.ico" IDI_CONFERENCE ICON "Icons\\conference.ico" IDI_SYNCHISTORY ICON "Icons\\sync_history.ico" -IDI_BLOCKUSER ICON "Icons\\user_block.ico" -IDI_UNBLOCKUSER ICON "Icons\\user_unblock.ico" -IDI_CALL ICON "Icons\\call.ico" -IDI_NOTIFY ICON "Icons\\notify.ico" +IDI_BLOCKUSER ICON "Icons\\user_block.ico" +IDI_UNBLOCKUSER ICON "Icons\\user_unblock.ico" +IDI_CALL ICON "Icons\\call.ico" +IDI_NOTIFY ICON "Icons\\notify.ico" #endif // Нейтральный (по умолчанию) resources ///////////////////////////////////////////////////////////////////////////// @@ -170,12 +170,9 @@ BEGIN GROUPBOX "Others",IDC_STATIC,5,79,298,51 CONTROL "Automatic messages synchronization",IDC_AUTOSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,89,282,10 CONTROL "Use local time for received messages",IDC_LOCALTIME, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,99,282,10 - GROUPBOX "Mark message as read...",IDC_STATIC_MARC_AS_READ,6,132,297,38,NOT WS_VISIBLE - CONTROL "on read",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,13,142,124,10 - CONTROL "on receive",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,13,153,113,10 - CONTROL "on reply",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,146,142,122,10 - CONTROL "on typing",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,146,153,125,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,100,282,10 + CONTROL "Always notify as unread for all incoming message",IDC_MESASUREAD, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,112,209,10 END IDD_PASSWORD_EDITOR DIALOGEX 0, 0, 209, 75 @@ -207,7 +204,6 @@ BEGIN IDD_OPTIONS_MAIN, DIALOG BEGIN VERTGUIDE, 13 - VERTGUIDE, 146 HORZGUIDE, 89 HORZGUIDE, 99 HORZGUIDE, 142 diff --git a/protocols/SkypeWeb/src/requests/reg_info.h b/protocols/SkypeWeb/src/requests/reg_info.h deleted file mode 100644 index 0969be1e47..0000000000 --- a/protocols/SkypeWeb/src/requests/reg_info.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright (c) 2015 Miranda NG project (http://miranda-ng.org) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation version 2 -of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#ifndef _SKYPE_REQUEST_REGINFO_H_ -#define _SKYPE_REQUEST_REGINFO_H_ - -class GetRegInfoRequest : public HttpRequest -{ -public: - GetRegInfoRequest(const char *token, const char *server = "client-s.gateway.messenger.live.com") : - HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints", server) - { - Headers - << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("Authentication", "skypetoken=%s", token) - << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8"); - - Body << VALUE("{}"); - } -}; - -#endif //_SKYPE_REQUEST_STATUS_H_ diff --git a/protocols/SkypeWeb/src/resource.h b/protocols/SkypeWeb/src/resource.h index d997ad392a..53db7f58e7 100644 --- a/protocols/SkypeWeb/src/resource.h +++ b/protocols/SkypeWeb/src/resource.h @@ -14,21 +14,16 @@ #define IDD_GC_INVITE 112 #define IDI_CONFERENCE 114 #define IDI_SYNCHISTORY 117 -#define IDI_BLOCKUSER 118 -#define IDI_UNBLOCKUSER 119 -#define IDI_CALL 120 +#define IDI_BLOCKUSER 118 +#define IDI_UNBLOCKUSER 119 +#define IDI_CALL 120 #define IDI_NOTIFY 121 #define IDC_AUTOSYNC 1028 #define IDC_LOCALTIME 1029 -#define IDC_RADIO1 1030 -#define IDC_RADIO2 1031 -#define IDC_RADIO3 1032 -#define IDC_RADIO4 1033 -#define IDC_STATIC_MARC_AS_READ 1034 -#define IDC_CLIST 1035 -#define IDC_TITLE 1036 -#define IDC_CONTACT 1037 -#define IDC_CUSTOM1 1041 +#define IDC_CLIST 1030 +#define IDC_TITLE 1031 +#define IDC_CONTACT 1032 +#define IDC_MESASUREAD 1033 // Next default values for new objects // @@ -36,7 +31,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 122 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1042 +#define _APS_NEXT_CONTROL_VALUE 1034 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp index 44f9141e08..b9e92515f0 100644 --- a/protocols/SkypeWeb/src/skype_events.cpp +++ b/protocols/SkypeWeb/src/skype_events.cpp @@ -37,7 +37,7 @@ INT_PTR CSkypeProto::GetCallEventText(WPARAM, LPARAM lParam) return nRetVal; } -INT_PTR CSkypeProto::EventGetIcon(WPARAM wParam, LPARAM lParam) // it not work , ???? +INT_PTR CSkypeProto::EventGetIcon(WPARAM wParam, LPARAM lParam) { DBEVENTINFO* dbei = (DBEVENTINFO*)lParam; HICON icon = NULL; @@ -49,6 +49,11 @@ INT_PTR CSkypeProto::EventGetIcon(WPARAM wParam, LPARAM lParam) // it not work , icon = Skin_GetIconByHandle(GetIconHandle("inc_call")); break; } + case SKYPE_DB_EVENT_TYPE_ACTION: + { + icon = LoadSkinnedIcon(SKINICON_INFORMATION); + break; + } default: { icon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); @@ -65,6 +70,7 @@ void CSkypeProto::InitDBEvents() DBEVENTTYPEDESCR dbEventType = { sizeof(dbEventType) }; dbEventType.module = m_szModuleName; dbEventType.flags = DETF_HISTORY | DETF_MSGWINDOW; + dbEventType.iconService = MODULE"/GetEventIcon"; dbEventType.eventType = SKYPE_DB_EVENT_TYPE_ACTION; dbEventType.descr = Translate("Action"); @@ -72,8 +78,36 @@ void CSkypeProto::InitDBEvents() dbEventType.eventType = SKYPE_DB_EVENT_TYPE_INCOMING_CALL; dbEventType.descr = Translate("Incoming call"); - dbEventType.iconService = MODULE"/GetEventIcon"; dbEventType.textService = MODULE"/GetCallText"; dbEventType.flags |= DETF_NONOTIFY; CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType); +} + +void CSkypeProto::InitPopups() +{ + TCHAR desc[256]; + char name[256]; + POPUPCLASS ppc = { sizeof(ppc) }; + ppc.flags = PCF_TCHAR; + + mir_sntprintf(desc, SIZEOF(desc), _T("%s %s"), m_tszUserName, TranslateT("Calls")); + mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Call"); + ppc.ptszDescription = desc; + ppc.pszName = name; + ppc.hIcon = Skin_GetIconByHandle(GetIconHandle("inc_call")); + ppc.colorBack = RGB(255, 255, 255); + ppc.colorText = RGB(0, 0, 0); + ppc.iSeconds = 30; + ppc.PluginWindowProc = PopupDlgProcCall; + m_hPopupClassCall = Popup_RegisterClass(&ppc); + + mir_sntprintf(desc, SIZEOF(desc), _T("%s %s"), m_tszUserName, TranslateT("Notifications")); + mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Notification"); + ppc.ptszDescription = desc; + ppc.pszName = name; + ppc.hIcon = Skin_GetIconByHandle(GetIconHandle("notify")); + ppc.colorBack = RGB(255, 255, 255); + ppc.colorText = RGB(0, 0, 0); + ppc.iSeconds = 5; + m_hPopupClassNotify = Popup_RegisterClass(&ppc); } \ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index 80155e1c88..98afb8bb90 100644 --- a/protocols/SkypeWeb/src/skype_history_sync.cpp +++ b/protocols/SkypeWeb/src/skype_history_sync.cpp @@ -34,10 +34,16 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) int totalCount = json_as_int(json_get(metadata, "totalCount")); ptrA syncState(mir_t2a(ptrT(json_as_string(json_get(metadata, "syncState"))))); + bool markAllAsUnread = getByte("MarkMesUnread",0); if (totalCount >= 99 || json_size(conversations) >= 99) PushRequest(new GetHistoryOnUrlRequest(syncState, RegToken), &CSkypeProto::OnGetServerHistory); + int flags = DBEF_UTF; + + if (!markAllAsUnread) + flags |= DBEF_READ; + for (int i = json_size(conversations); i >= 0; i--) { JSONNODE *message = json_at(conversations, i); @@ -60,7 +66,6 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) { if (!mir_strcmpi(messageType, "Text") || !mir_strcmpi(messageType, "RichText")) { - int flags = DBEF_UTF | DBEF_READ; bool isMe = IsMe(skypename); if (isMe) @@ -105,7 +110,6 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) int iType = 3, iDuration = 0; ptrA skypename(ContactUrlToName(from)); bool isMe = IsMe(skypename); - int flags = DBEF_UTF | DBEF_READ; if (isMe) flags |= DBEF_SENT; HXML xml = xi.parseString(ptrT(mir_a2t(content)), 0, _T("partlist")); @@ -164,7 +168,7 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) msg.Empty(); msg.AppendFormat("%s:\n\t%s: %s\n\t%s: %d %s", Translate("File transfer"), Translate("File name"), fileName, Translate("Size"), fileSize , Translate("bytes")); - AddMessageToDb(hContact, timestamp, DBEF_UTF | DBEF_READ, clientMsgId, msg.GetBuffer()); + AddMessageToDb(hContact, timestamp, flags, clientMsgId, msg.GetBuffer()); } } diff --git a/protocols/SkypeWeb/src/skype_options.cpp b/protocols/SkypeWeb/src/skype_options.cpp index c90bc738c1..7097dc658b 100644 --- a/protocols/SkypeWeb/src/skype_options.cpp +++ b/protocols/SkypeWeb/src/skype_options.cpp @@ -23,11 +23,13 @@ CSkypeOptionsMain::CSkypeOptionsMain(CSkypeProto *proto, int idDialog) m_password(this, IDC_PASSWORD), m_group(this, IDC_GROUP), m_autosync(this, IDC_AUTOSYNC), - m_localtime(this, IDC_LOCALTIME) + m_localtime(this, IDC_LOCALTIME), + m_allasunread(this, IDC_MESASUREAD) { CreateLink(m_group, SKYPE_SETTINGS_GROUP, _T("Skype")); CreateLink(m_autosync, "AutoSync", DBVT_BYTE, 1); CreateLink(m_localtime, "UseLocalTime", DBVT_BYTE, 0); + CreateLink(m_allasunread, "MarkMesUnread", DBVT_BYTE, 0); } void CSkypeOptionsMain::OnInitDialog() diff --git a/protocols/SkypeWeb/src/skype_options.h b/protocols/SkypeWeb/src/skype_options.h index c593dc1856..f9eeea1177 100644 --- a/protocols/SkypeWeb/src/skype_options.h +++ b/protocols/SkypeWeb/src/skype_options.h @@ -26,6 +26,7 @@ private: CCtrlEdit m_group; CCtrlCheck m_autosync; CCtrlCheck m_localtime; + CCtrlCheck m_allasunread; protected: CSkypeOptionsMain(CSkypeProto *proto, int idDialog); diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 2b5131e603..e0659f175a 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -302,33 +302,4 @@ int CSkypeProto::OnPreShutdown(WPARAM, LPARAM) requestQueue->Stop(); return 0; -} - -void CSkypeProto::InitPopups() -{ - TCHAR desc[256]; - char name[256]; - POPUPCLASS ppc = { sizeof(ppc) }; - ppc.flags = PCF_TCHAR; - - mir_sntprintf(desc, SIZEOF(desc), _T("%s %s"), m_tszUserName, TranslateT("Calls")); - mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Call"); - ppc.ptszDescription = desc; - ppc.pszName = name; - ppc.hIcon = Skin_GetIconByHandle(GetIconHandle("inc_call")); - ppc.colorBack = RGB(255, 255, 255); - ppc.colorText = RGB(0, 0, 0); - ppc.iSeconds = 30; - ppc.PluginWindowProc = PopupDlgProcCall; - m_hPopupClassCall = Popup_RegisterClass(&ppc); - - mir_sntprintf(desc, SIZEOF(desc), _T("%s %s"), m_tszUserName, TranslateT("Notifications")); - mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Notification"); - ppc.ptszDescription = desc; - ppc.pszName = name; - ppc.hIcon = Skin_GetIconByHandle(GetIconHandle("notify")); - ppc.colorBack = RGB(255, 255, 255); - ppc.colorText = RGB(0, 0, 0); - ppc.iSeconds = 5; - m_hPopupClassNotify = Popup_RegisterClass(&ppc); } \ No newline at end of file -- cgit v1.2.3