diff options
Diffstat (limited to 'meta2/settings.cpp')
-rw-r--r-- | meta2/settings.cpp | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/meta2/settings.cpp b/meta2/settings.cpp index b646d0b..cd5cf4c 100644 --- a/meta2/settings.cpp +++ b/meta2/settings.cpp @@ -14,7 +14,9 @@ int ServiceFuncRedirect(const char *service,WPARAM wParam, LPARAM lParam, Servic && strcmp(MS_DB_CONTACT_GETSETTINGSTATIC, service) != 0
&& strcmp(MS_DB_CONTACT_WRITESETTING, service) != 0
&& strcmp(MS_DB_CONTACT_DELETESETTING, service) != 0
- && strcmp(MS_DB_CONTACT_ENUMSETTINGS, service) != 0))
+ //&& strcmp(MS_DB_CONTACT_ENUMSETTINGS, service) != 0
+ )
+ )
{
return coreServiceFunc(service, wParam, lParam);
}
@@ -31,7 +33,7 @@ int ServiceFuncRedirect(const char *service,WPARAM wParam, LPARAM lParam, Servic const char *szSetting = 0, *szModule = 0;
bool read; // true for get setting, false for write setting
- if(strcmp(MS_DB_CONTACT_WRITESETTING, service) == 0 || strcmp(MS_DB_CONTACT_DELETESETTING, service)) {
+ if(strcmp(MS_DB_CONTACT_WRITESETTING, service) == 0 || strcmp(MS_DB_CONTACT_DELETESETTING, service) == 0) {
read = false;
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
szSetting = cws->szSetting;
@@ -47,7 +49,7 @@ int ServiceFuncRedirect(const char *service,WPARAM wParam, LPARAM lParam, Servic || strcmp(szModule, "Protocol") == 0
|| strcmp(szModule, "_Filter") == 0
|| (strcmp(szModule, MODULE) == 0
- && (strcmp(szSetting, "MetaID") == 0
+ && (strcmp(szSetting, META_ID) == 0
|| strcmp(szSetting, "IsSubcontact") == 0
|| strcmp(szSetting, "Default") == 0
|| strcmp(szSetting, "Handle") == 0
@@ -64,32 +66,35 @@ int ServiceFuncRedirect(const char *service,WPARAM wParam, LPARAM lParam, Servic }
HANDLE hMeta = hContact;
- int ret;
- if((ret = coreServiceFunc(service, (WPARAM)hMeta, lParam)) != 0) {
- // if the setting does not exist in the metacontact, get it from the most online subcontact
- HANDLE hSub = Meta_GetActive(hMeta);
- if(!hSub) return ret; // no most online - fail
- if((ret = coreServiceFunc(service, (WPARAM)hSub, lParam)) != 0) {
- // if it does not exist in the subcontact and we're using the meta proto module, try changing the module to the subcontact proto module
- if(strcmp(szModule, MODULE) == 0) {
- char *subProto = ContactProto(hSub);
- if(subProto) {
- if(read) {
+ HANDLE hSub = Meta_GetActive(hMeta);
+ char *subProto;
+ if(hSub == 0 || (subProto = ContactProto(hSub)) == 0) // no most online - fail
+ return coreServiceFunc(service, wParam, lParam);
+
+ int ret = 1;
+ if(read) {
+ if((ret = coreServiceFunc(service, (WPARAM)hMeta, lParam)) != 0) {
+ // if the setting does not exist in the metacontact, get it from the most online subcontact
+ if((ret = coreServiceFunc(service, (WPARAM)hSub, lParam)) != 0) {
+ // if it does not exist in the subcontact and we're using the meta proto module, try changing the module to the subcontact proto module
+ if(strcmp(szModule, MODULE) == 0) {
+ if(subProto) {
DBCONTACTGETSETTING *cgs = (DBCONTACTGETSETTING *)lParam;
- cgs->szModule = MODULE;
- } else {
- DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
- cws->szModule = MODULE;
+ cgs->szModule = subProto;
+ ret = coreServiceFunc(service, (WPARAM)hSub, lParam);
}
- return coreServiceFunc(service, (WPARAM)hSub, lParam);
- } else
- return ret; // no subcontact proto - fail
- } else
- return ret; // not reading from meta proto module - fail
- } else
- return 0; // got from subcontact
- } else
- return 0; // got from metacontact
+ }
+ }
+ }
+ } else {
+ // write to the sub
+ DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
+ if(strcmp(szModule, MODULE) == 0)
+ cws->szModule = subProto;
+ ret = coreServiceFunc(service, (WPARAM)hSub, lParam);
+ }
+
+ return ret;
}
int CallServiceRedirect(const char *service,WPARAM wParam, LPARAM lParam) {
|