diff options
author | George Hazan <george.hazan@gmail.com> | 2014-02-27 21:51:46 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-02-27 21:51:46 +0000 |
commit | 1fb0cd07fba1e8d6f9ac2ebe3b4f2e1c60acb81b (patch) | |
tree | 904c95b33e03e806aea734552281257768273a14 /plugins/TabSRMM | |
parent | a8e8aebfd4f53977873c72c2d828c2c1f505f10d (diff) |
- metacontacts are always present;
- added META_PROTO constant for mc module name;
- MS_MC_GETPROTOCOLNAME removed, because it always returns META_PROTO
git-svn-id: http://svn.miranda-ng.org/main/trunk@8319 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r-- | plugins/TabSRMM/src/contactcache.cpp | 6 | ||||
-rw-r--r-- | plugins/TabSRMM/src/container.cpp | 6 | ||||
-rw-r--r-- | plugins/TabSRMM/src/globals.cpp | 26 | ||||
-rw-r--r-- | plugins/TabSRMM/src/globals.h | 3 | ||||
-rw-r--r-- | plugins/TabSRMM/src/mim.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 2 |
6 files changed, 17 insertions, 28 deletions
diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 9076fe0499..2f9451f2ec 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -72,7 +72,7 @@ void CContactCache::initPhaseTwo() m_Valid = (m_szProto != 0 && m_szAccount != 0) ? true : false;
if (m_Valid) {
- m_isMeta = PluginConfig.bMetaEnabled && !strcmp(m_szProto, PluginConfig.szMetaName);
+ m_isMeta = PluginConfig.bMetaEnabled && !strcmp(m_szProto, META_PROTO);
m_isSubcontact = db_mc_isSub(m_hContact) != 0;
if (m_isMeta)
updateMeta(true);
@@ -531,7 +531,7 @@ CContactCache* CContactCache::getContactCache(MCONTACT hContact) */
void CContactCache::cacheUpdateMetaChanged()
{
- bool fMetaActive = (PluginConfig.g_MetaContactsAvail && PluginConfig.bMetaEnabled) ? true : false;
+ bool fMetaActive = (PluginConfig.bMetaEnabled) ? true : false;
for (int i=0; i < arContacts.getCount(); i++) {
CContactCache &c = arContacts[i];
@@ -547,7 +547,7 @@ void CContactCache::cacheUpdateMetaChanged() // reset meta contact information, if metacontacts protocol became avail
- if (fMetaActive && !strcmp(c.getProto(), PluginConfig.szMetaName))
+ if (fMetaActive && !strcmp(c.getProto(), META_PROTO))
c.resetMeta();
}
}
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 5c30455b8a..22dfafc9f1 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -2355,7 +2355,7 @@ HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg) char szTemp[50];
mir_snprintf(szTemp, sizeof(szTemp), "Protocol%d", i);
- ptrA szProtoName(db_get_sa(dat->hContact, PluginConfig.szMetaName, szTemp));
+ ptrA szProtoName(db_get_sa(dat->hContact, META_PROTO, szTemp));
if (szProtoName == NULL)
continue;
@@ -2365,10 +2365,10 @@ HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg) TCHAR *nick = NULL, *szStatusText = NULL;
MCONTACT hContact;
- if ((hContact = (MCONTACT)db_get_dw(dat->hContact, PluginConfig.szMetaName, szTemp, 0)) != 0) {
+ if ((hContact = (MCONTACT)db_get_dw(dat->hContact, META_PROTO, szTemp, 0)) != 0) {
nick = pcli->pfnGetContactDisplayName(hContact, 0);
mir_snprintf(szTemp, sizeof(szTemp), "Status%d", i);
- WORD wStatus = (WORD)db_get_w(dat->hContact, PluginConfig.szMetaName, szTemp, 0);
+ WORD wStatus = (WORD)db_get_w(dat->hContact, META_PROTO, szTemp, 0);
szStatusText = pcli->pfnGetStatusModeDescription(wStatus, 0);
}
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 1136cdab6a..8040813d7c 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -138,16 +138,7 @@ void CGlobals::reloadSystemModulesChanged() g_iButtonsBarGap = M.GetByte("ButtonsBarGap", 1);
m_hwndClist = (HWND)CallService(MS_CLUI_GETHWND, 0, 0);
- g_MetaContactsAvail = (ServiceExists(MS_MC_GETDEFAULTCONTACT) ? 1 : 0);
-
- if (g_MetaContactsAvail) {
- mir_snprintf(szMetaName, 256, "%s", (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0));
- bMetaEnabled = abs(M.GetByte(szMetaName, "Enabled", -1));
- }
- else {
- szMetaName[0] = 0;
- bMetaEnabled = 0;
- }
+ bMetaEnabled = abs(M.GetByte(META_PROTO, "Enabled", -1));
g_PopupAvail = ServiceExists(MS_POPUP_ADDPOPUP);
@@ -378,13 +369,12 @@ int CGlobals::ModulesLoaded(WPARAM wParam, LPARAM lParam) HookEvent(ME_DB_EVENT_ADDED, CMimAPI::DispatchNewEvent);
HookEvent(ME_DB_EVENT_ADDED, CMimAPI::MessageEventAdded);
- if (PluginConfig.g_MetaContactsAvail) {
- HookEvent(ME_MC_SUBCONTACTSCHANGED, MetaContactEvent);
- HookEvent(ME_MC_FORCESEND, MetaContactEvent);
- HookEvent(ME_MC_UNFORCESEND, MetaContactEvent);
- }
HookEvent(ME_FONT_RELOAD, ::FontServiceFontsChanged);
HookEvent(ME_TTB_MODULELOADED, TopToolbarLoaded);
+
+ HookEvent(ME_MC_SUBCONTACTSCHANGED, MetaContactEvent);
+ HookEvent(ME_MC_FORCESEND, MetaContactEvent);
+ HookEvent(ME_MC_UNFORCESEND, MetaContactEvent);
return 0;
}
@@ -434,8 +424,8 @@ int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam) }
if (hContact == 0 && !lstrcmpA(setting, "Enabled")) {
- if (PluginConfig.g_MetaContactsAvail && !lstrcmpA(cws->szModule, PluginConfig.szMetaName)) { // catch the disabled meta contacts
- PluginConfig.bMetaEnabled = abs(M.GetByte(PluginConfig.szMetaName, "Enabled", -1));
+ if (!lstrcmpA(cws->szModule, META_PROTO)) { // catch the disabled meta contacts
+ PluginConfig.bMetaEnabled = abs(M.GetByte(META_PROTO, "Enabled", -1));
CContactCache::cacheUpdateMetaChanged();
}
}
@@ -443,7 +433,7 @@ int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam) if (lstrcmpA(cws->szModule, "CList") && (szProto == NULL || lstrcmpA(cws->szModule, szProto)))
return 0;
- if (PluginConfig.g_MetaContactsAvail && !lstrcmpA(cws->szModule, PluginConfig.szMetaName))
+ if (!lstrcmpA(cws->szModule, META_PROTO))
if (hContact != 0 && !lstrcmpA(setting, "Nick")) // filter out this setting to avoid infinite loops while trying to obtain the most online contact
return 0;
diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index 79115baaaa..4ff6c49700 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -71,7 +71,7 @@ public: HICON g_iconOverlayDisabled, g_iconOverlayEnabled, g_iconClock;
HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand;
HBITMAP g_hbmUnknown;
- int g_MetaContactsAvail, g_SmileyAddAvail, g_WantIEView, g_PopupAvail, g_WantHPP;
+ int g_SmileyAddAvail, g_WantIEView, g_PopupAvail, g_WantHPP;
int g_FlashAvatarAvail;
HIMAGELIST g_hImageList;
HICON g_IconMsgEvent, g_IconTypingEvent, g_IconFileEvent, g_IconSend;
@@ -138,7 +138,6 @@ public: BOOL m_autoSplit;
BOOL m_FlashOnMTN;
DWORD dwThreadID;
- char szMetaName[256];
BYTE bMetaEnabled;
HANDLE m_hMessageWindowList, hUserPrefsWindowList;
HMENU m_MenuBar;
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 44c1cd65cb..c87d4aec9b 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -610,7 +610,7 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM lParam) bAllowAutoCreate = TRUE;
else {
char *szProto = GetContactProto(hContact);
- if (PluginConfig.g_MetaContactsAvail && szProto && !strcmp(szProto, (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0))) {
+ if (szProto && !strcmp(szProto, META_PROTO)) {
MCONTACT hSubconttact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
szProto = GetContactProto(hSubconttact);
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 565b685e33..8de1d4aa7e 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -3193,7 +3193,7 @@ quote_from_last: if ((isForced = M.GetDword(dat->hContact, "tabSRMM_forced", -1)) >= 0) {
char szTemp[64];
mir_snprintf(szTemp, sizeof(szTemp), "Status%d", isForced);
- if (db_get_w(dat->hContact, PluginConfig.szMetaName, szTemp, 0) == ID_STATUS_OFFLINE)
+ if (db_get_w(dat->hContact, META_PROTO, szTemp, 0) == ID_STATUS_OFFLINE)
SendMessage(hwndDlg, DM_ACTIVATETOOLTIP, IDC_MESSAGE,
(LPARAM)TranslateT("Warning: you have selected a subprotocol for sending the following messages which is currently offline"));
}
|