summaryrefslogtreecommitdiff
path: root/plugins/MirandaG15
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-07-16 21:23:06 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-07-16 21:23:06 +0300
commitcd4272ca22d47cdf673bfb0e5ec353acca3d9569 (patch)
tree0e2a4879766d8197cdf8a8fb6d5f5033399a0ea4 /plugins/MirandaG15
parentd6a052756f58211067a7a67d7e3c1dbe7e6c9465 (diff)
Contact_IsGroupChat - a helper to detect chat rooms
Diffstat (limited to 'plugins/MirandaG15')
-rw-r--r--plugins/MirandaG15/src/CAppletManager.cpp8
-rw-r--r--plugins/MirandaG15/src/CChatScreen.cpp4
-rw-r--r--plugins/MirandaG15/src/CEventScreen.cpp2
3 files changed, 7 insertions, 7 deletions
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);