diff options
Diffstat (limited to 'plugins')
40 files changed, 66 insertions, 76 deletions
diff --git a/plugins/AutoShutdown/src/watcher.cpp b/plugins/AutoShutdown/src/watcher.cpp index b7135921f4..4408aebc68 100644 --- a/plugins/AutoShutdown/src/watcher.cpp +++ b/plugins/AutoShutdown/src/watcher.cpp @@ -150,7 +150,7 @@ static BOOL CheckAllContactsOffline(void) for (auto &hContact : Contacts()) {
char *pszProto = Proto_GetBaseAccountName(hContact);
if (pszProto != nullptr && Proto_GetStatus(pszProto) != ID_STATUS_OFFLINE) {
- if (db_get_b(hContact, pszProto, "ChatRoom", 0)) continue;
+ if (Contact_IsGroupChat(hContact, pszProto)) continue;
if (db_get_w(hContact, pszProto, "Status", 0) != ID_STATUS_OFFLINE) {
if (fSmartCheck) {
if (Contact_IsHidden(hContact)) continue;
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index 907f33be39..f33df6a7f3 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -435,7 +435,7 @@ int onPrebuildContactMenu(WPARAM hContact, LPARAM) else
Menu_ModifyItem(hContactMenu, LPGENW("Enable Miss You"), iconList[2].hIcolib);
- Menu_ShowItem(hContactMenu, !db_get_b(hContact, proto, "ChatRoom", 0) && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND));
+ Menu_ShowItem(hContactMenu, !Contact_IsGroupChat(hContact, proto) && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND));
return 0;
}
@@ -460,8 +460,7 @@ int SettingChanged(WPARAM hContact, LPARAM lParam) return 0;
char *proto = Proto_GetBaseAccountName(hContact);
- if (proto == nullptr || (db_get_b(hContact, proto, "ChatRoom", 0) == 1)
- || !(CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND))
+ if (proto == nullptr || Contact_IsGroupChat(hContact, proto) || !(CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND))
return 0;
int currentStatus = inf->value.wVal;
@@ -539,7 +538,10 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) {
for (auto &hContact : Contacts()) {
char *proto = Proto_GetBaseAccountName(hContact);
- if (proto && (db_get_b(hContact, proto, "ChatRoom", 0) == 0) && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) && isContactGoneFor(hContact, options.iAbsencePeriod2) && (g_plugin.getByte(hContact, "StillAbsentNotified", 0) == 0))
+ if (proto && !Contact_IsGroupChat(hContact, proto)
+ && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND)
+ && isContactGoneFor(hContact, options.iAbsencePeriod2)
+ && (g_plugin.getByte(hContact, "StillAbsentNotified", 0) == 0))
{
g_plugin.setByte(hContact, "StillAbsentNotified", 1);
Skin_PlaySound("buddyExpectatorStillAbsent");
diff --git a/plugins/Clist_modern/src/modern_awaymsg.cpp b/plugins/Clist_modern/src/modern_awaymsg.cpp index 5674f61c45..b4f0f5f6a4 100644 --- a/plugins/Clist_modern/src/modern_awaymsg.cpp +++ b/plugins/Clist_modern/src/modern_awaymsg.cpp @@ -144,8 +144,7 @@ void amRequestAwayMsg(MCONTACT hContact) return;
//Do not re-ask for chat rooms
- char *szProto = Proto_GetBaseAccountName(hContact);
- if (szProto != nullptr && !db_get_b(hContact, szProto, "ChatRoom", 0))
+ if (!Contact_IsGroupChat(hContact))
amAddHandleToChain(hContact);
}
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index d356273e57..417ab0a97e 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1658,7 +1658,7 @@ int ClcDoProtoAck(ACKDATA *ack) if (ack->type == ACKTYPE_AWAYMSG) {
if (ack->result == ACKRESULT_SUCCESS && ack->lParam) {
if (ack->szModule != nullptr)
- if (db_get_b(ack->hContact, ack->szModule, "ChatRoom", 0) != 0)
+ if (Contact_IsGroupChat(ack->hContact, ack->szModule))
return 0;
g_plugin.setWString(ack->hContact, "StatusMsg", (const wchar_t *)ack->lParam);
@@ -1666,7 +1666,7 @@ int ClcDoProtoAck(ACKDATA *ack) }
else {
if (ack->szModule != nullptr)
- if (db_get_b(ack->hContact, ack->szModule, "ChatRoom", 0) != 0)
+ if (Contact_IsGroupChat(ack->hContact, ack->szModule))
return 0;
if (ack->hContact) {
diff --git a/plugins/Clist_modern/src/modern_clc.h b/plugins/Clist_modern/src/modern_clc.h index bfbb0e50d4..fb06744325 100644 --- a/plugins/Clist_modern/src/modern_clc.h +++ b/plugins/Clist_modern/src/modern_clc.h @@ -200,7 +200,7 @@ struct ClcContact : public ClcContactBase { return (style & CLS_CHECKBOXES && type == CLCIT_CONTACT) || (style & CLS_GROUPCHECKBOXES && type == CLCIT_GROUP) || (type == CLCIT_INFO && flags & CLCIIF_CHECKBOX);
}
__forceinline bool isChat() const
- { return (type == CLCIT_CONTACT) && (db_get_b(hContact, pce->szProto, "ChatRoom", 0) != 0);
+ { return (type == CLCIT_CONTACT) && Contact_IsGroupChat(hContact, pce->szProto);
}
};
diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index 28f3d20ea3..161ae95f0d 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -329,7 +329,7 @@ void GetExtendedInfo(ClcContact *contact, ClcData *dat) return;
p->valid = TRUE;
- p->isChatRoom = db_get_b(contact->hContact, contact->pce->szProto, "ChatRoom", 0);
+ p->isChatRoom = Contact_IsGroupChat(contact->hContact, contact->pce->szProto);
}
void LoadSkinItemToCache(TExtraCache *cEntry)
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index a90a993b80..6fbfd074c0 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -98,7 +98,7 @@ MCONTACT CImportBatch::HContactFromID(const char *pszProtoName, const char *pszS MCONTACT CImportBatch::HContactFromChatID(const char *pszProtoName, const wchar_t *pszChatID)
{
for (MCONTACT hContact = dstDb->FindFirstContact(pszProtoName); hContact; hContact = dstDb->FindNextContact(hContact, pszProtoName)) {
- if (!db_get_b(hContact, pszProtoName, "ChatRoom", 0))
+ if (!Contact_IsGroupChat(hContact, pszProtoName))
continue;
ptrW wszChatId(db_get_wsa(hContact, pszProtoName, "ChatRoomID"));
diff --git a/plugins/Import/src/stdafx.h b/plugins/Import/src/stdafx.h index ed7e5e0e23..dccb07afc5 100644 --- a/plugins/Import/src/stdafx.h +++ b/plugins/Import/src/stdafx.h @@ -36,6 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <newpluginapi.h>
#include <m_langpack.h>
#include <m_clist.h>
+#include <m_contacts.h>
#include <m_db_int.h>
#include <m_database.h>
#include <m_gui.h>
diff --git a/plugins/MirLua/src/Modules/m_message.cpp b/plugins/MirLua/src/Modules/m_message.cpp index 00b6b4c629..f4c6e80ccb 100644 --- a/plugins/MirLua/src/Modules/m_message.cpp +++ b/plugins/MirLua/src/Modules/m_message.cpp @@ -27,7 +27,7 @@ static int message_Send(lua_State *L) INT_PTR res = 1; const char *szProto = Proto_GetBaseAccountName(hContact); - if (db_get_b(hContact, szProto, "ChatRoom", 0) == TRUE) { + if (Contact_IsGroupChat(hContact, szProto)) { ptrW wszChatRoom(db_get_wsa(hContact, szProto, "ChatRoomID")); ptrW wszMessage(mir_utf8decodeW(message)); res = Chat_SendUserMessage(szProto, wszChatRoom, wszMessage); diff --git a/plugins/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/src/dbfilter.cpp index 1ef670ca47..09ca8e241d 100644 --- a/plugins/MirOTR/src/dbfilter.cpp +++ b/plugins/MirOTR/src/dbfilter.cpp @@ -57,7 +57,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam) const char *proto = Proto_GetBaseAccountName(hContact); if (!proto) return 0; - if (db_get_b(hContact, proto, "ChatRoom", 0) == 1) + if (Contact_IsGroupChat(hContact, proto)) return 0; if (mir_strcmp(proto, META_PROTO) == 0) { diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp index f593f738e9..8c607cd386 100644 --- a/plugins/MirOTR/src/options.cpp +++ b/plugins/MirOTR/src/options.cpp @@ -523,7 +523,8 @@ class CContactOptionsDlg : public CDlgBase for (auto &hContact : Contacts()) { const char *proto = Proto_GetBaseAccountName(hContact); - if (proto && db_get_b(hContact, proto, "ChatRoom", 0) == 0 && Proto_IsProtoOnContact(hContact, MODULENAME) // ignore chatrooms + if (proto && !Contact_IsGroupChat(hContact, proto) // ignore chatrooms + && Proto_IsProtoOnContact(hContact, MODULENAME) && mir_strcmp(proto, META_PROTO) != 0) // and MetaContacts { lvI.iItem = 0; diff --git a/plugins/MirOTR/src/svcs_menu.cpp b/plugins/MirOTR/src/svcs_menu.cpp index 50829b2f16..38a1129079 100644 --- a/plugins/MirOTR/src/svcs_menu.cpp +++ b/plugins/MirOTR/src/svcs_menu.cpp @@ -184,7 +184,7 @@ int SVC_PrebuildContactMenu(WPARAM hContact, LPARAM) Menu_ShowItem(hStopItem, false); const char *proto = Proto_GetBaseAccountName(hContact); - if (!proto || db_get_b(hContact, proto, "ChatRoom", 0) == 1) + if (!proto || Contact_IsGroupChat(hContact, proto)) return 0; if (proto && mir_strcmp(proto, META_PROTO) == 0) { diff --git a/plugins/MirOTR/src/svcs_srmm.cpp b/plugins/MirOTR/src/svcs_srmm.cpp index 9614e4b683..06d5cdae56 100644 --- a/plugins/MirOTR/src/svcs_srmm.cpp +++ b/plugins/MirOTR/src/svcs_srmm.cpp @@ -8,10 +8,8 @@ int SVC_IconPressed(WPARAM hContact, LPARAM lParam) StatusIconClickData *sicd = (StatusIconClickData *)lParam; if (mir_strcmp(sicd->szModule, MODULENAME) == 0) { - char *proto = Proto_GetBaseAccountName(hContact); - if (proto && db_get_b(hContact, proto, "ChatRoom", 0)) - return 0; - ShowOTRMenu(hContact, sicd->clickLocation); + if (!Contact_IsGroupChat(hContact)) + ShowOTRMenu(hContact, sicd->clickLocation); } return 0; @@ -20,8 +18,7 @@ int SVC_IconPressed(WPARAM hContact, LPARAM lParam) // set SRMM icon status, if applicable void SetEncryptionStatus(MCONTACT hContact, TrustLevel level) { - char *proto = Proto_GetBaseAccountName(hContact); - bool chat_room = (proto && db_get_b(hContact, proto, "ChatRoom", 0)); + bool chat_room = Contact_IsGroupChat(hContact); BBButton button = OTRButton; int flags1 = MBF_HIDDEN, flags2 = MBF_HIDDEN; @@ -85,13 +82,11 @@ int SVC_ButtonsBarLoaded(WPARAM, LPARAM) int SVC_ButtonsBarPressed(WPARAM w, LPARAM l) { CustomButtonClickData *cbcd = (CustomButtonClickData *)l; + if (cbcd->dwButtonId == 0 && !mir_strcmp(cbcd->pszModule, MODULENAME)) { MCONTACT hContact = (MCONTACT)w; - - char *proto = Proto_GetBaseAccountName(hContact); - if(proto && db_get_b(hContact, proto, "ChatRoom", 0)) - return 0; - ShowOTRMenu(hContact, cbcd->pt); + if (!Contact_IsGroupChat(hContact)) + ShowOTRMenu(hContact, cbcd->pt); } return 0; diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index 0de4d4de9b..0385fd5b56 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -644,7 +644,7 @@ void CAppletManager::FinishMessageJob(SMessageJob *pJob) CIRCConnection *pIRCCon = GetIRCConnection(strProto); // Only add the message to the history if the contact isn't an irc chatroom - if (!(pIRCCon && db_get_b(pJob->hContact, szProto, "ChatRoom", 0) != 0)) { + if (!(pIRCCon && Contact_IsGroupChat(pJob->hContact, szProto))) { // Add the message to the database DBEVENTINFO dbei = {}; dbei.eventType = EVENTTYPE_MESSAGE; @@ -738,7 +738,7 @@ MEVENT CAppletManager::SendMessageToContact(MCONTACT hContact, tstring strMessag CIRCConnection *pIRCCon = CAppletManager::GetInstance()->GetIRCConnection(strProto); - if (pIRCCon && db_get_b(hContact, szProto, "ChatRoom", 0) != 0) { + if (pIRCCon && Contact_IsGroupChat(hContact, szProto)) { ptrW wszNick(db_get_wsa(hContact, szProto, "Nick")); if (wszNick == NULL) return NULL; @@ -1408,7 +1408,7 @@ int CAppletManager::HookStatusChanged(WPARAM wParam, LPARAM lParam) Event.bNotification = true; Event.eType = EVENT_SIGNED_ON; - if (pIRCCon && db_get_b(Event.hContact, szProto, "ChatRoom", 0) != 0) { + if (pIRCCon && Contact_IsGroupChat(Event.hContact, szProto)) { Event.strDescription = TranslateString(L"Joined %s", strName.c_str()); DBVARIANT dbv; @@ -1426,7 +1426,7 @@ int CAppletManager::HookStatusChanged(WPARAM wParam, LPARAM lParam) Event.bNotification = true; Event.eType = EVENT_SIGNED_OFF; - if (pIRCCon && db_get_b(Event.hContact, szProto, "ChatRoom", 0) != 0) { + if (pIRCCon && Contact_IsGroupChat(Event.hContact, szProto)) { Event.strDescription = TranslateString(L"Left %s", strName.c_str()); // delete IRC-Channel history CAppletManager::GetInstance()->DeleteIRCHistory(Event.hContact); diff --git a/plugins/MirandaG15/src/CChatScreen.cpp b/plugins/MirandaG15/src/CChatScreen.cpp index 1408d787ae..26f03f5c60 100644 --- a/plugins/MirandaG15/src/CChatScreen.cpp +++ b/plugins/MirandaG15/src/CChatScreen.cpp @@ -251,7 +251,7 @@ void CChatScreen::LoadHistory() char *szProto = Proto_GetBaseAccountName(m_hContact);
- if (m_bIRCProtocol && db_get_b(m_hContact, szProto, "ChatRoom", 0) != 0) {
+ if (m_bIRCProtocol && Contact_IsGroupChat(m_hContact, szProto)) {
if (!CAppletManager::GetInstance()->IsIRCHookEnabled()) {
time_t now;
tm tm_now;
@@ -615,7 +615,7 @@ void CChatScreen::OnEventReceived(CEvent *pEvent) // contact is set to hidden
if (pEvent->iValue == 1) {
// Close the chat screen if the contact is an irc chatroom
- if (!(m_bIRCProtocol && db_get_b(pEvent->hContact, toNarrowString(m_strProto).c_str(), "ChatRoom", 0) != 0))
+ if (!(m_bIRCProtocol && Contact_IsGroupChat(pEvent->hContact, toNarrowString(m_strProto).c_str())))
break;
}
else
diff --git a/plugins/MirandaG15/src/CEventScreen.cpp b/plugins/MirandaG15/src/CEventScreen.cpp index a298db306c..ffd9989be2 100644 --- a/plugins/MirandaG15/src/CEventScreen.cpp +++ b/plugins/MirandaG15/src/CEventScreen.cpp @@ -186,7 +186,7 @@ void CEventScreen::OnLCDButtonDown(int iButton) char *szProto = Proto_GetBaseAccountName(pEntry->hContact);
CIRCConnection *pIRCCon = CAppletManager::GetInstance()->GetIRCConnection(toTstring(szProto));
- if (pIRCCon && db_get_b(pEntry->hContact, szProto, "ChatRoom", 0) != 0 && Contact_IsHidden(pEntry->hContact))
+ if (pIRCCon && Contact_IsGroupChat(pEntry->hContact, szProto) && Contact_IsHidden(pEntry->hContact))
return;
CAppletManager::GetInstance()->ActivateChatScreen(pEntry->hContact);
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index 7ee5fdfd62..bfef047802 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -478,7 +478,7 @@ int ProcessStatus(DBCONTACTWRITESETTING *cws, MCONTACT hContact) return 0;
// we don't want to be notified if new chatroom comes online
- if (db_get_b(hContact, szProto, "ChatRoom", 0) == 1)
+ if (Contact_IsGroupChat(hContact, szProto))
return 0;
uint16_t oldStatus = DBGetContactSettingRangedWord(hContact, "UserOnline", "LastStatus", ID_STATUS_OFFLINE, ID_STATUS_MIN, ID_STATUS_MAX);
diff --git a/plugins/NoHistory/src/dllmain.cpp b/plugins/NoHistory/src/dllmain.cpp index a4b580fa84..8ac0519b22 100644 --- a/plugins/NoHistory/src/dllmain.cpp +++ b/plugins/NoHistory/src/dllmain.cpp @@ -137,8 +137,7 @@ INT_PTR ServiceClear(WPARAM hContact, LPARAM) int PrebuildContactMenu(WPARAM hContact, LPARAM)
{
bool remove = g_plugin.getByte(hContact, DBSETTING_REMOVE) != 0;
- char *proto = Proto_GetBaseAccountName(hContact);
- bool chat_room = (proto && db_get_b(hContact, proto, "ChatRoom", 0) != 0);
+ bool chat_room = Contact_IsGroupChat(hContact);
if (chat_room)
Menu_ShowItem(hMenuToggle, false);
@@ -175,8 +174,7 @@ int WindowEvent(WPARAM, LPARAM lParam) break;
case MSG_WINDOW_EVT_OPEN:
- char *proto = Proto_GetBaseAccountName(hContact);
- bool chat_room = (proto && db_get_b(hContact, proto, "ChatRoom", 0) != 0);
+ bool chat_room = Contact_IsGroupChat(hContact);
int remove = g_plugin.getByte(hContact, DBSETTING_REMOVE) != 0;
for (int i = 0; i < 2; ++i)
@@ -195,9 +193,7 @@ int IconPressed(WPARAM hContact, LPARAM lParam) if (sicd->flags & MBCF_RIGHTBUTTON) return 0; // ignore right-clicks
if (mir_strcmp(sicd->szModule, MODULENAME) != 0) return 0; // not our event
- char *proto = Proto_GetBaseAccountName(hContact);
- bool chat_room = (proto && db_get_b(hContact, proto, "ChatRoom", 0) != 0);
- if (!chat_room)
+ if (!Contact_IsGroupChat(hContact))
ServiceToggle(hContact, 0);
return 0;
diff --git a/plugins/NoHistory/src/options.cpp b/plugins/NoHistory/src/options.cpp index dd613dc0ae..43b81ea040 100644 --- a/plugins/NoHistory/src/options.cpp +++ b/plugins/NoHistory/src/options.cpp @@ -64,10 +64,7 @@ class CDlgOptionsDlg : public CDlgBase void SetAllContactIcons()
{
for (auto &hContact : Contacts()) {
- char *proto = Proto_GetBaseAccountName(hContact);
- bool chat_room = (proto && db_get_b(hContact, proto, "ChatRoom", 0) != 0);
-
- if (!chat_room) {
+ if (!Contact_IsGroupChat(hContact)) {
HANDLE hItem = clist.FindContact(hContact);
if (hItem) {
bool disabled = (g_plugin.getByte(hContact, DBSETTING_REMOVE) == 1);
@@ -129,10 +126,7 @@ public: g_plugin.bEnabledForNew = clist.GetExtraImage(hItemNew, 0);
for (auto &hContact : Contacts()) {
- char *proto = Proto_GetBaseAccountName(hContact);
- bool chat_room = (proto && db_get_b(hContact, proto, "ChatRoom", 0) != 0);
-
- if (!chat_room) {
+ if (!Contact_IsGroupChat(hContact)) {
HANDLE hItem = clist.FindContact(hContact);
if (hItem) {
int iImage = clist.GetExtraImage(hItem, 0);
diff --git a/plugins/NoHistory/src/stdafx.h b/plugins/NoHistory/src/stdafx.h index 3810ddfb6c..5290f2e7ed 100644 --- a/plugins/NoHistory/src/stdafx.h +++ b/plugins/NoHistory/src/stdafx.h @@ -8,6 +8,7 @@ #include <m_database.h>
#include <m_clist.h>
#include <m_clc.h>
+#include <m_contacts.h>
#include <m_gui.h>
#include <m_langpack.h>
#include <m_protocols.h>
diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index ee2ad72b2f..2b280f6a45 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -413,10 +413,8 @@ static int ContactWindowOpen(WPARAM, LPARAM lParam) static int PrebuildContactMenu(WPARAM hContact, LPARAM)
{
char *szProto = Proto_GetBaseAccountName(hContact);
- if (szProto != nullptr) {
- bool isChat = db_get_b(hContact, szProto, "ChatRoom", false) != 0;
- NudgeShowMenu((WPARAM)szProto, !isChat);
- }
+ if (szProto != nullptr)
+ NudgeShowMenu((WPARAM)szProto, !Contact_IsGroupChat(hContact, szProto));
return 0;
}
diff --git a/plugins/Nudge/src/stdafx.h b/plugins/Nudge/src/stdafx.h index 7ba2deb812..e0cc104911 100644 --- a/plugins/Nudge/src/stdafx.h +++ b/plugins/Nudge/src/stdafx.h @@ -11,6 +11,7 @@ #include <newpluginapi.h>
#include <m_clistint.h>
+#include <m_contacts.h>
#include <m_langpack.h>
#include <m_popup.h>
#include <m_message.h>
diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index 0cfc630cee..80398f6911 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -109,7 +109,7 @@ static void PasteIt(MCONTACT hContact, int mode) else if (hContact != NULL && pasteToWeb->szFileLink[0] != 0) {
char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto && (INT_PTR)szProto != CALLSERVICE_NOTFOUND) {
- BOOL isChat = db_get_b(hContact, szProto, "ChatRoom", 0);
+ bool isChat = Contact_IsGroupChat(hContact, szProto);
if (Options::instance->autoSend) {
if (!isChat) {
DBEVENTINFO dbei = {};
@@ -323,7 +323,7 @@ static int WindowEvent(WPARAM, MessageWindowEventData* lParam) if (lParam->uType == MSG_WINDOW_EVT_OPEN) {
char *szProto = Proto_GetBaseAccountName(lParam->hContact);
if (szProto && (INT_PTR)szProto != CALLSERVICE_NOTFOUND) {
- if (db_get_b(lParam->hContact, szProto, "ChatRoom", 0)) {
+ if (Contact_IsGroupChat(lParam->hContact, szProto)) {
(*contactWindows)[lParam->hContact] = lParam->hwndInput;
}
}
diff --git a/plugins/PasteIt/src/stdafx.h b/plugins/PasteIt/src/stdafx.h index e747eb8f97..c6f05d3133 100644 --- a/plugins/PasteIt/src/stdafx.h +++ b/plugins/PasteIt/src/stdafx.h @@ -20,6 +20,7 @@ #include <newpluginapi.h>
#include <m_clist.h>
+#include <m_contacts.h>
#include <m_langpack.h>
#include <m_netlib.h>
#include <m_xml.h>
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index fbf8f9e8e0..38bb0461cb 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -297,10 +297,10 @@ static int PrebuildContactMenu(WPARAM hContact, LPARAM) bool bEnabled = false;
char *szProto = Proto_GetBaseAccountName(hContact);
- if ( szProto ) {
+ if (szProto) {
// leave this menu item hidden for chats
- if ( !db_get_b(hContact, szProto, "ChatRoom", 0))
- if ( CallProtoService( szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND)
+ if (!Contact_IsGroupChat(hContact, szProto))
+ if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND)
bEnabled = true;
}
diff --git a/plugins/SecureIM/src/crypt_check.cpp b/plugins/SecureIM/src/crypt_check.cpp index 802b82c32e..f0665d7e28 100644 --- a/plugins/SecureIM/src/crypt_check.cpp +++ b/plugins/SecureIM/src/crypt_check.cpp @@ -180,7 +180,7 @@ bool isChatRoom(MCONTACT hContact) if (!p || !p->proto || !p->proto->inspecting)
return false;
- return db_get_b(hContact, p->proto->name, "ChatRoom", 0) != 0;
+ return Contact_IsGroupChat(hContact, p->proto->name);
}
bool isFileExist(LPCSTR filename)
diff --git a/plugins/SeenPlugin/src/menu.cpp b/plugins/SeenPlugin/src/menu.cpp index fc62ca1d0f..c24345000a 100644 --- a/plugins/SeenPlugin/src/menu.cpp +++ b/plugins/SeenPlugin/src/menu.cpp @@ -37,7 +37,7 @@ INT_PTR MenuitemClicked(WPARAM hContact, LPARAM) int BuildContactMenu(WPARAM hContact, LPARAM)
{
char *szProto = Proto_GetBaseAccountName(hContact);
- if (!IsWatchedProtocol(szProto) || db_get_b(hContact, szProto, "ChatRoom", false) || !g_plugin.getByte("MenuItem", 1)) {
+ if (!IsWatchedProtocol(szProto) || Contact_IsGroupChat(hContact, szProto) || !g_plugin.getByte("MenuItem", 1)) {
Menu_ShowItem(hmenuitem, false);
return 0;
}
diff --git a/plugins/SeenPlugin/src/userinfo.cpp b/plugins/SeenPlugin/src/userinfo.cpp index 1a323a5e11..fce8288f05 100644 --- a/plugins/SeenPlugin/src/userinfo.cpp +++ b/plugins/SeenPlugin/src/userinfo.cpp @@ -63,7 +63,7 @@ struct UserinfoDlg : public CUserInfoPageDlg int UserinfoInit(WPARAM wparam, LPARAM hContact)
{
char *szProto = Proto_GetBaseAccountName(hContact);
- if (IsWatchedProtocol(szProto) && !db_get_b(hContact, szProto, "ChatRoom", false)) {
+ if (IsWatchedProtocol(szProto) && !Contact_IsGroupChat(hContact, szProto)) {
USERINFOPAGE uip = {};
uip.szTitle.a = LPGEN("Last seen");
uip.pDialog = new UserinfoDlg();
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index ee2089f5a5..1a3bee9e55 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -555,7 +555,7 @@ int UpdateValues(WPARAM hContact, LPARAM lparam) g_plugin.setByte(hContact, "Offline", 0);
}
}
- else if (hContact && IsWatchedProtocol(cws->szModule) && !db_get_b(hContact, cws->szModule, "ChatRoom", false)) {
+ else if (hContact && IsWatchedProtocol(cws->szModule) && !Contact_IsGroupChat(hContact, cws->szModule)) {
// here we will come when <User>/<module>/Status is changed or it is idle event and if <module> is watched
if (Proto_GetStatus(cws->szModule) > ID_STATUS_OFFLINE) {
mir_cslock lck(csContacts);
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index db1056c748..385f413d06 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -66,7 +66,7 @@ void CSend::SetContact(MCONTACT hContact) m_hContact = hContact; if (hContact) { m_pszProto = Proto_GetBaseAccountName(hContact); - m_ChatRoom = db_get_b(hContact, m_pszProto, "ChatRoom", 0); + m_ChatRoom = Contact_IsGroupChat(hContact, m_pszProto); } } diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index 1db150cf55..4233d5e3e6 100644 --- a/plugins/SendScreenshotPlus/src/Main.cpp +++ b/plugins/SendScreenshotPlus/src/Main.cpp @@ -138,14 +138,13 @@ INT_PTR service_SendDesktop(WPARAM wParam, LPARAM) delete frmMain; return -1; } + MCONTACT hContact = (MCONTACT)wParam; - char *pszProto = Proto_GetBaseAccountName(hContact); - bool bChatRoom = db_get_b(hContact, pszProto, "ChatRoom", 0) != 0; frmMain->m_opt_chkTimed = false; frmMain->m_opt_tabCapture = 1; frmMain->m_opt_cboxDesktop = 0; frmMain->m_opt_chkEditor = false; - frmMain->m_opt_cboxSendBy = bChatRoom ? SS_IMAGESHACK : SS_FILESEND; + frmMain->m_opt_cboxSendBy = Contact_IsGroupChat(hContact) ? SS_IMAGESHACK : SS_FILESEND; frmMain->Init(pszPath, hContact); // this method create the window hidden. mir_free(pszPath); frmMain->btnCaptureClick(); // this method will call Close() diff --git a/plugins/SimpleStatusMsg/src/awaymsg.cpp b/plugins/SimpleStatusMsg/src/awaymsg.cpp index 21e5416762..13f73b6b57 100644 --- a/plugins/SimpleStatusMsg/src/awaymsg.cpp +++ b/plugins/SimpleStatusMsg/src/awaymsg.cpp @@ -294,7 +294,7 @@ static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM) Menu_ShowItem(hAwayMsgMenuItem, false);
char *szProto = Proto_GetBaseAccountName(hContact);
- if (szProto == nullptr || db_get_b(hContact, szProto, "ChatRoom", 0))
+ if (szProto == nullptr || Contact_IsGroupChat(hContact, szProto))
return 0;
int iStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
diff --git a/plugins/SimpleStatusMsg/src/stdafx.h b/plugins/SimpleStatusMsg/src/stdafx.h index 402d93dab3..04eaf6ed1d 100644 --- a/plugins/SimpleStatusMsg/src/stdafx.h +++ b/plugins/SimpleStatusMsg/src/stdafx.h @@ -27,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include <newpluginapi.h>
#include <m_database.h>
#include <m_clistint.h>
+#include <m_contacts.h>
#include <m_skin.h>
#include <m_options.h>
#include <m_langpack.h>
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 1e495f0c33..75e9d6d680 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -502,7 +502,7 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c) return;
// don't log them if WE are logging off
- if (Proto_GetStatus(c->getProto()) == ID_STATUS_OFFLINE || db_get_b(hContact, c->getProto(), "ChatRoom", 0))
+ if (Proto_GetStatus(c->getProto()) == ID_STATUS_OFFLINE || Contact_IsGroupChat(hContact, c->getProto()))
return;
uint16_t wStatus = LOWORD(wParam);
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index 63420a6f0c..82430e9446 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -249,7 +249,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendMessage(pDlg->GetHwnd(), WM_CLOSE, 0, 1);
char *szProto = Proto_GetBaseAccountName(lParam);
- if (szProto != nullptr && db_get_b(lParam, szProto, "ChatRoom", 0))
+ if (szProto != nullptr && Contact_IsGroupChat(lParam, szProto))
ShowRoom((TContainerData*)wParam, SM_FindSessionByHCONTACT(lParam));
else
CreateNewTabForContact((TContainerData*)wParam, lParam, true, true, false);
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index b96b7b84aa..e2ec82201a 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -351,7 +351,7 @@ int CMimAPI::PrebuildContactMenu(WPARAM hContact, LPARAM) char *szProto = Proto_GetBaseAccountName(hContact); if (szProto) { // leave this menu item hidden for chats - if (!db_get_b(hContact, szProto, "ChatRoom", 0)) + if (!Contact_IsGroupChat(hContact, szProto)) if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) bEnabled = true; } diff --git a/plugins/TipperYM/src/stdafx.h b/plugins/TipperYM/src/stdafx.h index 1bc6c5d898..0d20d28662 100644 --- a/plugins/TipperYM/src/stdafx.h +++ b/plugins/TipperYM/src/stdafx.h @@ -34,6 +34,7 @@ Boston, MA 02111-1307, USA. #include <m_clistint.h>
#include <m_clc.h>
#include <m_cluiframes.h>
+#include <m_contacts.h>
#include <m_database.h>
#include <m_fontservice.h>
#include <m_icolib.h>
diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index 45e7abd4d5..7d0eda0ac3 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -67,7 +67,7 @@ bool CheckContactType(MCONTACT hContact, const DISPLAYITEM &di) char *szProto = Proto_GetBaseAccountName(hContact); if (szProto) { - if (db_get_b(hContact, szProto, "ChatRoom", 0) != 0) + if (Contact_IsGroupChat(hContact, szProto)) return di.type == DIT_CHATS; else return di.type == DIT_CONTACTS; diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp index 50903e7681..3359ce6292 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp @@ -107,7 +107,7 @@ uint8_t CExImContactBase::fromDB(MCONTACT hContact) } // unique id (for ChatRoom) - if (isChatRoom = db_get_b(_hContact, pszProto, "ChatRoom", 0)) { + if (isChatRoom = Contact_IsGroupChat(_hContact, pszProto)) { uidSetting = "ChatRoomID"; _pszUIDKey = mir_strdup(uidSetting); if (!DB::Setting::GetAsIs(_hContact, pszProto, uidSetting, &_dbvUID)) { diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp index 1eeb5e0d99..67f427d5bc 100644 --- a/plugins/Variables/src/contact.cpp +++ b/plugins/Variables/src/contact.cpp @@ -155,12 +155,12 @@ wchar_t* getContactInfoT(uint8_t type, MCONTACT hContact) break;
case CNF_UNIQUEID:
- //UID for ChatRoom
- if (db_get_b(hContact, szProto, "ChatRoom", 0) == 1)
+ // UID for ChatRoom
+ if (Contact_IsGroupChat(hContact, szProto))
if ((res = db_get_wsa(hContact, szProto, "ChatRoomID")) != nullptr)
return res;
- //UID for other contact
+ // UID for other contact
break;
}
|