diff options
author | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-07-19 10:01:41 +0000 |
---|---|---|
committer | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-07-19 10:01:41 +0000 |
commit | 492827eb82a0f7a3cacd88c82135c54a0a08825f (patch) | |
tree | f4a5df15d3413b46fc69e0b8596b99a82494fa8e /plugins/DbEditorPP/src/knownmodules.cpp | |
parent | 03e6d34e4f99ca3d907b328cf8afd8b7b8152b69 (diff) |
DbEditorPP: changed folder structure
git-svn-id: http://svn.miranda-ng.org/main/trunk@1037 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/DbEditorPP/src/knownmodules.cpp')
-rw-r--r-- | plugins/DbEditorPP/src/knownmodules.cpp | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/plugins/DbEditorPP/src/knownmodules.cpp b/plugins/DbEditorPP/src/knownmodules.cpp new file mode 100644 index 0000000000..13c4379f6b --- /dev/null +++ b/plugins/DbEditorPP/src/knownmodules.cpp @@ -0,0 +1,84 @@ +#include "headers.h"
+
+BYTE UseKnownModList;
+
+#define MAXMODS 1024
+char *KnownModules[MAXMODS];
+int KnownModulesCount = 0;
+
+INT_PTR RegisterModule(WPARAM wParam, LPARAM lParam)
+{
+ char **mods = (char**)wParam;
+ int count = lParam;
+ int i;
+ for (i=0;i<count && KnownModulesCount<MAXMODS;i++)
+ KnownModules[KnownModulesCount++] = mir_tstrdup(mods[i]);
+ return 0;
+}
+
+INT_PTR RegisterSingleModule(WPARAM wParam, LPARAM lParam)
+{
+ char *mods = (char*)wParam;
+ if (KnownModulesCount<MAXMODS)
+ KnownModules[KnownModulesCount++] = mir_tstrdup(mods);
+ return 0;
+}
+
+int IsModuleKnown(char *module)
+{
+ int i;
+
+ if (!UseKnownModList) return 1; // not using known list so all are "known"
+
+ for(i=0;i<KnownModulesCount;i++)
+ {
+ if (KnownModules[i] && !mir_strcmp(module,KnownModules[i]))
+ return 1;
+ }
+
+ return 0;
+}
+
+void FreeKnownModuleList()
+{
+ int i;
+ for(i=0;i<KnownModulesCount;i++)
+ {
+ mir_free(KnownModules[i]);
+ }
+}
+
+void doOldKnownModulesList()
+{
+ ModuleSettingLL msll;
+ struct ModSetLinkLinkItem *setting;
+ DBVARIANT dbv;
+ char *var, *temp;
+
+ if (!EnumSettings(NULL,"KnownModules", &msll)) return;
+
+ setting = msll.first;
+ while(setting)
+ {
+ if (!DBGetContactSetting(NULL,"KnownModules",setting->name,&dbv) && dbv.type == DBVT_ASCIIZ)
+ {
+ temp = (char*)mir_alloc((strlen(dbv.pszVal)+5)*sizeof(char));
+ if (!temp) break;
+ strcpy(temp,dbv.pszVal);
+ strcat(temp,",\0");
+ var = strtok(temp,", ");
+ while (var)
+ {
+ if (KnownModulesCount<MAXMODS)
+ KnownModules[KnownModulesCount++] = mir_tstrdup(var);
+ var = strtok(NULL,", ");
+ }
+ mir_free(temp);
+ }
+ DBFreeVariant(&dbv);
+ setting = (struct ModSetLinkLinkItem *)setting->next;
+ }
+ FreeModuleSettingLL(&msll);
+
+ UseKnownModList = DBGetContactSettingByte(NULL,modname,"UseKnownModList",0);
+}
|