diff options
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 80 | ||||
-rw-r--r-- | src/core/stdmsg/src/msglog.cpp | 2 | ||||
-rw-r--r-- | src/mir_core/protos.cpp | 2 | ||||
-rw-r--r-- | src/modules/clist/genmenu.cpp | 2 | ||||
-rw-r--r-- | src/modules/database/database.cpp | 1 | ||||
-rw-r--r-- | src/modules/plugins/newplugins.cpp | 38 | ||||
-rw-r--r-- | src/modules/utils/openurl.cpp | 22 |
7 files changed, 72 insertions, 75 deletions
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 4cb95cbec3..1f2aa4b62f 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -1096,52 +1096,50 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case DM_UPDATETITLE:
{
TCHAR newtitle[256];
- if (dat->hContact) {
- if (dat->szProto) {
- int statusIcon = db_get_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON);
-
- dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
- TCHAR *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
-
- TCHAR buf[128] = _T("");
- if (strcmp(dat->szProto, META_PROTO)) {
- CONTACTINFO ci = { 0 };
- ci.cbSize = sizeof(ci);
- ci.hContact = dat->hContact;
- ci.szProto = dat->szProto;
- ci.dwFlag = CNF_DISPLAYUID | CNF_TCHAR;
- if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
- switch (ci.type) {
- case CNFT_ASCIIZ:
- _tcsncpy_s(buf, ci.pszVal, _TRUNCATE);
- mir_free(ci.pszVal);
- break;
- case CNFT_DWORD:
- mir_sntprintf(buf, SIZEOF(buf), _T("%u"), ci.dVal);
- break;
- }
+ if (dat->hContact && dat->szProto) {
+ int statusIcon = db_get_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON);
+
+ dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
+ TCHAR *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
+
+ TCHAR buf[128] = _T("");
+ if (strcmp(dat->szProto, META_PROTO)) {
+ CONTACTINFO ci = { 0 };
+ ci.cbSize = sizeof(ci);
+ ci.hContact = dat->hContact;
+ ci.szProto = dat->szProto;
+ ci.dwFlag = CNF_DISPLAYUID | CNF_TCHAR;
+ if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
+ switch (ci.type) {
+ case CNFT_ASCIIZ:
+ _tcsncpy_s(buf, ci.pszVal, _TRUNCATE);
+ mir_free(ci.pszVal);
+ break;
+ case CNFT_DWORD:
+ mir_sntprintf(buf, SIZEOF(buf), _T("%u"), ci.dVal);
+ break;
}
}
- if (buf[0])
- SetDlgItemText(hwndDlg, IDC_NAME, buf);
- else
- SetDlgItemText(hwndDlg, IDC_NAME, contactName);
+ }
+ if (buf[0])
+ SetDlgItemText(hwndDlg, IDC_NAME, buf);
+ else
+ SetDlgItemText(hwndDlg, IDC_NAME, contactName);
- TCHAR *szStatus = pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE), 0);
- if (statusIcon)
- mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s - %s"), contactName, TranslateT("Message session"));
- else
- mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s (%s): %s"), contactName, szStatus, TranslateT("Message session"));
+ TCHAR *szStatus = pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE), 0);
+ if (statusIcon)
+ mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s - %s"), contactName, TranslateT("Message session"));
+ else
+ mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s (%s): %s"), contactName, szStatus, TranslateT("Message session"));
- DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)wParam;
- if (!cws || (!strcmp(cws->szModule, dat->szProto) && !strcmp(cws->szSetting, "Status"))) {
- InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), NULL, TRUE);
- if (statusIcon)
- SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0);
- }
-
- dat->wOldStatus = dat->wStatus;
+ DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)wParam;
+ if (!cws || (!strcmp(cws->szModule, dat->szProto) && !strcmp(cws->szSetting, "Status"))) {
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), NULL, TRUE);
+ if (statusIcon)
+ SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0);
}
+
+ dat->wOldStatus = dat->wStatus;
}
else
mir_tstrncpy(newtitle, TranslateT("Message session"), SIZEOF(newtitle));
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index 730d0610d1..e5d71acd7d 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -314,7 +314,7 @@ static char *CreateRTFFromDbEvent(SrmmWindowData *dat, MCONTACT hContact, HANDLE }
else
// Shouldn't happen?
- szName = TranslateT("Me");
+ szName = mir_tstrdup(TranslateT("Me"));
}
else szName = pcli->pfnGetContactDisplayName(hContact, 0);
diff --git a/src/mir_core/protos.cpp b/src/mir_core/protos.cpp index b8cacdd8fb..0c2e6c8e5a 100644 --- a/src/mir_core/protos.cpp +++ b/src/mir_core/protos.cpp @@ -70,6 +70,8 @@ MIR_CORE_DLL(INT_PTR) ProtoBroadcastAck(const char *szModule, MCONTACT hContact, MultiByteToWideChar(CP_ACP, 0, ai->filename, -1, aiw.filename, SIZEOF(aiw.filename));
hProcess = &aiw;
+ ACKDATA ack = { sizeof(ACKDATA), szModule, hContact, type, result, hProcess, lParam };
+ return NotifyEventHooks(hAckEvent, 0, (LPARAM)&ack);
}
}
diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp index 93dd2c0b7e..69bd36cb93 100644 --- a/src/modules/clist/genmenu.cpp +++ b/src/modules/clist/genmenu.cpp @@ -411,7 +411,7 @@ INT_PTR MO_ProcessCommandByMenuIdent(WPARAM wParam, LPARAM lParam) if (!bIsGenMenuInited)
return -1;
- PMO_IntMenuItem pimi;
+ PMO_IntMenuItem pimi = NULL;
{
mir_cslock lck(csMenuHook);
for (int i=0; i < g_menus.getCount(); i++)
diff --git a/src/modules/database/database.cpp b/src/modules/database/database.cpp index f6b4c2d34b..73794631d3 100644 --- a/src/modules/database/database.cpp +++ b/src/modules/database/database.cpp @@ -213,6 +213,7 @@ static void moveProfileDirProfiles(TCHAR *profiledir, BOOL isRootDir = TRUE) TranslateT("Miranda is trying to upgrade your profile structure.\nIt cannot move profile %s to the new location %s automatically\nMost likely due to insufficient privileges. Please move profile manually."),
path, path2);
MessageBox(NULL, buf, _T("Miranda NG"), MB_ICONERROR | MB_OK);
+ mir_free(profile);
break;
}
mir_free(profile);
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp index 2e2885033e..70fcb8ca4d 100644 --- a/src/modules/plugins/newplugins.cpp +++ b/src/modules/plugins/newplugins.cpp @@ -246,9 +246,7 @@ static int checkPI(BASIC_PLUGIN_INFO* bpi, PLUGININFOEX* pi) int checkAPI(TCHAR* plugin, BASIC_PLUGIN_INFO* bpi, DWORD mirandaVersion, int checkTypeAPI)
{
- HINSTANCE h = NULL;
-
- h = LoadLibrary(plugin);
+ HINSTANCE h = LoadLibrary(plugin);
if (h == NULL)
return 0;
@@ -283,16 +281,15 @@ LBL_Ok: bpi->hInst = h;
return 1;
}
-
// check clist ?
- if (checkTypeAPI == CHECKAPI_CLIST) {
+ else if (checkTypeAPI == CHECKAPI_CLIST) {
bpi->clistlink = (CList_Initialise)GetProcAddress(h, "CListInitialise");
if (pi->flags & UNICODE_AWARE)
if (bpi->clistlink)
goto LBL_Ok;
}
-
- goto LBL_Error;
+ else
+ goto LBL_Error;
}
// perform any API related tasks to freeing
@@ -310,11 +307,12 @@ void Plugin_Uninit(pluginEntry *p) // we need to kill all resources which belong to that DLL before calling FreeLibrary
KillModuleEventHooks(hInst);
KillModuleServices(hInst);
+ UnregisterModule(hInst);
FreeLibrary(hInst);
memset(&p->bpi, 0, sizeof(p->bpi));
}
- UnregisterModule(hInst);
+
if (p == pluginList_crshdmp)
pluginList_crshdmp = NULL;
pluginList.remove(p);
@@ -382,18 +380,18 @@ void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam) // create the search filter
TCHAR search[MAX_PATH];
mir_sntprintf(search, SIZEOF(search), _T("%s\\Plugins\\*.dll"), exe);
- {
- // FFFN will return filenames for things like dot dll+ or dot dllx
- WIN32_FIND_DATA ffd;
- HANDLE hFind = FindFirstFile(search, &ffd);
- if (hFind != INVALID_HANDLE_VALUE) {
- do {
- if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && valid_library_name(ffd.cFileName))
- cb(&ffd, exe, wParam, lParam);
- } while (FindNextFile(hFind, &ffd));
- FindClose(hFind);
- } //if
- }
+
+ // FFFN will return filenames for things like dot dll+ or dot dllx
+ WIN32_FIND_DATA ffd;
+ HANDLE hFind = FindFirstFile(search, &ffd);
+ if (hFind == INVALID_HANDLE_VALUE)
+ return;
+
+ do {
+ if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && valid_library_name(ffd.cFileName))
+ cb(&ffd, exe, wParam, lParam);
+ } while (FindNextFile(hFind, &ffd));
+ FindClose(hFind);
}
pluginEntry* OpenPlugin(TCHAR *tszFileName, TCHAR *dir, TCHAR *path)
diff --git a/src/modules/utils/openurl.cpp b/src/modules/utils/openurl.cpp index 7228182874..ab1797e2c5 100644 --- a/src/modules/utils/openurl.cpp +++ b/src/modules/utils/openurl.cpp @@ -34,7 +34,7 @@ typedef struct { static void OpenURLThread(void *arg)
{
TOpenUrlInfo *hUrlInfo = (TOpenUrlInfo*)arg;
- if (!hUrlInfo->szUrl)
+ if (!hUrlInfo || !hUrlInfo->szUrl)
return;
//wack a protocol on it
@@ -47,20 +47,18 @@ static void OpenURLThread(void *arg) int i;
for (i=0; _istalpha(hUrlInfo->szUrl[i]); i++);
if (hUrlInfo->szUrl[i] == ':')
- szResult = mir_tstrdup(hUrlInfo->szUrl);
- else {
- if (!_tcsnicmp(hUrlInfo->szUrl, _T("ftp."), 4))
- mir_sntprintf(szResult, size, _T("ftp://%s"), hUrlInfo->szUrl);
- else
- mir_sntprintf(szResult, size, _T("http://%s"), hUrlInfo->szUrl);
- }
+ mir_tstrcpy(szResult, hUrlInfo->szUrl);
+ else if (!_tcsnicmp(hUrlInfo->szUrl, _T("ftp."), 4))
+ mir_sntprintf(szResult, size, _T("ftp://%s"), hUrlInfo->szUrl);
+ else
+ mir_sntprintf(szResult, size, _T("http://%s"), hUrlInfo->szUrl);
}
// check user defined browser for opening urls
- DBVARIANT dbv;
- if (!db_get_ts(NULL, "Miranda", "OpenUrlBrowser", &dbv)) {
- ShellExecute(NULL, _T("open"), dbv.ptszVal, szResult, NULL, (hUrlInfo->newWindow) ? SW_NORMAL : SW_SHOWDEFAULT);
- db_free(&dbv);
+ TCHAR *tszBrowser = db_get_tsa(NULL, "Miranda", "OpenUrlBrowser");
+ if (tszBrowser) {
+ ShellExecute(NULL, _T("open"), tszBrowser, szResult, NULL, (hUrlInfo->newWindow) ? SW_NORMAL : SW_SHOWDEFAULT);
+ mir_free(tszBrowser);
}
else ShellExecute(NULL, _T("open"), szResult, NULL, NULL, (hUrlInfo->newWindow) ? SW_NORMAL : SW_SHOWDEFAULT);
|