summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/skype_db.cpp
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-04-13 16:12:52 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-04-13 16:12:52 +0000
commit122306cee52b2da3694e3e04ad139fe92def1693 (patch)
treec5768c1aed3a65f3a74d0db80ffd7e05f5676e11 /protocols/SkypeWeb/src/skype_db.cpp
parentfdc5bdfae8a4a70cfd91ec0a8554005a3c0bbae2 (diff)
SkypeWeb: code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@16643 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_db.cpp')
-rw-r--r--protocols/SkypeWeb/src/skype_db.cpp55
1 files changed, 22 insertions, 33 deletions
diff --git a/protocols/SkypeWeb/src/skype_db.cpp b/protocols/SkypeWeb/src/skype_db.cpp
index e297458ed0..91a40a5d79 100644
--- a/protocols/SkypeWeb/src/skype_db.cpp
+++ b/protocols/SkypeWeb/src/skype_db.cpp
@@ -17,6 +17,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
+struct SkypeDBType { int type; char *name; DWORD flags; } g_SkypeDBTypes[] =
+{
+ { SKYPE_DB_EVENT_TYPE_INCOMING_CALL, LPGEN("Incoming call"), DETF_NONOTIFY },
+ { SKYPE_DB_EVENT_TYPE_EDITED_MESSAGE, LPGEN("Edited message"), 0 },
+ { SKYPE_DB_EVENT_TYPE_ACTION, LPGEN("Action"), 0 },
+ { SKYPE_DB_EVENT_TYPE_CALL_INFO, LPGEN("Call information"), 0 },
+ { SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO, LPGEN("File transfer information"), 0 },
+ { SKYPE_DB_EVENT_TYPE_URIOBJ, LPGEN("URI object"), 0 },
+ { SKYPE_DB_EVENT_TYPE_MOJI, LPGEN("Moji"), 0 },
+ { SKYPE_DB_EVENT_TYPE_FILE, LPGEN("File"), 0 },
+ { SKYPE_DB_EVENT_TYPE_UNKNOWN, LPGEN("Unknown event"), 0 },
+};
+
MEVENT CSkypeProto::GetMessageFromDb(MCONTACT hContact, const char *messageId, LONGLONG timestamp)
{
if (messageId == NULL)
@@ -143,40 +156,16 @@ void CSkypeProto::InitDBEvents()
dbEventType.iconService = MODULE "/GetEventIcon";
dbEventType.textService = MODULE "/GetEventText";
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_EDITED_MESSAGE;
- dbEventType.descr = Translate("Edited message");
- CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
-
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_ACTION;
- dbEventType.descr = Translate("Action");
- CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
-
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_CALL_INFO;
- dbEventType.descr = Translate("Call information");
- CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
-
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO;
- dbEventType.descr = Translate("File transfer information");
- CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
-
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_URIOBJ;
- dbEventType.descr = Translate("URI object");
- CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
-
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_MOJI;
- dbEventType.descr = Translate("Moji");
- CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
+ for (size_t i = 0; i < _countof(g_SkypeDBTypes); i++)
+ {
+ SkypeDBType &cur = g_SkypeDBTypes[i];
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_FILE;
- dbEventType.descr = Translate("File");
- CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
+ dbEventType.eventType = cur.type;
+ dbEventType.descr = cur.name;
+ dbEventType.flags |= cur.flags;
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_UNKNOWN;
- dbEventType.descr = Translate("Unknown event");
- CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
+ CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
- dbEventType.eventType = SKYPE_DB_EVENT_TYPE_INCOMING_CALL;
- dbEventType.descr = Translate("Incoming call");
- dbEventType.flags |= DETF_NONOTIFY;
- CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
+ dbEventType.flags &= (~cur.flags);
+ }
} \ No newline at end of file