diff options
author | George Hazan <george.hazan@gmail.com> | 2016-09-13 17:11:58 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-09-13 17:11:58 +0000 |
commit | f51995e13679a37851baef8e7f52f2d993cbc7c1 (patch) | |
tree | 25ccd03cf2dc4b897cc0dc6fcbe4cc78ddb122c7 /src | |
parent | fe1e8456d2488095f409a4f2d38b7251abdedccf (diff) |
mode old database junk to die
git-svn-id: http://svn.miranda-ng.org/main/trunk@17291 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdfile/src/filerecvdlg.cpp | 4 | ||||
-rw-r--r-- | src/core/stdmsg/src/msglog.cpp | 10 | ||||
-rw-r--r-- | src/core/stduihist/src/history.cpp | 6 | ||||
-rw-r--r-- | src/mir_app/src/dbini.cpp | 23 | ||||
-rw-r--r-- | src/mir_app/src/dbutils.cpp | 176 | ||||
-rw-r--r-- | src/mir_app/src/menu_options.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/menu_utils.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 12 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 12 | ||||
-rw-r--r-- | src/mir_app/src/modules.cpp | 11 | ||||
-rw-r--r-- | src/mir_app/src/options_ei.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/proto_accs.cpp | 4 |
12 files changed, 128 insertions, 136 deletions
diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp index 2d38df4c64..4a55490432 100644 --- a/src/core/stdfile/src/filerecvdlg.cpp +++ b/src/core/stdfile/src/filerecvdlg.cpp @@ -231,13 +231,13 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l dat->fs = cle->lParam ? (HANDLE)cle->lParam : (HANDLE)*(PDWORD)dbei.pBlob;
char *str = (char*)dbei.pBlob + 4;
- ptrW ptszFileName(DbGetEventStringT(&dbei, str));
+ ptrW ptszFileName(DbEvent_GetString(&dbei, str));
SetDlgItemText(hwndDlg, IDC_FILENAMES, ptszFileName);
unsigned len = (unsigned)mir_strlen(str) + 1;
if (len + 4 < dbei.cbBlob) {
str += len;
- ptrW pwszDescription(DbGetEventStringT(&dbei, str));
+ ptrW pwszDescription(DbEvent_GetString(&dbei, str));
SetDlgItemText(hwndDlg, IDC_MSG, pwszDescription);
}
}
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index bb813b25a2..51e8900b93 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -193,7 +193,7 @@ static char* SetToStyle(int style) int DbEventIsForMsgWindow(DBEVENTINFO *dbei)
{
- DBEVENTTYPEDESCR *et = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
+ DBEVENTTYPEDESCR *et = DbEvent_GetType(dbei->szModule, dbei->eventType);
return et && (et->flags & DETF_MSGWINDOW);
}
@@ -304,7 +304,7 @@ static char* CreateRTFFromDbEvent(SrmmWindowData *dat, MCONTACT hContact, MEVENT AppendToBufferWithRTF(buffer, szName);
AppendToBufferWithRTF(buffer, L" ");
- msg = DbGetEventTextW(&dbei, CP_ACP);
+ msg = DbEvent_GetTextW(&dbei, CP_ACP);
if (msg) {
AppendToBufferWithRTF(buffer, msg);
mir_free(msg);
@@ -316,14 +316,14 @@ static char* CreateRTFFromDbEvent(SrmmWindowData *dat, MCONTACT hContact, MEVENT char* filename = (char*)dbei.pBlob + sizeof(DWORD);
char* descr = filename + mir_strlen(filename) + 1;
- ptrW ptszFileName(DbGetEventStringT(&dbei, filename));
+ ptrW ptszFileName(DbEvent_GetString(&dbei, filename));
buffer.AppendFormat(" %s ", SetToStyle(MSGFONTID_NOTICE));
AppendToBufferWithRTF(buffer, (dbei.flags & DBEF_SENT) ? TranslateT("File sent") : TranslateT("File received"));
buffer.Append(": ");
AppendToBufferWithRTF(buffer, ptszFileName);
if (*descr != 0) {
- ptrW ptszDescr(DbGetEventStringT(&dbei, descr));
+ ptrW ptszDescr(DbEvent_GetString(&dbei, descr));
buffer.Append(" (");
AppendToBufferWithRTF(buffer, ptszDescr);
buffer.Append(")");
@@ -333,7 +333,7 @@ static char* CreateRTFFromDbEvent(SrmmWindowData *dat, MCONTACT hContact, MEVENT case EVENTTYPE_MESSAGE:
default:
- msg = DbGetEventTextW(&dbei, CP_ACP);
+ msg = DbEvent_GetTextW(&dbei, CP_ACP);
buffer.AppendFormat(" %s ", SetToStyle((dbei.eventType == EVENTTYPE_MESSAGE) ? ((dbei.flags & DBEF_SENT) ? MSGFONTID_MYMSG : MSGFONTID_YOURMSG) : MSGFONTID_NOTICE));
AppendToBufferWithRTF(buffer, msg);
mir_free(msg);
diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp index d87b602c8d..8131f4eb3d 100644 --- a/src/core/stduihist/src/history.cpp +++ b/src/core/stduihist/src/history.cpp @@ -39,7 +39,7 @@ static HGENMENU hContactMenu = 0; static void GetMessageDescription(DBEVENTINFO *dbei, wchar_t* buf, int cbBuf)
{
- wchar_t *msg = DbGetEventTextW(dbei, CP_ACP);
+ wchar_t *msg = DbEvent_GetTextW(dbei, CP_ACP);
wcsncpy(buf, msg ? msg : TranslateT("Invalid message"), cbBuf);
buf[ cbBuf-1 ] = 0;
mir_free(msg);
@@ -87,7 +87,7 @@ static void GetObjectDescription(DBEVENTINFO *dbei, wchar_t* str, int cbStr) break;
default:
- DBEVENTTYPEDESCR *et = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
+ DBEVENTTYPEDESCR *et = DbEvent_GetType(dbei->szModule, dbei->eventType);
if (et && (et->flags & DETF_HISTORY))
GetMessageDescription(dbei, str, cbStr);
else
@@ -115,7 +115,7 @@ static void GetObjectSummary(DBEVENTINFO *dbei, wchar_t* str, int cbStr) break;
default:
- DBEVENTTYPEDESCR* et = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
+ DBEVENTTYPEDESCR* et = DbEvent_GetType(dbei->szModule, dbei->eventType);
if (et && (et->flags & DETF_HISTORY)) {
pszTmp = mir_a2u(et->descr);
pszSrc = TranslateW(pszTmp);
diff --git a/src/mir_app/src/dbini.cpp b/src/mir_app/src/dbini.cpp index 8c1c4f6c97..8239b448e2 100644 --- a/src/mir_app/src/dbini.cpp +++ b/src/mir_app/src/dbini.cpp @@ -110,7 +110,8 @@ static bool IsInSpaceSeparatedList(const char *szWord, const char *szList) }
}
-struct warnSettingChangeInfo_t {
+struct warnSettingChangeInfo_t
+{
wchar_t *szIniPath;
char *szSection;
char *szSafeSections;
@@ -362,7 +363,7 @@ LBL_NewLine: if (szLine[1] == '?') {
DBCONTACTENUMSETTINGS dbces;
dbces.pfnEnumProc = SettingsEnumProc;
- mir_strncpy(szSection, szLine+2, min(sizeof(szSection), (int)(szEnd-szLine-1)));
+ mir_strncpy(szSection, szLine + 2, min(sizeof(szSection), (int)(szEnd - szLine - 1)));
dbces.szModule = szSection;
dbces.ofsSettings = 0;
CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
@@ -387,7 +388,7 @@ LBL_NewLine: continue;
char szName[128];
- mir_strncpy(szName, szLine, min(sizeof(szName), (int)(szValue-szLine+1)));
+ mir_strncpy(szName, szLine, min(sizeof(szName), (int)(szValue - szLine + 1)));
szValue++;
{
warnSettingChangeInfo_t warnInfo;
@@ -411,15 +412,15 @@ LBL_NewLine: switch (szValue[0]) {
case 'b':
case 'B':
- db_set_b(NULL, szSection, szName, (BYTE)strtol(szValue+1, NULL, 0));
+ db_set_b(NULL, szSection, szName, (BYTE)strtol(szValue + 1, NULL, 0));
break;
case 'w':
case 'W':
- db_set_w(NULL, szSection, szName, (WORD)strtol(szValue+1, NULL, 0));
+ db_set_w(NULL, szSection, szName, (WORD)strtol(szValue + 1, NULL, 0));
break;
case 'd':
case 'D':
- db_set_dw(NULL, szSection, szName, (DWORD)strtoul(szValue+1, NULL, 0));
+ db_set_dw(NULL, szSection, szName, (DWORD)strtoul(szValue + 1, NULL, 0));
break;
case 'l':
case 'L':
@@ -442,10 +443,10 @@ LBL_NewLine: break;
case 'e':
case 'E':
- ConvertBackslashes(szValue+1, Langpack_GetDefaultCodePage());
+ ConvertBackslashes(szValue + 1, Langpack_GetDefaultCodePage());
case 's':
case 'S':
- db_set_s(NULL, szSection, szName, szValue+1);
+ db_set_s(NULL, szSection, szName, szValue + 1);
break;
case 'g':
case 'G':
@@ -589,14 +590,12 @@ static void DoAutoExec(void) mir_wstrcat(szNewPath, fd.cFileName);
MoveFile(szIniPath, szNewPath);
}
- else if (!mir_wstrcmpi(szOnCompletion, L"ask"))
- {
+ else if (!mir_wstrcmpi(szOnCompletion, L"ask")) {
CIniImportDoneDlg dlg(szIniPath);
dlg.DoModal();
}
}
- }
- while (FindNextFile(hFind, &fd));
+ } while (FindNextFile(hFind, &fd));
FindClose(hFind);
}
diff --git a/src/mir_app/src/dbutils.cpp b/src/mir_app/src/dbutils.cpp index a8003bec86..155851a2e5 100644 --- a/src/mir_app/src/dbutils.cpp +++ b/src/mir_app/src/dbutils.cpp @@ -36,11 +36,22 @@ static int CompareEventTypes(const DBEVENTTYPEDESCR *p1, const DBEVENTTYPEDESCR static LIST<DBEVENTTYPEDESCR> eventTypes(10, CompareEventTypes);
-static BOOL bModuleInitialized = FALSE;
+void UnloadEventsModule()
+{
+ for (int i = 0; i < eventTypes.getCount(); i++) {
+ DBEVENTTYPEDESCR *p = eventTypes[i];
+ mir_free(p->module);
+ mir_free(p->descr);
+ mir_free(p->textService);
+ mir_free(p->iconService);
+ mir_free(p);
+ }
+}
-static INT_PTR DbEventTypeRegister(WPARAM, LPARAM lParam)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+MIR_APP_DLL(int) DbEvent_RegisterType(DBEVENTTYPEDESCR *et)
{
- DBEVENTTYPEDESCR *et = (DBEVENTTYPEDESCR*)lParam;
if (et == NULL || et->cbSize != sizeof(DBEVENTTYPEDESCR))
return -1;
@@ -73,12 +84,12 @@ static INT_PTR DbEventTypeRegister(WPARAM, LPARAM lParam) return 0;
}
-static INT_PTR DbEventTypeGet(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(DBEVENTTYPEDESCR*) DbEvent_GetType(const char *szModule, int eventType)
{
DBEVENTTYPEDESCR tmp;
- tmp.module = (char*)wParam;
- tmp.eventType = lParam;
- return (INT_PTR)eventTypes.find(&tmp);
+ tmp.module = (char*)szModule;
+ tmp.eventType = eventType;
+ return eventTypes.find(&tmp);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -90,19 +101,14 @@ static wchar_t* getEventString(DBEVENTINFO *dbei, LPSTR &buf) return (dbei->flags & DBEF_UTF) ? Utf8DecodeT(in) : mir_a2u(in);
}
-static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam)
+static INT_PTR DbEventGetTextWorker(DBEVENTINFO *dbei, int codepage, int datatype)
{
- DBEVENTGETTEXT* egt = (DBEVENTGETTEXT*)lParam;
- if (egt == NULL)
- return 0;
-
- DBEVENTINFO *dbei = egt->dbei;
if (dbei == NULL || dbei->szModule == NULL || dbei->cbSize != sizeof(DBEVENTINFO))
return 0;
- DBEVENTTYPEDESCR *et = (DBEVENTTYPEDESCR*)DbEventTypeGet((WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
+ DBEVENTTYPEDESCR *et = DbEvent_GetType(dbei->szModule, dbei->eventType);
if (et && ServiceExists(et->textService))
- return CallService(et->textService, wParam, lParam);
+ return CallService(et->textService, (WPARAM)dbei, datatype);
if (!dbei->pBlob)
return 0;
@@ -143,7 +149,7 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) }
else text.Format(TranslateT("You were added by %s%s"),
(tszNick == NULL) ? cli.pfnGetContactDisplayName(hContact, 0) : tszNick, nick);
- return (egt->datatype == DBVT_WCHAR) ? (INT_PTR)mir_wstrdup(text) : (INT_PTR)mir_u2a(text);
+ return (datatype == DBVT_WCHAR) ? (INT_PTR)mir_wstrdup(text) : (INT_PTR)mir_u2a(text);
}
if (dbei->eventType == EVENTTYPE_CONTACTS) {
@@ -158,7 +164,7 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) if (tszUin && *tszUin)
text.AppendFormat(L"<%s>; ", tszUin);
}
- return (egt->datatype == DBVT_WCHAR) ? (INT_PTR)mir_wstrdup(text) : (INT_PTR)mir_u2a(text);
+ return (datatype == DBVT_WCHAR) ? (INT_PTR)mir_wstrdup(text) : (INT_PTR)mir_u2a(text);
}
if (dbei->eventType == EVENTTYPE_FILE) {
@@ -166,7 +172,7 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) ptrW tszFileName(getEventString(dbei, buf));
ptrW tszDescription(getEventString(dbei, buf));
ptrW &ptszText = (mir_wstrlen(tszDescription) == 0) ? tszFileName : tszDescription;
- switch (egt->datatype) {
+ switch (datatype) {
case DBVT_WCHAR:
return (INT_PTR)ptszText.detach();
case DBVT_ASCIIZ:
@@ -176,42 +182,53 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) }
// by default treat an event's blob as a string
- if (egt->datatype == DBVT_WCHAR) {
+ if (datatype == DBVT_WCHAR) {
char *str = (char*)alloca(dbei->cbBlob + 1);
memcpy(str, dbei->pBlob, dbei->cbBlob);
str[dbei->cbBlob] = 0;
if (dbei->flags & DBEF_UTF) {
WCHAR *msg = NULL;
- Utf8DecodeCP(str, egt->codepage, &msg);
+ Utf8DecodeCP(str, codepage, &msg);
if (msg)
return (INT_PTR)msg;
}
- return (INT_PTR)mir_a2u_cp(str, egt->codepage);
+ return (INT_PTR)mir_a2u_cp(str, codepage);
}
- if (egt->datatype == DBVT_ASCIIZ) {
+ if (datatype == DBVT_ASCIIZ) {
char *msg = mir_strdup((char*)dbei->pBlob);
if (dbei->flags & DBEF_UTF)
- Utf8DecodeCP(msg, egt->codepage, NULL);
+ Utf8DecodeCP(msg, codepage, NULL);
return (INT_PTR)msg;
}
return 0;
}
-static INT_PTR DbEventGetIcon(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(char*) DbEvent_GetTextA(DBEVENTINFO *dbei, int codepage)
{
- DBEVENTINFO* dbei = (DBEVENTINFO*)lParam;
- HICON icon = NULL;
- DBEVENTTYPEDESCR* et = (DBEVENTTYPEDESCR*)DbEventTypeGet((WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
+ return (char*)DbEventGetTextWorker(dbei, codepage, DBVT_ASCIIZ);
+}
+
+MIR_APP_DLL(wchar_t*) DbEvent_GetTextW(DBEVENTINFO *dbei, int codepage)
+{
+ return (wchar_t*)DbEventGetTextWorker(dbei, codepage, DBVT_WCHAR);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+MIR_APP_DLL(HICON) DbEvent_GetIcon(DBEVENTINFO *dbei, int flags)
+{
+ DBEVENTTYPEDESCR *et = DbEvent_GetType(dbei->szModule, dbei->eventType);
if (et && ServiceExists(et->iconService)) {
- icon = (HICON)CallService(et->iconService, wParam, lParam);
+ HICON icon = (HICON)CallService(et->iconService, (WPARAM)dbei, flags);
if (icon)
- return (INT_PTR)icon;
+ return icon;
}
+
+ HICON icon = NULL;
if (et && et->eventIcon)
icon = IcoLib_GetIconByHandle(et->eventIcon);
if (!icon) {
@@ -236,18 +253,17 @@ static INT_PTR DbEventGetIcon(WPARAM wParam, LPARAM lParam) }
}
- return (INT_PTR)((wParam & LR_SHARED) ? icon : CopyIcon(icon));
+ return (flags & LR_SHARED) ? icon : CopyIcon(icon);
}
-static INT_PTR DbEventGetStringT(WPARAM wParam, LPARAM lParam)
-{
- DBEVENTINFO* dbei = (DBEVENTINFO*)wParam;
- char *string = (char*)lParam;
+/////////////////////////////////////////////////////////////////////////////////////////
+MIR_APP_DLL(wchar_t*) DbEvent_GetString(DBEVENTINFO *dbei, const char *str)
+{
if (dbei->flags & DBEF_UTF)
- return (INT_PTR)Utf8DecodeW(string);
+ return Utf8DecodeW(str);
- return (INT_PTR)mir_a2u(string);
+ return mir_a2u(str);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -259,109 +275,67 @@ static int sttEnumVars(const char *szVarName, LPARAM lParam) return 0;
}
-static INT_PTR DbDeleteModule(WPARAM hContact, LPARAM lParam)
+MIR_APP_DLL(int) DbModule_Delete(MCONTACT hContact, const char *szModuleName)
{
LIST<char> vars(20);
DBCONTACTENUMSETTINGS dbces = { 0 };
dbces.pfnEnumProc = sttEnumVars;
dbces.lParam = (LPARAM)&vars;
- dbces.szModule = (char*)lParam;
+ dbces.szModule = (char*)szModuleName;
CallService(MS_DB_CONTACT_ENUMSETTINGS, hContact, (LPARAM)&dbces);
for (int i = vars.getCount()-1; i >= 0; i--) {
- db_unset(hContact, (char*)lParam, vars[i]);
+ db_unset(hContact, szModuleName, vars[i]);
mir_free(vars[i]);
}
return 0;
}
-static INT_PTR GetProfilePath(WPARAM wParam, LPARAM lParam)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+MIR_APP_DLL(int) Profile_GetPathA(size_t cbLen, char *pszDest)
{
- if (!wParam || !lParam)
+ if (!pszDest || !cbLen)
return 1;
- char *dst = (char*)lParam;
- strncpy(dst, _T2A(g_profileDir), wParam);
- dst[wParam-1] = 0;
+ strncpy_s(pszDest, cbLen, _T2A(g_profileDir), _TRUNCATE);
return 0;
}
-static INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(int) Profile_GetPathW(size_t cbLen, wchar_t *pwszDest)
{
- if (!wParam || !lParam)
+ if (!pwszDest || !cbLen)
return 1;
- char *dst = (char*)lParam;
-
- char *tmp = makeFileName(g_profileName);
- strncpy(dst, tmp, wParam);
- mir_free(tmp);
-
- dst[wParam-1] = 0;
+ wcsncpy_s(pwszDest, cbLen, g_profileDir, _TRUNCATE);
return 0;
}
-static INT_PTR GetProfilePathW(WPARAM wParam, LPARAM lParam)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+MIR_APP_DLL(int) Profile_GetNameA(size_t cbLen, char *pszDest)
{
- if (!wParam || !lParam)
+ if (!cbLen || !pszDest)
return 1;
- wchar_t *dst = (wchar_t*)lParam;
- wcsncpy(dst, g_profileDir, wParam);
- dst[wParam-1] = 0;
+ strncpy_s(pszDest, cbLen, ptrA(makeFileName(g_profileName)), _TRUNCATE);
return 0;
}
-static INT_PTR GetProfileNameW(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(int) Profile_GetNameW(size_t cbLen, wchar_t *pwszDest)
{
- wchar_t *dst = (wchar_t*)lParam;
- wcsncpy(dst, g_profileName, wParam);
- dst[wParam-1] = 0;
- return 0;
-}
+ if (!cbLen || !pwszDest)
+ return 1;
-static INT_PTR SetDefaultProfile(WPARAM wParam, LPARAM)
-{
- extern wchar_t* g_defaultProfile;
- replaceStrW(g_defaultProfile, (wchar_t*)wParam);
+ wcsncpy_s(pwszDest, cbLen, g_profileName, _TRUNCATE);
return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
-int LoadEventsModule()
-{
- bModuleInitialized = TRUE;
-
- CreateServiceFunction(MS_DB_EVENT_REGISTERTYPE, DbEventTypeRegister);
- CreateServiceFunction(MS_DB_EVENT_GETTYPE, DbEventTypeGet);
- CreateServiceFunction(MS_DB_EVENT_GETTEXT, DbEventGetText);
- CreateServiceFunction(MS_DB_EVENT_GETICON, DbEventGetIcon);
- CreateServiceFunction(MS_DB_EVENT_GETSTRINGT, DbEventGetStringT);
-
- CreateServiceFunction(MS_DB_MODULE_DELETE, DbDeleteModule);
-
- CreateServiceFunction(MS_DB_GETPROFILEPATH, GetProfilePath);
- CreateServiceFunction(MS_DB_GETPROFILENAME, GetProfileName);
- CreateServiceFunction(MS_DB_GETPROFILEPATHW, GetProfilePathW);
- CreateServiceFunction(MS_DB_GETPROFILENAMEW, GetProfileNameW);
-
- CreateServiceFunction(MS_DB_SETDEFAULTPROFILE, SetDefaultProfile);
- return 0;
-}
-
-void UnloadEventsModule()
+MIR_APP_DLL(void) Profile_SetDefault(const wchar_t *pwszPath)
{
- if (!bModuleInitialized)
- return;
-
- for (int i=0; i < eventTypes.getCount(); i++) {
- DBEVENTTYPEDESCR *p = eventTypes[i];
- mir_free(p->module);
- mir_free(p->descr);
- mir_free(p->textService);
- mir_free(p->iconService);
- mir_free(p);
- }
+ extern wchar_t* g_defaultProfile;
+ replaceStrW(g_defaultProfile, pwszPath);
}
diff --git a/src/mir_app/src/menu_options.cpp b/src/mir_app/src/menu_options.cpp index c2d1bf2b5a..5a9a88b60c 100644 --- a/src/mir_app/src/menu_options.cpp +++ b/src/mir_app/src/menu_options.cpp @@ -130,7 +130,7 @@ class CGenMenuOptionsPage : public CDlgBase char szModule[256]; mir_snprintf(szModule, "%s_Items", pmo->pszName); - CallService(MS_DB_MODULE_DELETE, NULL, (LPARAM)szModule); + DbModule_Delete(NULL, szModule); SaveTreeInternal(NULL, m_menuItems.GetRoot(), szModule); db_set_b(NULL, szModule, "MenuFormat", 1); } diff --git a/src/mir_app/src/menu_utils.cpp b/src/mir_app/src/menu_utils.cpp index 22f5634e79..c714f06418 100644 --- a/src/mir_app/src/menu_utils.cpp +++ b/src/mir_app/src/menu_utils.cpp @@ -935,7 +935,7 @@ static INT_PTR sttUpdateMenuService(WPARAM wParam, LPARAM) MO_RecursiveWalkMenu(pmo->m_items.first, sttReadOldItem, szModule);
// wipe out old trash, write new data & compatibility flag
- CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szModule);
+ DbModule_Delete(NULL, szModule);
db_set_b(NULL, szModule, "MenuFormat", true);
MO_RecursiveWalkMenu(pmo->m_items.first, sttDumpItem, szModule);
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index dfd4856bbf..dfc1f380b4 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -280,3 +280,15 @@ Srmm_GetNthIcon @279 Srmm_ModifyIcon @280
Srmm_RemoveIcon @281
ExtraIcon_AddIcon @282
+DbEvent_GetIcon @283
+DbEvent_GetString @284
+DbEvent_GetTextA @285
+DbEvent_GetTextW @286
+DbEvent_GetType @287
+DbEvent_RegisterType @288
+DbModule_Delete @289
+Profile_GetNameA @290
+Profile_GetNameW @291
+Profile_GetPathA @292
+Profile_GetPathW @293
+Profile_SetDefault @294
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 6e1cfb3ff0..309b40d02d 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -280,3 +280,15 @@ Srmm_GetNthIcon @279 Srmm_ModifyIcon @280
Srmm_RemoveIcon @281
ExtraIcon_AddIcon @282
+DbEvent_GetIcon @283
+DbEvent_GetString @284
+DbEvent_GetTextA @285
+DbEvent_GetTextW @286
+DbEvent_GetType @287
+DbEvent_RegisterType @288
+DbModule_Delete @289
+Profile_GetNameA @290
+Profile_GetNameW @291
+Profile_GetPathA @292
+Profile_GetPathW @293
+Profile_SetDefault @294
diff --git a/src/mir_app/src/modules.cpp b/src/mir_app/src/modules.cpp index 13e23f6411..0e9f3f94db 100644 --- a/src/mir_app/src/modules.cpp +++ b/src/mir_app/src/modules.cpp @@ -38,7 +38,6 @@ int LoadProtocolsModule(void); // core: protocol manager int LoadAccountsModule(void); // core: account manager
int LoadIgnoreModule(void); // protocol filter: ignore
int LoadDbintfModule(void);
-int LoadEventsModule(void);
int LoadSrmmModule(void);
int LoadContactsModule(void);
@@ -52,7 +51,6 @@ int LoadSkinHotkeys(void); int LoadUserInfoModule(void); // ui: user info
int LoadVisibilityModule(void); // ui: visibility control
-int LoadPluginOptionsModule(void); // ui: plugin viewer
int LoadAddContactModule(void); // ui: authcontrol contacts
int LoadUtilsModule(void); // ui: utils (has a few window classes, like HyperLink)
int LoadCLCModule(void); // window class: CLC control
@@ -61,13 +59,11 @@ int LoadFontserviceModule(void); // ui: font manager int LoadIcoLibModule(void); // ui: icons manager
int LoadServiceModePlugin(void);
int LoadDefaultServiceModePlugin(void);
-int LoadErrorsModule(void);
void UnloadAccountsModule(void);
void UnloadClcModule(void);
void UnloadContactListModule(void);
void UnloadDatabase(void);
-void UnloadErrorsModule(void);
void UnloadEventsModule(void);
void UnloadExtraIconsModule(void);
void UnloadIcoLibModule(void);
@@ -80,9 +76,9 @@ void UnloadSkinHotkeys(void); void UnloadSrmmModule(void);
void UnloadUtilsModule(void);
-int LoadIcoTabsModule();
-int LoadHeaderbarModule();
-int LoadDescButtonModule();
+int LoadIcoTabsModule();
+int LoadHeaderbarModule();
+int LoadDescButtonModule();
int LoadDefaultModules(void)
{
@@ -94,7 +90,6 @@ int LoadDefaultModules(void) if (LoadIcoTabsModule()) return 1;
if (LoadHeaderbarModule()) return 1;
if (LoadDbintfModule()) return 1;
- if (LoadEventsModule()) return 1;
// load database drivers & service plugins without executing their Load()
if (LoadNewPluginsModuleInfos()) return 1;
diff --git a/src/mir_app/src/options_ei.cpp b/src/mir_app/src/options_ei.cpp index 060fa85b93..d38dc19f6a 100644 --- a/src/mir_app/src/options_ei.cpp +++ b/src/mir_app/src/options_ei.cpp @@ -372,7 +372,7 @@ public: db_set_w(NULL, MODULE_NAME, setting, extra->getSlot());
}
- CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)MODULE_NAME "Groups");
+ DbModule_Delete(NULL, MODULE_NAME "Groups");
db_set_w(NULL, MODULE_NAME "Groups", "Count", groups.getCount());
for (int k = 0; k < groups.getCount(); k++) {
ExtraIconGroup *group = groups[k];
diff --git a/src/mir_app/src/proto_accs.cpp b/src/mir_app/src/proto_accs.cpp index 8999e88f06..5c8edc3d13 100644 --- a/src/mir_app/src/proto_accs.cpp +++ b/src/mir_app/src/proto_accs.cpp @@ -378,7 +378,7 @@ void DeactivateAccount(PROTOACCOUNT *pa, bool bIsDynamic, bool bErase) /////////////////////////////////////////////////////////////////////////////////////////
-void EraseAccount(const char* pszModuleName)
+void EraseAccount(const char *pszModuleName)
{
// remove protocol contacts first
for (MCONTACT hContact = db_find_first(pszModuleName); hContact != NULL;) {
@@ -388,7 +388,7 @@ void EraseAccount(const char* pszModuleName) }
// remove all protocol settings
- CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)pszModuleName);
+ DbModule_Delete(NULL, pszModuleName);
}
/////////////////////////////////////////////////////////////////////////////////////////
|