diff options
author | George Hazan <ghazan@miranda.im> | 2023-04-10 18:50:46 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-04-10 18:50:46 +0300 |
commit | 90ac4c689e1322b48f6ca53a0c8fff81daf73c9c (patch) | |
tree | 63e000a99864d819650634fe8a7fa8b2be0cd1d2 /protocols | |
parent | 79ac0acda98f8f7a34bde30b7720a11c04281cb4 (diff) |
code cleaning
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/JabberG/src/jabber_proto.cpp | 15 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_rc.cpp | 12 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_thread.cpp | 7 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_db.cpp | 5 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 5 | ||||
-rw-r--r-- | protocols/Steam/src/steam_proto.cpp | 5 | ||||
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 5 |
7 files changed, 19 insertions, 35 deletions
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 282672e4ea..9891bfd60f 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -402,9 +402,8 @@ MCONTACT CJabberProto::AddToListByEvent(int flags, int /*iContact*/, MEVENT hDbE {
debugLogA("AddToListByEvent");
- DB::EventInfo dbei;
- dbei.cbBlob = -1;
- if (db_event_get(hDbEvent, &dbei))
+ DB::EventInfo dbei(hDbEvent);
+ if (!dbei)
return 0;
if (mir_strcmp(dbei.szModule, m_szModuleName))
return 0;
@@ -423,9 +422,8 @@ int CJabberProto::Authorize(MEVENT hDbEvent) if (!m_bJabberOnline)
return 1;
- DB::EventInfo dbei;
- dbei.cbBlob = -1;
- if (db_event_get(hDbEvent, &dbei))
+ DB::EventInfo dbei(hDbEvent);
+ if (!dbei)
return 1;
if (dbei.eventType != EVENTTYPE_AUTHREQUEST)
return 1;
@@ -463,9 +461,8 @@ int CJabberProto::AuthDeny(MEVENT hDbEvent, const wchar_t*) debugLogA("Entering AuthDeny");
- DB::EventInfo dbei;
- dbei.cbBlob = -1;
- if (db_event_get(hDbEvent, &dbei))
+ DB::EventInfo dbei(hDbEvent);
+ if (!dbei)
return 1;
if (dbei.eventType != EVENTTYPE_AUTHREQUEST)
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index 27d389cee3..983683ec43 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -449,11 +449,8 @@ int CJabberProto::RcGetUnreadEventsCount() if (jid == nullptr) continue;
for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
- DB::EventInfo dbei;
- dbei.cbBlob = -1;
-
- int nGetTextResult = db_event_get(hDbEvent, &dbei);
- if (!nGetTextResult && dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT)) {
+ DB::EventInfo dbei(hDbEvent);
+ if (dbei && dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT)) {
ptrW szEventText(DbEvent_GetTextW(&dbei, CP_ACP));
if (szEventText)
nEventsSent++;
@@ -525,9 +522,8 @@ int CJabberProto::AdhocForwardHandler(const TiXmlElement*, CJabberIqInfo *pInfo, continue;
for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
- DB::EventInfo dbei;
- dbei.cbBlob = -1;
- if (db_event_get(hDbEvent, &dbei))
+ DB::EventInfo dbei(hDbEvent);
+ if (!dbei)
continue;
if (dbei.eventType != EVENTTYPE_MESSAGE || (dbei.flags & (DBEF_READ | DBEF_SENT)))
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 02a5bc4b28..1475657ecb 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -989,11 +989,8 @@ uint32_t JabberGetLastContactMessageTime(MCONTACT hContact) if (!hDbEvent)
return 0;
- DB::EventInfo dbei;
- if (!db_event_get(hDbEvent, &dbei))
- return dbei.timestamp;
-
- return 0;
+ DB::EventInfo dbei(hDbEvent, false);
+ return (dbei) ? dbei.timestamp : 0;
}
MCONTACT CJabberProto::CreateTemporaryContact(const char *szJid, JABBER_LIST_ITEM *chatItem)
diff --git a/protocols/SkypeWeb/src/skype_db.cpp b/protocols/SkypeWeb/src/skype_db.cpp index 8d815088d1..47a8272777 100644 --- a/protocols/SkypeWeb/src/skype_db.cpp +++ b/protocols/SkypeWeb/src/skype_db.cpp @@ -59,9 +59,8 @@ void CSkypeProto::EditEvent(MCONTACT hContact, MEVENT hEvent, const CMStringW &s {
mir_cslock lck(m_AppendMessageLock);
- DB::EventInfo dbei;
- dbei.cbBlob = -1;
- if (db_event_get(hEvent, &dbei))
+ DB::EventInfo dbei(hEvent);
+ if (!dbei)
return;
JSONNode jMsg = JSONNode::parse((char*)dbei.pBlob);
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index f146b1ebdf..b365b6a1ef 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -169,9 +169,8 @@ MCONTACT CSkypeProto::AddToListByEvent(int, int, MEVENT hDbEvent) {
debugLogA(__FUNCTION__);
- DB::EventInfo dbei;
- dbei.cbBlob = -1;
- if (db_event_get(hDbEvent, &dbei))
+ DB::EventInfo dbei(hDbEvent);
+ if (!dbei)
return NULL;
if (mir_strcmp(dbei.szModule, m_szModuleName))
return NULL;
diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index 5f42e3ebe2..f64600bfa0 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -106,9 +106,8 @@ MCONTACT CSteamProto::AddToList(int, PROTOSEARCHRESULT *psr) MCONTACT CSteamProto::AddToListByEvent(int, int, MEVENT hDbEvent)
{
- DB::EventInfo dbei;
- dbei.cbBlob = -1;
- if (db_event_get(hDbEvent, &dbei))
+ DB::EventInfo dbei(hDbEvent);
+ if (!dbei)
return 0;
if (mir_strcmp(dbei.szModule, m_szModuleName))
return 0;
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 5b5a548350..bd918b7b93 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -1770,10 +1770,7 @@ MEVENT CVkProto::GetMessageFromDb(const char *messageId, UINT ×tamp, CMStri if (!hDbEvent)
return 0;
- DB::EventInfo dbei;
- dbei.cbBlob = -1;
- db_event_get(hDbEvent, &dbei);
-
+ DB::EventInfo dbei(hDbEvent);
msg = ptrW(mir_utf8decodeW((char*)dbei.pBlob));
timestamp = dbei.timestamp;
|