summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_protocols.h8
-rw-r--r--plugins/Clist_modern/src/modern_clistsettings.cpp10
-rw-r--r--plugins/HistoryStats/src/version.h2
-rw-r--r--plugins/Import/src/import.cpp7
-rw-r--r--plugins/Import/src/import.h1
-rw-r--r--plugins/Import/src/utils.cpp7
-rw-r--r--plugins/StatusPlugins/StartupStatus/startupstatus.cpp2
-rw-r--r--plugins/StatusPlugins/commonstatus.cpp2
-rw-r--r--plugins/UserInfoEx/src/commonheaders.h7
-rw-r--r--protocols/JabberG/src/jabber_userinfo.cpp2
-rw-r--r--protocols/Tlen/src/tlen_userinfo.cpp10
-rw-r--r--src/modules/protocols/protocols.cpp4
12 files changed, 26 insertions, 36 deletions
diff --git a/include/m_protocols.h b/include/m_protocols.h
index fc21f8d9a4..a437e5aa5f 100644
--- a/include/m_protocols.h
+++ b/include/m_protocols.h
@@ -217,12 +217,16 @@ typedef struct {
#define MS_PROTO_ENUMPROTOS "Proto/EnumProtos"
// determines if a protocol module is loaded or not
-// wParam = 0
+// wParam = 0 (unused)
// lParam = (LPARAM)(const char*)szName
-// Returns a pointer to the PROTOACCOUNT if the protocol is loaded, or
+// Returns a pointer to the PROTOCOLDESCRIPTOR if the protocol is loaded, or
// NULL if it isn't.
#define MS_PROTO_ISPROTOCOLLOADED "Proto/IsProtocolLoaded"
+__forceinline PROTOCOLDESCRIPTOR* IsProtocolLoaded(const char *szProto)
+{ return (PROTOCOLDESCRIPTOR*)CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)szProto);
+}
+
// gets the network-level protocol associated with a contact
// wParam = (MCONTACT)hContact
// lParam = 0
diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp
index f53d632183..55f5438e15 100644
--- a/plugins/Clist_modern/src/modern_clistsettings.cpp
+++ b/plugins/Clist_modern/src/modern_clistsettings.cpp
@@ -34,7 +34,6 @@ static int displayNameCacheSize;
LIST<ClcCacheEntry> clistCache(50, NumericKeySortT);
-char* GetProtoForContact(MCONTACT hContact);
int GetStatusForContact(MCONTACT hContact, char *szProto);
TCHAR* UnknownConctactTranslatedName = NULL;
@@ -196,7 +195,7 @@ void cliCheckCacheItem(ClcCacheEntry *pdnce)
}
if (pdnce->m_cache_cszProto == NULL && pdnce->m_bProtoNotExists == FALSE) {
- pdnce->m_cache_cszProto = GetProtoForContact(pdnce->hContact);
+ pdnce->m_cache_cszProto = GetContactProto(pdnce->hContact);
if (pdnce->m_cache_cszProto == NULL)
pdnce->m_bProtoNotExists = FALSE;
else if (pdnce->m_cache_cszProto && pdnce->tszName)
@@ -207,7 +206,7 @@ void cliCheckCacheItem(ClcCacheEntry *pdnce)
pdnce->getName();
else if (pdnce->isUnknown && pdnce->m_cache_cszProto && pdnce->m_bProtoNotExists == TRUE && g_flag_bOnModulesLoadedCalled) {
- if (CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)pdnce->m_cache_cszProto) == 0) {
+ if (ProtoGetAccount(pdnce->m_cache_cszProto) == NULL) {
pdnce->m_bProtoNotExists = FALSE;
pdnce->getName();
}
@@ -315,11 +314,6 @@ char *GetContactCachedProtocol(MCONTACT hContact)
return NULL;
}
-char* GetProtoForContact(MCONTACT hContact)
-{
- return (char*)CallService(MS_PROTO_GETCONTACTBASEACCOUNT, hContact, 0);
-}
-
int GetStatusForContact(MCONTACT hContact, char *szProto)
{
return (szProto) ? (int)(db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE)) : ID_STATUS_OFFLINE;
diff --git a/plugins/HistoryStats/src/version.h b/plugins/HistoryStats/src/version.h
index 1e4d087498..e41151d653 100644
--- a/plugins/HistoryStats/src/version.h
+++ b/plugins/HistoryStats/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 2
#define __RELEASE_NUM 0
-#define __BUILD_NUM 3
+#define __BUILD_NUM 4
#include <stdver.h>
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp
index a7a1b89984..fc479769b2 100644
--- a/plugins/Import/src/import.cpp
+++ b/plugins/Import/src/import.cpp
@@ -482,6 +482,11 @@ bool ImportAccounts()
if (p.pa != NULL || p.szBaseProto == NULL || !mir_strcmp(p.szSrcAcc, META_PROTO))
continue;
+ if (!IsProtocolLoaded(p.szBaseProto)) {
+ AddMessage(LPGENT("Protocol %S is not loaded, skipping account %s creation"), p.szBaseProto, p.tszSrcName);
+ continue;
+ }
+
ACC_CREATE newacc;
newacc.pszBaseProto = p.szBaseProto;
newacc.pszInternal = NULL;
@@ -781,7 +786,7 @@ static MCONTACT ImportContact(MCONTACT hSrc)
return NULL;
}
- if (!IsProtocolLoaded(pda->pa->szModuleName)) {
+ if (!ProtoGetAccount(pda->pa->szModuleName)) {
AddMessage(LPGENT("Skipping contact, %S not installed."), cc->szProto);
return NULL;
}
diff --git a/plugins/Import/src/import.h b/plugins/Import/src/import.h
index 12f08d7f59..42335132e0 100644
--- a/plugins/Import/src/import.h
+++ b/plugins/Import/src/import.h
@@ -101,7 +101,6 @@ INT_PTR CALLBACK MirandaOptionsPageProc(HWND hdlg, UINT message, WPARAM wParam,
INT_PTR CALLBACK MirandaAdvOptionsPageProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK FinishedPageProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam);
-bool IsProtocolLoaded(const char* pszProtocolName);
bool IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO dbei);
int CreateGroup(const TCHAR* name, MCONTACT hContact);
diff --git a/plugins/Import/src/utils.cpp b/plugins/Import/src/utils.cpp
index 35a5406b04..de6deb1c76 100644
--- a/plugins/Import/src/utils.cpp
+++ b/plugins/Import/src/utils.cpp
@@ -23,13 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "import.h"
/////////////////////////////////////////////////////////////////////////////////////////
-
-bool IsProtocolLoaded(const char *pszProtocolName)
-{
- return CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)pszProtocolName) != 0;
-}
-
-// ------------------------------------------------
// Creates a group with a specified name in the
// Miranda contact list.
// If contact is specified adds it to group
diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp
index 95308ac959..2c2e8c9343 100644
--- a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp
+++ b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp
@@ -297,7 +297,7 @@ static int OnOkToExit(WPARAM, LPARAM)
if (!IsSuitableProto(pa))
continue;
- if (!CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)pa->szModuleName))
+ if (!ProtoGetAccount(pa->szModuleName))
continue;
char lastName[128], lastMsg[128];
diff --git a/plugins/StatusPlugins/commonstatus.cpp b/plugins/StatusPlugins/commonstatus.cpp
index 46747333a5..573ae414ae 100644
--- a/plugins/StatusPlugins/commonstatus.cpp
+++ b/plugins/StatusPlugins/commonstatus.cpp
@@ -220,7 +220,7 @@ INT_PTR SetStatusEx(WPARAM wParam, LPARAM)
// set all status messages first
for (int i = 0; i < protoList->getCount(); i++) {
char *szProto = protoSettings[i]->szName;
- if (!CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)szProto)) {
+ if (!ProtoGetAccount(szProto)) {
log_debugA("CommonStatus: %s is not loaded", szProto);
continue;
}
diff --git a/plugins/UserInfoEx/src/commonheaders.h b/plugins/UserInfoEx/src/commonheaders.h
index e4ed409e68..ca2de3e7a8 100644
--- a/plugins/UserInfoEx/src/commonheaders.h
+++ b/plugins/UserInfoEx/src/commonheaders.h
@@ -225,13 +225,10 @@ static FORCEINLINE BOOL IsProtoOnline(LPSTR pszProto)
{
return pszProto && pszProto[0] && CallProtoService(pszProto, PS_GETSTATUS, NULL, NULL) >= ID_STATUS_ONLINE;
}
-static FORCEINLINE BOOL IsProtoLoaded(LPSTR pszProto)
-{
- return (CallService(MS_PROTO_ISPROTOCOLLOADED, NULL, (LPARAM)pszProto) != NULL);
-}
+
static FORCEINLINE BOOL IsProtoAccountEnabled(PROTOACCOUNT *pAcc)
{
- return (pAcc->bIsEnabled && IsProtoLoaded(pAcc->szModuleName));
+ return (pAcc->bIsEnabled && ProtoGetAccount(pAcc->szModuleName));
}
typedef HRESULT (STDAPICALLTYPE *pfnDwmIsCompositionEnabled)(BOOL *);
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp
index 14c509c7b2..ed09582fcd 100644
--- a/protocols/JabberG/src/jabber_userinfo.cpp
+++ b/protocols/JabberG/src/jabber_userinfo.cpp
@@ -795,7 +795,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP
int CJabberProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam)
{
- if (!CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)m_szModuleName))
+ if (!ProtoGetAccount(m_szModuleName))
return 0;
MCONTACT hContact = lParam;
diff --git a/protocols/Tlen/src/tlen_userinfo.cpp b/protocols/Tlen/src/tlen_userinfo.cpp
index c0ebbcffac..80304d0ddb 100644
--- a/protocols/Tlen/src/tlen_userinfo.cpp
+++ b/protocols/Tlen/src/tlen_userinfo.cpp
@@ -113,14 +113,12 @@ static void FetchField(HWND hwndDlg, UINT idCtrl, char *fieldName, char **str, i
static void FetchCombo(HWND hwndDlg, UINT idCtrl, char *fieldName, char **str, int *strSize)
{
- int value;
- char *localFieldName;
-
if (hwndDlg == NULL || fieldName == NULL || str == NULL || strSize == NULL)
return;
- value = (int) SendDlgItemMessage(hwndDlg, idCtrl, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, idCtrl, CB_GETCURSEL, 0, 0), 0);
+
+ int value = (int) SendDlgItemMessage(hwndDlg, idCtrl, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, idCtrl, CB_GETCURSEL, 0, 0), 0);
if (value > 0) {
- if ((localFieldName=TlenTextEncode(fieldName)) != NULL) {
+ if (char *localFieldName = TlenTextEncode(fieldName)) {
TlenStringAppend(str, strSize, "<%s>%d</%s>", localFieldName, value, localFieldName);
mir_free(localFieldName);
}
@@ -129,7 +127,7 @@ static void FetchCombo(HWND hwndDlg, UINT idCtrl, char *fieldName, char **str, i
int TlenProtocol::UserInfoInit(WPARAM wParam, LPARAM lParam)
{
- if (!CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)m_szModuleName))
+ if (!ProtoGetAccount(m_szModuleName))
return 0;
MCONTACT hContact = (MCONTACT) lParam;
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp
index ed8af42f0f..bd1bd8c7c5 100644
--- a/src/modules/protocols/protocols.cpp
+++ b/src/modules/protocols/protocols.cpp
@@ -68,7 +68,7 @@ LIST<PROTOCOLDESCRIPTOR> filters(10, CompareProtos2);
void FreeFilesMatrix(TCHAR ***files);
-PROTOCOLDESCRIPTOR* __fastcall Proto_IsProtocolLoaded(const char* szProtoName)
+PROTOCOLDESCRIPTOR* __fastcall Proto_IsProtocolLoaded(const char *szProtoName)
{
if (szProtoName) {
PROTOCOLDESCRIPTOR tmp;
@@ -80,7 +80,7 @@ PROTOCOLDESCRIPTOR* __fastcall Proto_IsProtocolLoaded(const char* szProtoName)
INT_PTR srvProto_IsLoaded(WPARAM, LPARAM lParam)
{
- return (INT_PTR)Proto_GetAccount((char*)lParam);
+ return (INT_PTR)Proto_IsProtocolLoaded((char*)lParam);
}
INT_PTR Proto_EnumProtocols(WPARAM wParam, LPARAM lParam)