diff options
Diffstat (limited to 'src/modules')
76 files changed, 554 insertions, 938 deletions
diff --git a/src/modules/addcontact/addcontact.cpp b/src/modules/addcontact/addcontact.cpp index f1a2e6330d..ce03278281 100644 --- a/src/modules/addcontact/addcontact.cpp +++ b/src/modules/addcontact/addcontact.cpp @@ -107,7 +107,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp CheckDlgButton(hdlg, IDC_ADDED, BST_CHECKED);
CheckDlgButton(hdlg, IDC_AUTH, BST_CHECKED);
- DWORD flags = (acs->szProto) ? CallProtoService(acs->szProto, PS_GETCAPS, PFLAGNUM_4, 0) : 0;
+ DWORD flags = (acs->szProto) ? CallProtoServiceInt(NULL,acs->szProto, PS_GETCAPS, PFLAGNUM_4, 0) : 0;
if (flags&PF4_FORCEADDED) { // force you were added requests for this protocol
EnableWindow(GetDlgItem(hdlg, IDC_ADDED), FALSE);
}
@@ -133,7 +133,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp {
case IDC_AUTH:
{
- DWORD flags = CallProtoService(acs->szProto, PS_GETCAPS, PFLAGNUM_4, 0);
+ DWORD flags = CallProtoServiceInt(NULL,acs->szProto, PS_GETCAPS, PFLAGNUM_4, 0);
if (flags & PF4_NOCUSTOMAUTH) {
EnableWindow(GetDlgItem(hdlg, IDC_AUTHREQ), FALSE);
EnableWindow(GetDlgItem(hdlg, IDC_AUTHGB), FALSE);
@@ -154,12 +154,12 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp DBEVENTINFO dbei = { 0 };
dbei.cbSize = sizeof(dbei);
CallService(MS_DB_EVENT_GET, (WPARAM)acs->handle, (LPARAM)&dbei);
- hContact = (HANDLE)CallProtoService(dbei.szModule, PS_ADDTOLISTBYEVENT, 0, (LPARAM)acs->handle);
+ hContact = (HANDLE)CallProtoServiceInt(NULL,dbei.szModule, PS_ADDTOLISTBYEVENT, 0, (LPARAM)acs->handle);
}
break;
case HANDLE_SEARCHRESULT:
- hContact = (HANDLE)CallProtoService(acs->szProto, PS_ADDTOLIST, 0, (LPARAM)acs->psr);
+ hContact = (HANDLE)CallProtoServiceInt(NULL,acs->szProto, PS_ADDTOLIST, 0, (LPARAM)acs->psr);
break;
case HANDLE_CONTACT:
@@ -188,7 +188,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp if (IsDlgButtonChecked(hdlg, IDC_AUTH))
{
- DWORD flags = CallProtoService(acs->szProto, PS_GETCAPS, PFLAGNUM_4, 0);
+ DWORD flags = CallProtoServiceInt(NULL,acs->szProto, PS_GETCAPS, PFLAGNUM_4, 0);
if (flags & PF4_NOCUSTOMAUTH)
CallContactService(hContact, PSS_AUTHREQUESTT, 0, 0);
else
@@ -256,9 +256,9 @@ INT_PTR AddContactDialog(WPARAM wParam, LPARAM lParam) }
if (wParam)
- DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_ADDCONTACT), (HWND)wParam, AddContactDlgProc, (LPARAM)acs);
+ DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ADDCONTACT), (HWND)wParam, AddContactDlgProc, (LPARAM)acs);
else
- CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_ADDCONTACT), (HWND)wParam, AddContactDlgProc, (LPARAM)acs);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDCONTACT), (HWND)wParam, AddContactDlgProc, (LPARAM)acs);
return 0;
}
return 1;
diff --git a/src/modules/autoaway/autoaway.cpp b/src/modules/autoaway/autoaway.cpp index 767800d014..764cd3e965 100644 --- a/src/modules/autoaway/autoaway.cpp +++ b/src/modules/autoaway/autoaway.cpp @@ -41,8 +41,8 @@ static int AutoAwayEvent(WPARAM, LPARAM lParam) if ( !Proto_IsAccountEnabled(pa) || Proto_IsAccountLocked(pa)) continue;
- int statusbits = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0);
- int currentstatus = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
+ int statusbits = CallProtoServiceInt(NULL,pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0);
+ int currentstatus = CallProtoServiceInt(NULL,pa->szModuleName, PS_GETSTATUS, 0, 0);
int status = mii.aaStatus;
if ( !(statusbits & Proto_Status2Flag(status))) {
// the protocol doesnt support the given status
diff --git a/src/modules/button/button.cpp b/src/modules/button/button.cpp index 756740eefa..8889af9bf5 100644 --- a/src/modules/button/button.cpp +++ b/src/modules/button/button.cpp @@ -495,7 +495,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L else {
TTooltips *ptt = (TTooltips*)mir_alloc(sizeof(TTooltips));
ptt->ThreadId = tt.ThreadId;
- ptt->hwnd = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, _T(""), TTS_ALWAYSTIP, 0, 0, 0, 0, NULL, NULL, hMirandaInst, NULL);
+ ptt->hwnd = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, _T(""), TTS_ALWAYSTIP, 0, 0, 0, 0, NULL, NULL, hInst, NULL);
lToolTips.insert(ptt);
bct->hwndToolTips = ptt->hwnd;
}
diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp index d68ad5a9b8..8a50469245 100644 --- a/src/modules/clist/clc.cpp +++ b/src/modules/clist/clc.cpp @@ -99,7 +99,7 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) // something is being written to a protocol module
if ( !strcmp(szProto, cws->szModule)) {
// was a unique setting key written?
- id = (char *) CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ id = (char *) CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if ((INT_PTR) id != CALLSERVICE_NOTFOUND && id != NULL && !strcmp(id, cws->szSetting))
cli.pfnClcBroadcast(INTM_PROTOCHANGED, wParam, lParam);
}
@@ -129,7 +129,7 @@ static int ClcAccountsChanged(WPARAM, LPARAM) for (i = 0, cnt = 0; i < accounts.getCount(); ++i) {
if (Proto_IsAccountEnabled(accounts[i])) {
cli.clcProto[cnt].szProto = accounts[i]->szModuleName;
- cli.clcProto[cnt].dwStatus = CallProtoService(accounts[i]->szModuleName, PS_GETSTATUS, 0, 0);
+ cli.clcProto[cnt].dwStatus = CallProtoServiceInt(NULL,accounts[i]->szModuleName, PS_GETSTATUS, 0, 0);
++cnt;
}
}
diff --git a/src/modules/clist/clcfiledrop.cpp b/src/modules/clist/clcfiledrop.cpp index 8af901284b..5c64082215 100644 --- a/src/modules/clist/clcfiledrop.cpp +++ b/src/modules/clist/clcfiledrop.cpp @@ -82,7 +82,7 @@ static HANDLE HContactFromPoint(HWND hwnd, struct ClcData *dat, int x, int y, in szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) contact->hContact, 0);
if (szProto == NULL)
return NULL;
- protoCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
+ protoCaps = CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_1, 0);
if ( !(protoCaps & PF1_FILESEND))
return NULL;
if (ID_STATUS_OFFLINE == DBGetContactSettingWord(contact->hContact, szProto, "Status", ID_STATUS_OFFLINE))
diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp index f05f9c13ae..dc9c4a69e2 100644 --- a/src/modules/clist/clistmenus.cpp +++ b/src/modules/clist/clistmenus.cpp @@ -171,8 +171,8 @@ int GetAverageMode(int* pNetProtoCount = NULL) netProtoCount++;
if (averageMode == 0)
- averageMode = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
- else if (averageMode > 0 && averageMode != CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0)) {
+ averageMode = CallProtoServiceInt(NULL,pa->szModuleName, PS_GETSTATUS, 0, 0);
+ else if (averageMode > 0 && averageMode != CallProtoServiceInt(NULL,pa->szModuleName, PS_GETSTATUS, 0, 0)) {
averageMode = -1;
if (pNetProtoCount == NULL) break;
}
@@ -449,12 +449,12 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) StatusMenuExecParam *smep = (StatusMenuExecParam*)pcpp->MenuItemOwnerData;
if (smep && !smep->status && smep->custom) {
if (wildcmp(smep->svc, "*XStatus*")) {
- int XStatus = CallProtoService(smep->proto, "/GetXStatus", 0, 0);
+ int XStatus = CallProtoServiceInt(NULL,smep->proto, "/GetXStatus", 0, 0);
char buf[255];
mir_snprintf(buf, sizeof(buf), "*XStatus%d", XStatus);
- bool check = wildcmp(smep->svc, buf);
- bool reset = wildcmp(smep->svc, "*XStatus0");
+ bool check = wildcmp(smep->svc, buf) != 0;
+ bool reset = wildcmp(smep->svc, "*XStatus0") != 0;
if (check)
timi->mi.flags |= CMIF_CHECKED;
@@ -467,7 +467,7 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) CLISTMENUITEM mi2 = {0};
mi2.cbSize = sizeof(mi2);
mi2.flags = CMIM_NAME | CMIF_TCHAR;
- mi2.ptszName = LangPackTranslateStringT(timi->mi.hLangpack, timi->mi.hIcon ? timi->mi.ptszName : LPGENT("Custom status"));
+ mi2.ptszName = TranslateTH(timi->mi.hLangpack, timi->mi.hIcon ? timi->mi.ptszName : LPGENT("Custom status"));
timiParent = MO_GetIntMenuItem(timi->mi.root);
@@ -510,7 +510,7 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) } } }
}
else if (smep && smep->status && !smep->custom) {
- int curProtoStatus = (smep->proto) ? CallProtoService(smep->proto, PS_GETSTATUS, 0, 0) : GetAverageMode();
+ int curProtoStatus = (smep->proto) ? CallProtoServiceInt(NULL,smep->proto, PS_GETSTATUS, 0, 0) : GetAverageMode();
if (smep->status == curProtoStatus)
timi->mi.flags |= CMIF_CHECKED;
else
@@ -531,13 +531,13 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) if (Proto_GetAccount(prot) == NULL)
return TRUE;
- if ((curProtoStatus = CallProtoService(prot, PS_GETSTATUS, 0, 0)) == CALLSERVICE_NOTFOUND)
+ if ((curProtoStatus = CallProtoServiceInt(NULL,prot, PS_GETSTATUS, 0, 0)) == CALLSERVICE_NOTFOUND)
curProtoStatus = 0;
if (curProtoStatus >= ID_STATUS_OFFLINE && curProtoStatus < ID_STATUS_IDLE)
timi->mi.hIcon = LoadSkinProtoIcon(prot, curProtoStatus);
else {
- timi->mi.hIcon=(HICON)CallProtoService(prot, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
+ timi->mi.hIcon=(HICON)CallProtoServiceInt(NULL,prot, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
if (timi->mi.hIcon == (HICON)CALLSERVICE_NOTFOUND)
timi->mi.hIcon = NULL;
else
@@ -574,7 +574,7 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) int i=(DBGetContactSettingByte(NULL, prot, "LockMainStatus", 0)?0:1);
DBWriteContactSettingByte(NULL, prot, "LockMainStatus", (BYTE)i);
- CallProtoService(smep->proto, PS_GETNAME, (WPARAM)SIZEOF(szHumanName), (LPARAM)szHumanName);
+ CallProtoServiceInt(NULL,smep->proto, PS_GETNAME, (WPARAM)SIZEOF(szHumanName), (LPARAM)szHumanName);
pimi = MO_GetIntMenuItem((HGENMENU)smep->protoindex);
PMO_IntMenuItem root = (PMO_IntMenuItem)pimi->mi.root;
mir_free(pimi->mi.pszName);
@@ -874,7 +874,7 @@ void RebuildMenuOrder(void) tmi.cbSize = sizeof(tmi);
tmi.flags = CMIF_TCHAR | CMIF_ROOTHANDLE | CMIF_KEEPUNTRANSLATED;
tmi.position = pos++;
- tmi.hIcon = ic = (HICON)CallProtoService(pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
+ tmi.hIcon = ic = (HICON)CallProtoServiceInt(NULL,pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
if (Proto_IsAccountLocked(pa) && cli.bDisplayLocked) {
mir_sntprintf(tbuf, SIZEOF(tbuf), LPGENT("%s (locked)"), pa->tszAccountName);
diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp index 26ad72ae7c..84d587db97 100644 --- a/src/modules/clist/clistmod.cpp +++ b/src/modules/clist/clistmod.cpp @@ -146,7 +146,7 @@ static int ProtocolAck(WPARAM, LPARAM lParam) if ((int) ack->hProcess < ID_STATUS_ONLINE && ack->lParam >= ID_STATUS_ONLINE) {
DWORD caps;
- caps = (DWORD) CallProtoService(ack->szModule, PS_GETCAPS, PFLAGNUM_1, 0);
+ caps = (DWORD) CallProtoServiceInt(NULL,ack->szModule, PS_GETCAPS, PFLAGNUM_1, 0);
if (caps & PF1_SERVERCLIST) {
HANDLE hContact;
char *szProto;
diff --git a/src/modules/clist/clisttray.cpp b/src/modules/clist/clisttray.cpp index 608f692028..013a639168 100644 --- a/src/modules/clist/clisttray.cpp +++ b/src/modules/clist/clisttray.cpp @@ -53,13 +53,13 @@ static TCHAR* sttGetXStatus(const char* szProto) {
TCHAR* result = NULL;
- if (CallProtoService(szProto, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE) {
+ if (CallProtoServiceInt(NULL,szProto, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE) {
char str[MAXMODULELABELLENGTH];
mir_snprintf(str, sizeof(str), "%s/GetXStatus", szProto);
if (ServiceExists(str)) {
char* dbTitle = "XStatusName";
char* dbTitle2 = NULL;
- int xstatus = CallProtoService(szProto, "/GetXStatus", (WPARAM)&dbTitle, (LPARAM)&dbTitle2);
+ int xstatus = CallProtoServiceInt(NULL,szProto, "/GetXStatus", (WPARAM)&dbTitle, (LPARAM)&dbTitle2);
if (dbTitle && xstatus) {
DBVARIANT dbv={0};
if ( !DBGetContactSettingTString(NULL, szProto, dbTitle, &dbv)) {
@@ -123,7 +123,7 @@ TCHAR* fnTrayIconMakeTooltip(const TCHAR *szPrefix, const char *szProto) if ( !cli.pfnGetProtocolVisibility(pa->szModuleName))
continue;
- szStatus = cli.pfnGetStatusModeDescription(CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0), 0);
+ szStatus = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL,pa->szModuleName, PS_GETSTATUS, 0, 0), 0);
if ( !szStatus)
continue;
@@ -156,7 +156,7 @@ TCHAR* fnTrayIconMakeTooltip(const TCHAR *szPrefix, const char *szProto) else {
if ((pa = Proto_GetAccount(szProto)) != NULL) {
ProtoXStatus = sttGetXStatus(szProto);
- szStatus = cli.pfnGetStatusModeDescription(CallProtoService(szProto, PS_GETSTATUS, 0, 0), 0);
+ szStatus = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL,szProto, PS_GETSTATUS, 0, 0), 0);
if (szPrefix && szPrefix[0]) {
if (DBGetContactSettingByte(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT)) {
if (mToolTipTrayTips) {
@@ -281,7 +281,7 @@ int fnTrayIconInit(HWND hwnd) else
szProto = NULL;
- cli.pfnTrayIconAdd(hwnd, NULL, szProto, szProto ? CallProtoService(szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0));
+ cli.pfnTrayIconAdd(hwnd, NULL, szProto, szProto ? CallProtoServiceInt(NULL,szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0));
DBFreeVariant(&dbv);
}
else if (trayIconSetting == SETTING_TRAYICON_MULTI &&
@@ -295,7 +295,7 @@ int fnTrayIconInit(HWND hwnd) {
PROTOACCOUNT* pa = accounts[j];
if (cli.pfnGetProtocolVisibility(pa->szModuleName))
- cli.pfnTrayIconAdd(hwnd, pa->szModuleName, NULL, CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0));
+ cli.pfnTrayIconAdd(hwnd, pa->szModuleName, NULL, CallProtoServiceInt(NULL,pa->szModuleName, PS_GETSTATUS, 0, 0));
}
}
}
@@ -498,7 +498,7 @@ VOID CALLBACK fnTrayCycleTimerProc(HWND, UINT, UINT_PTR, DWORD) {
DestroyIcon(cli.trayIcon[0].hBaseIcon);
cli.trayIcon[0].hBaseIcon = cli.pfnGetIconFromStatusMode(NULL, accounts[cycleStep]->szModuleName,
- CallProtoService(accounts[cycleStep]->szModuleName, PS_GETSTATUS, 0, 0));
+ CallProtoServiceInt(NULL,accounts[cycleStep]->szModuleName, PS_GETSTATUS, 0, 0));
if (cli.trayIcon[0].isBase)
cli.pfnTrayIconUpdate(cli.trayIcon[0].hBaseIcon, NULL, NULL, 1);
}
@@ -534,7 +534,7 @@ void fnTrayIconUpdateBase(const char *szChangedProto) if (trayIconSetting == SETTING_TRAYICON_MULTI) {
if (DBGetContactSettingByte(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))
//changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode((char*)szChangedProto, NULL, averageMode), (char*)szChangedProto);
- changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0)), (char*)szChangedProto);
+ changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, szChangedProto, CallProtoServiceInt(NULL,szChangedProto, PS_GETSTATUS, 0, 0)), (char*)szChangedProto);
else if (cli.trayIcon && cli.trayIcon[0].szProto != NULL) {
cli.pfnTrayIconDestroy(hwnd);
cli.pfnTrayIconInit(hwnd);
@@ -555,7 +555,7 @@ void fnTrayIconUpdateBase(const char *szChangedProto) szProto = NULL;
else
szProto = dbv.pszVal;
- changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, szProto, szProto ? CallProtoService(szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0)), szProto);
+ changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, szProto, szProto ? CallProtoServiceInt(NULL,szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0)), szProto);
DBFreeVariant(&dbv);
break;
}
@@ -564,7 +564,7 @@ void fnTrayIconUpdateBase(const char *szChangedProto) SetTimer(NULL, 0, DBGetContactSettingWord(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, cli.pfnTrayCycleTimerProc);
changed =
cli.pfnTrayIconSetBaseInfo(ImageList_GetIcon
- (hCListImages, cli.pfnIconFromStatusMode(szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0), NULL),
+ (hCListImages, cli.pfnIconFromStatusMode(szChangedProto, CallProtoServiceInt(NULL,szChangedProto, PS_GETSTATUS, 0, 0), NULL),
ILD_NORMAL), NULL);
break;
case SETTING_TRAYICON_MULTI:
@@ -572,7 +572,7 @@ void fnTrayIconUpdateBase(const char *szChangedProto) cli.pfnTrayIconRemove(NULL, NULL);
}
else if ((cli.trayIconCount > 1 || netProtoCount == 1) || DBGetContactSettingByte(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))
- changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0)), (char*)szChangedProto);
+ changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, szChangedProto, CallProtoServiceInt(NULL,szChangedProto, PS_GETSTATUS, 0, 0)), (char*)szChangedProto);
else {
cli.pfnTrayIconDestroy(hwnd);
cli.pfnTrayIconInit(hwnd);
diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp index 78ed09174d..8524a4cf3a 100644 --- a/src/modules/clist/clui.cpp +++ b/src/modules/clist/clui.cpp @@ -76,7 +76,7 @@ static void DisconnectAll() {
int nProto;
for (nProto = 0; nProto < accounts.getCount(); nProto++)
- CallProtoService(accounts[nProto]->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0);
+ CallProtoServiceInt(NULL,accounts[nProto]->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0);
}
static int CluiIconsChanged(WPARAM, LPARAM)
@@ -183,7 +183,7 @@ static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam) if (DBGetContactSettingByte(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) &&
!(GetKeyState(VK_SHIFT)&0x8000))
// Ask user for confirmation, and if the contact should be archived (hidden, not deleted)
- action = DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_DELETECONTACT), (HWND) lParam, AskForConfirmationDlgProc, wParam);
+ action = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DELETECONTACT), (HWND) lParam, AskForConfirmationDlgProc, wParam);
else
action = IDYES;
@@ -197,11 +197,11 @@ static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam) // Check if protocol uses server side lists
DWORD caps;
- caps = (DWORD) CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
+ caps = (DWORD) CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_1, 0);
if (caps & PF1_SERVERCLIST) {
int status;
- status = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
+ status = CallProtoServiceInt(NULL,szProto, PS_GETSTATUS, 0, 0);
if (status == ID_STATUS_OFFLINE || (status >= ID_STATUS_CONNECTING && status < ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES)) {
// Set a flag so we remember to delete the contact when the protocol goes online the next time
DBWriteContactSettingByte((HANDLE) wParam, "CList", "Delete", 1);
@@ -1042,7 +1042,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM int status, x;
SIZE textSize;
BYTE showOpts = DBGetContactSettingByte(NULL, "CLUI", "SBarShow", 1);
- status = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
+ status = CallProtoServiceInt(NULL,szProto, PS_GETSTATUS, 0, 0);
SetBkMode(dis->hDC, TRANSPARENT);
x = dis->rcItem.left;
if (showOpts & 1) {
diff --git a/src/modules/clist/cluiservices.cpp b/src/modules/clist/cluiservices.cpp index e1123ecd05..30f1a55322 100644 --- a/src/modules/clist/cluiservices.cpp +++ b/src/modules/clist/cluiservices.cpp @@ -199,7 +199,7 @@ void fnCluiProtocolStatusChanged(int, const char*) x += GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
}
if (showOpts & 4) {
- TCHAR* modeDescr = cli.pfnGetStatusModeDescription(CallProtoService(cli.menuProtos[i].szProto, PS_GETSTATUS, 0, 0), 0);
+ TCHAR* modeDescr = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL,cli.menuProtos[i].szProto, PS_GETSTATUS, 0, 0), 0);
GetTextExtentPoint32(hdc, modeDescr, lstrlen(modeDescr), &textSize);
x += textSize.cx;
x += GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp index b6f78c80ef..ff6ead1d75 100644 --- a/src/modules/clist/genmenu.cpp +++ b/src/modules/clist/genmenu.cpp @@ -77,7 +77,7 @@ LPTSTR GetMenuItemText(PMO_IntMenuItem pimi) if (pimi->mi.flags & CMIF_KEEPUNTRANSLATED)
return pimi->mi.ptszName;
- return LangPackTranslateStringT(pimi->mi.hLangpack, pimi->mi.ptszName);
+ return TranslateTH(pimi->mi.hLangpack, pimi->mi.ptszName);
}
PMO_IntMenuItem MO_RecursiveWalkMenu(PMO_IntMenuItem parent, pfnWalkFunc func, void* param)
diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index e16fd49d18..c2ecc3f18b 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -849,7 +849,7 @@ int GenMenuOptInit(WPARAM wParam, LPARAM) {
OPTIONSDIALOGPAGE odp = { 0 };
odp.cbSize=sizeof(odp);
- odp.hInstance = hMirandaInst;
+ odp.hInstance = hInst;
odp.pszGroup = LPGEN("Customize");
odp.position = -1000000000;
diff --git a/src/modules/contacts/contacts.cpp b/src/modules/contacts/contacts.cpp index f6cbc2c889..096725972a 100644 --- a/src/modules/contacts/contacts.cpp +++ b/src/modules/contacts/contacts.cpp @@ -34,12 +34,12 @@ BYTE nameOrder[NAMEORDERCOUNT]; static int GetDatabaseString(CONTACTINFO *ci, const char* setting, DBVARIANT* dbv)
{
- if (strcmp(ci->szProto, "CList") && CallProtoService(ci->szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC)
+ if (strcmp(ci->szProto, "CList") && CallProtoServiceInt(NULL,ci->szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC)
{
DBCONTACTGETSETTING cgs = { ci->szProto, setting, dbv };
dbv->type = (ci->dwFlag & CNF_UNICODE) ? DBVT_WCHAR : DBVT_ASCIIZ;
- int res = CallProtoService(ci->szProto, PS_GETINFOSETTING, (WPARAM)ci->hContact, (LPARAM)&cgs);
+ int res = CallProtoServiceInt(NULL,ci->szProto, PS_GETINFOSETTING, (WPARAM)ci->hContact, (LPARAM)&cgs);
if (res != CALLSERVICE_NOTFOUND) return res;
}
@@ -197,7 +197,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { case CNF_UNIQUEID:
{
- char *uid = (char*)CallProtoService(ci->szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ char *uid = (char*)CallProtoServiceInt(NULL,ci->szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid)
if ( !ProcessDatabaseValueDefault(ci, uid))
return 0;
@@ -208,7 +208,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { {
if ( !ProcessDatabaseValueDefault(ci, "display_uid"))
return 0;
- char *uid = (char*)CallProtoService(ci->szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ char *uid = (char*)CallProtoServiceInt(NULL,ci->szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid)
if ( !ProcessDatabaseValueDefault(ci, uid))
return 0;
@@ -252,7 +252,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) { case 5: // Unique id
{
// protocol must define a PFLAG_UNIQUEIDSETTING
- char *uid = (char*)CallProtoService(ci->szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ char *uid = (char*)CallProtoServiceInt(NULL,ci->szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid) {
if ( !GetDatabaseString(ci, uid, &dbv)) {
if (dbv.type == DBVT_BYTE || dbv.type == DBVT_WORD || dbv.type == DBVT_DWORD) {
@@ -482,7 +482,7 @@ static int ContactOptInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 };
odp.cbSize = sizeof(odp);
odp.position = -1000000000;
- odp.hInstance = hMirandaInst;
+ odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CONTACT);
odp.pszGroup = LPGEN("Customize");
odp.pszTitle = LPGEN("Contacts");
diff --git a/src/modules/database/database.cpp b/src/modules/database/database.cpp index 407cc4b4b2..c8743b3b30 100644 --- a/src/modules/database/database.cpp +++ b/src/modules/database/database.cpp @@ -77,7 +77,7 @@ int getProfilePath(TCHAR * buf, size_t cch) _tcscpy(profiledir, _T("%miranda_path%\\Profiles"));
TCHAR* exprofiledir = Utils_ReplaceVarsT(profiledir);
- size_t len = pathToAbsoluteT(exprofiledir, buf, NULL);
+ size_t len = PathToAbsoluteT(exprofiledir, buf, NULL);
mir_free(exprofiledir);
if (buf[len-1] == '/' || buf[len-1] == '\\')
@@ -184,7 +184,7 @@ void getProfileCmdLine(TCHAR * szProfile, size_t cch, TCHAR * profiledir) p = _tcsrchr(profileName, '.'); if (p) *p = 0;
mir_sntprintf(newProfileDir, cch, _T("%s\\%s\\"), profiledir, profileName);
- pathToAbsoluteT(buf, szProfile, newProfileDir);
+ PathToAbsoluteT(buf, szProfile, newProfileDir);
if (_tcschr(buf, '\\'))
{
@@ -511,7 +511,7 @@ static int FindMirandaForProfile(TCHAR * szProfile) int LoadDatabaseModule(void)
{
TCHAR szProfile[MAX_PATH];
- pathToAbsoluteT(_T("."), szProfile, NULL);
+ PathToAbsoluteT(_T("."), szProfile, NULL);
_tchdir(szProfile);
szProfile[0] = 0;
diff --git a/src/modules/database/dbini.cpp b/src/modules/database/dbini.cpp index e8836114c1..af15390857 100644 --- a/src/modules/database/dbini.cpp +++ b/src/modules/database/dbini.cpp @@ -193,7 +193,20 @@ int SettingsEnumProc(const char *szSetting, LPARAM lParam) return 0;
}
-void ConvertBackslashes(char *, UINT);
+static void ConvertBackslashes(char *str, UINT fileCp)
+{
+ char *pstr;
+ for (pstr = str; *pstr; pstr = CharNextExA(fileCp, pstr, 0)) {
+ if (*pstr == '\\') {
+ switch(pstr[1]) {
+ case 'n': *pstr = '\n'; break;
+ case 't': *pstr = '\t'; break;
+ case 'r': *pstr = '\r'; break;
+ default: *pstr = pstr[1]; break;
+ }
+ memmove(pstr+1, pstr+2, strlen(pstr+2) + 1);
+} } }
+
static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsafeSections, int secur, bool secFN)
{
FILE *fp = _tfopen(szIniPath, _T("rt"));
@@ -286,7 +299,7 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf warnInfo.szValue=szValue;
warnInfo.warnNoMore=0;
warnInfo.cancel=0;
- if (warnThisSection && IDNO == DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_WARNINICHANGE), NULL, WarnIniChangeDlgProc, (LPARAM)&warnInfo))
+ if (warnThisSection && IDNO == DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_WARNINICHANGE), NULL, WarnIniChangeDlgProc, (LPARAM)&warnInfo))
continue;
if (warnInfo.cancel)
break;
@@ -392,14 +405,14 @@ static void DoAutoExec(void) if (dbCreated && szOnCreateFilename[0]) {
str2 = Utils_ReplaceVarsT(szOnCreateFilename);
- pathToAbsoluteT(str2, szIniPath, NULL);
+ PathToAbsoluteT(str2, szIniPath, NULL);
mir_free(str2);
ProcessIniFile(szIniPath, szSafeSections, szUnsafeSections, 0, 1);
}
str2 = Utils_ReplaceVarsT(szFindPath);
- pathToAbsoluteT(str2, szFindPath, NULL);
+ PathToAbsoluteT(str2, szFindPath, NULL);
mir_free(str2);
WIN32_FIND_DATA fd;
@@ -419,7 +432,7 @@ static void DoAutoExec(void) mir_sntprintf(szIniPath, SIZEOF(szIniPath), _T("%s%s"), szFindPath, fd.cFileName);
if ( !lstrcmpi(szUse, _T("prompt")) && !secFN) {
- int result=DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_INSTALLINI), NULL, InstallIniDlgProc, (LPARAM)szIniPath);
+ int result=DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_INSTALLINI), NULL, InstallIniDlgProc, (LPARAM)szIniPath);
if (result == IDC_NOTOALL) break;
if (result == IDCANCEL) continue;
}
@@ -451,7 +464,7 @@ static void DoAutoExec(void) MoveFile(szIniPath, szNewPath);
}
else if ( !lstrcmpi(szOnCompletion, _T("ask")))
- DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_INIIMPORTDONE), NULL, IniImportDoneDlgProc, (LPARAM)szIniPath);
+ DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_INIIMPORTDONE), NULL, IniImportDoneDlgProc, (LPARAM)szIniPath);
}
} while (FindNextFile(hFind, &fd));
FindClose(hFind);
@@ -473,7 +486,7 @@ int InitIni(void) bModuleInitialized = true;
DoAutoExec();
- pathToAbsoluteT(_T("."), szMirandaDir, NULL);
+ PathToAbsoluteT(_T("."), szMirandaDir, NULL);
hIniChangeNotification=FindFirstChangeNotification(szMirandaDir, 0, FILE_NOTIFY_CHANGE_FILE_NAME);
if (hIniChangeNotification != INVALID_HANDLE_VALUE) {
CreateServiceFunction("DB/Ini/CheckImportNow", CheckIniImportNow);
diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp index dede30691b..54b352bb4d 100644 --- a/src/modules/database/dbutils.cpp +++ b/src/modules/database/dbutils.cpp @@ -207,7 +207,7 @@ static INT_PTR DbEventGetStringT(WPARAM wParam, LPARAM lParam) char* string = (char*)lParam;
if (dbei->flags & DBEF_UTF)
- return (INT_PTR)Utf8DecodeUcs2(string);
+ return (INT_PTR)Utf8DecodeW(string);
return (INT_PTR)mir_a2t(string);
}
diff --git a/src/modules/database/profilemanager.cpp b/src/modules/database/profilemanager.cpp index 1ddccf0c95..898fc323d6 100644 --- a/src/modules/database/profilemanager.cpp +++ b/src/modules/database/profilemanager.cpp @@ -312,11 +312,11 @@ BOOL EnumProfilesForList(TCHAR * fullpath, TCHAR * profile, LPARAM lParam) } }
item2.iSubItem = 3;
- item2.pszText = rtrim(_tctime(&statbuf.st_ctime));
+ item2.pszText = trtrim(_tctime(&statbuf.st_ctime));
SendMessage(hwndList, LVM_SETITEMTEXT, iItem, (LPARAM)&item2);
item2.iSubItem = 4;
- item2.pszText = rtrim(_tctime(&statbuf.st_mtime));
+ item2.pszText = trtrim(_tctime(&statbuf.st_mtime));
SendMessage(hwndList, LVM_SETITEMTEXT, iItem, (LPARAM)&item2);
}
return TRUE;
@@ -537,8 +537,8 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, struct DlgProfData * prof = (struct DlgProfData *)lParam;
PROPSHEETHEADER *psh = prof->psh;
TranslateDialogDefault(hwndDlg);
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadImage(hMirandaInst, MAKEINTRESOURCE(IDI_USERDETAILS), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadImage(hMirandaInst, MAKEINTRESOURCE(IDI_USERDETAILS), IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_USERDETAILS), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_USERDETAILS), IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0));
dat = (struct DetailsData*)mir_alloc(sizeof(struct DetailsData));
dat->prof = prof;
prof->hwndOK = GetDlgItem(hwndDlg, IDOK);
@@ -805,7 +805,7 @@ int getProfileManager(PROFILEMANAGERDATA * pd) odp.pszTitle = LPGEN("My Profiles");
odp.pfnDlgProc = DlgProfileSelect;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_PROFILE_SELECTION);
- odp.hInstance = hMirandaInst;
+ odp.hInstance = hInst;
AddProfileManagerPage(&opi, &odp);
odp.pszTitle = LPGEN("New Profile");
@@ -825,7 +825,7 @@ int getProfileManager(PROFILEMANAGERDATA * pd) DlgProfData prof;
prof.pd = pd;
prof.psh = &psh;
- int rc = DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_PROFILEMANAGER), NULL, DlgProfileManager, (LPARAM)&prof);
+ int rc = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_PROFILEMANAGER), NULL, DlgProfileManager, (LPARAM)&prof);
if (rc != -1)
for (int i=0; i < opi.pageCount; i++) {
diff --git a/src/modules/findadd/findadd.cpp b/src/modules/findadd/findadd.cpp index 4763836180..297b418067 100644 --- a/src/modules/findadd/findadd.cpp +++ b/src/modules/findadd/findadd.cpp @@ -194,7 +194,7 @@ static void ShowAdvancedSearchDlg(HWND hwndDlg, struct FindAddDlgData *dat) if (szProto == NULL) return;
if (dat->hwndAdvSearch == NULL) {
RECT rc;
- dat->hwndAdvSearch=(HWND)CallProtoService(szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)hwndDlg);
+ dat->hwndAdvSearch=(HWND)CallProtoServiceInt(NULL,szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)hwndDlg);
GetWindowRect(GetDlgItem(hwndDlg, IDC_RESULTS), &rc);
SetWindowPos(dat->hwndAdvSearch, 0, rc.left, rc.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE);
}
@@ -225,7 +225,7 @@ static void ShowTinySearchDlg(HWND hwndDlg, struct FindAddDlgData *dat) char *szProto=(char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0);
if (szProto == NULL) return;
if (dat->hwndTinySearch == NULL) {
- dat->hwndTinySearch=(HWND)CallProtoService(szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)/*GetDlgItem(*/hwndDlg/*, IDC_TINYEXTENDEDGROUP)*/);
+ dat->hwndTinySearch=(HWND)CallProtoServiceInt(NULL,szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)/*GetDlgItem(*/hwndDlg/*, IDC_TINYEXTENDEDGROUP)*/);
if (dat->hwndTinySearch)
ReposTinySearchDlg(hwndDlg, dat);
else
@@ -291,8 +291,8 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP dat->notSearchedYet=1;
dat->iLastColumnSortIndex=1;
dat->bSortAscending=1;
- dat->hBmpSortUp=(HBITMAP)LoadImage(hMirandaInst, MAKEINTRESOURCE(IDB_SORTCOLUP), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
- dat->hBmpSortDown=(HBITMAP)LoadImage(hMirandaInst, MAKEINTRESOURCE(IDB_SORTCOLDOWN), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
+ dat->hBmpSortUp=(HBITMAP)LoadImage(hInst, MAKEINTRESOURCE(IDB_SORTCOLUP), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
+ dat->hBmpSortDown=(HBITMAP)LoadImage(hInst, MAKEINTRESOURCE(IDB_SORTCOLDOWN), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
SendDlgItemMessage(hwndDlg, IDC_MOREOPTIONS, BUTTONSETARROW, 1, 0);
ListView_SetExtendedListViewStyle(hwndList, LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP);
@@ -344,7 +344,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (i=0, netProtoCount=0; i < accounts.getCount(); i++) {
if ( !Proto_IsAccountEnabled(accounts[i])) continue;
- DWORD caps = (DWORD)CallProtoService(accounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
+ DWORD caps = (DWORD)CallProtoServiceInt(NULL,accounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if (caps & PF1_BASICSEARCH || caps & PF1_EXTSEARCH || caps & PF1_SEARCHBYEMAIL || caps & PF1_SEARCHBYNAME)
netProtoCount++;
}
@@ -366,14 +366,14 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (i=0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[i];
if ( !Proto_IsAccountEnabled(pa)) continue;
- DWORD caps=(DWORD)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
+ DWORD caps=(DWORD)CallProtoServiceInt(NULL,pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if ( !(caps&PF1_BASICSEARCH) && !(caps&PF1_EXTSEARCH) && !(caps&PF1_SEARCHBYEMAIL) && !(caps&PF1_SEARCHBYNAME))
continue;
cbei.pszText = pa->tszAccountName;
GetTextExtentPoint32(hdc, cbei.pszText, lstrlen(cbei.pszText), &textSize);
if (textSize.cx>cbwidth) cbwidth = textSize.cx;
- hIcon=(HICON)CallProtoService(pa->szModuleName, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
+ hIcon=(HICON)CallProtoServiceInt(NULL,pa->szModuleName, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
cbei.iImage=cbei.iSelectedImage=ImageList_AddIcon(dat->himlComboIcons, hIcon);
DestroyIcon(hIcon);
cbei.lParam=(LPARAM)pa->szModuleName;
@@ -398,7 +398,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP { UTILRESIZEDIALOG urd={0};
urd.cbSize=sizeof(urd);
urd.hwndDlg=hwndDlg;
- urd.hInstance=hMirandaInst;
+ urd.hInstance=hInst;
urd.lpTemplate=MAKEINTRESOURCEA(IDD_FINDADD);
urd.lParam=(LPARAM)dat;
urd.pfnResizer=FindAddDlgResizer;
@@ -452,13 +452,13 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (i=0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[i];
if ( !Proto_IsAccountEnabled(pa)) continue;
- protoCaps=(DWORD)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
+ protoCaps=(DWORD)CallProtoServiceInt(NULL,pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if (protoCaps&PF1_SEARCHBYEMAIL) dat->showEmail=1;
if (protoCaps&PF1_SEARCHBYNAME) dat->showName=1;
}
}
else {
- protoCaps=(DWORD)CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
+ protoCaps=(DWORD)CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_1, 0);
if (protoCaps&PF1_BASICSEARCH) dat->showProtoId=1;
if (protoCaps&PF1_SEARCHBYEMAIL) dat->showEmail=1;
if (protoCaps&PF1_SEARCHBYNAME) dat->showName=1;
@@ -467,7 +467,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (protoCaps&PF1_USERIDISEMAIL && dat->showProtoId) {dat->showProtoId=0; dat->showEmail=1;}
if (dat->showProtoId) {
char *szUniqueId;
- szUniqueId=(char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
+ szUniqueId=(char*)CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
if (szUniqueId) {
#if defined(_UNICODE)
TCHAR* p = mir_a2u(szUniqueId);
@@ -518,7 +518,8 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendMessage(hwndDlg, WM_SIZE, 0, 0);
SendMessage(hwndDlg, WM_GETMINMAXINFO, 0, (LPARAM)&mmi);
GetWindowRect(hwndDlg, &rc);
- if (rc.bottom-rc.top<mmi.ptMinTrackSize.y) SetWindowPos(hwndDlg, 0, 0, 0, rc.right-rc.left, mmi.ptMinTrackSize.y, SWP_NOZORDER|SWP_NOMOVE);
+ if (rc.bottom-rc.top<mmi.ptMinTrackSize.y)
+ SetWindowPos(hwndDlg, 0, 0, 0, rc.right-rc.left, mmi.ptMinTrackSize.y, SWP_NOZORDER|SWP_NOMOVE);
break;
}
case WM_TIMER:
@@ -657,7 +658,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP else if (IsDlgButtonChecked(hwndDlg, IDC_BYPROTOID)) {
TCHAR str[256];
GetDlgItemText(hwndDlg, IDC_PROTOID, str, SIZEOF(str));
- rtrim(str);
+ trtrim(str);
if (str[0] == 0)
MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_OK);
else
@@ -666,7 +667,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP else if (IsDlgButtonChecked(hwndDlg, IDC_BYEMAIL)) {
TCHAR str[256];
GetDlgItemText(hwndDlg, IDC_EMAIL, str, SIZEOF(str));
- rtrim(str);
+ trtrim(str);
if (str[0] == 0)
MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_OK);
else
@@ -726,7 +727,8 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
TCHAR str[256];
GetDlgItemText(hwndDlg, IDC_PROTOID, str, SIZEOF(str));
- if (*rtrim(str) == 0) break;
+ if (*trtrim(str) == 0)
+ break;
PROTOSEARCHRESULT psr = {0};
psr.cbSize = sizeof(psr);
@@ -975,12 +977,12 @@ static INT_PTR FindAddCommand(WPARAM, LPARAM) for (i=0, netProtoCount=0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[i];
if ( !Proto_IsAccountEnabled(pa)) continue;
- int protoCaps=CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
+ int protoCaps=CallProtoServiceInt(NULL,pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if (protoCaps&PF1_BASICSEARCH || protoCaps&PF1_SEARCHBYEMAIL || protoCaps&PF1_SEARCHBYNAME
|| protoCaps&PF1_EXTSEARCHUI) netProtoCount++;
}
if (netProtoCount > 0)
- hwndFindAdd=CreateDialog(hMirandaInst, MAKEINTRESOURCE(IDD_FINDADD), NULL, DlgProcFindAdd);
+ hwndFindAdd=CreateDialog(hInst, MAKEINTRESOURCE(IDD_FINDADD), NULL, DlgProcFindAdd);
}
return 0;
}
@@ -1018,7 +1020,7 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) // Make sure we have some networks to search on.
for (i=0, netProtoCount=0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[i];
- int protoCaps = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
+ int protoCaps = CallProtoServiceInt(NULL,pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if (protoCaps & (PF1_BASICSEARCH | PF1_SEARCHBYEMAIL | PF1_SEARCHBYNAME | PF1_EXTSEARCHUI))
netProtoCount++;
}
diff --git a/src/modules/findadd/searchresults.cpp b/src/modules/findadd/searchresults.cpp index 2422f262d1..5352bfd6a7 100644 --- a/src/modules/findadd/searchresults.cpp +++ b/src/modules/findadd/searchresults.cpp @@ -87,7 +87,7 @@ void LoadColumnSizes(HWND hwndResults, const char *szProto) if (szProto)
{
bNeedsFree = TRUE;
- lvc.pszText = mir_a2t((char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0));
+ lvc.pszText = mir_a2t((char*)CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0));
}
else
lvc.pszText = _T("ID");
@@ -215,9 +215,9 @@ int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const cha for (i=0; i < accounts.getCount();i++) {
PROTOACCOUNT* pa = accounts[i];
if ( !Proto_IsAccountEnabled(pa)) continue;
- DWORD caps=(DWORD)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
+ DWORD caps=(DWORD)CallProtoServiceInt(NULL,pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if ( !(caps&requiredCapability)) continue;
- dat->search[dat->searchCount].hProcess = (HANDLE)CallProtoService(pa->szModuleName, szSearchService, 0, (LPARAM)pvSearchParams);
+ dat->search[dat->searchCount].hProcess = (HANDLE)CallProtoServiceInt(NULL,pa->szModuleName, szSearchService, 0, (LPARAM)pvSearchParams);
dat->search[dat->searchCount].szProto = pa->szModuleName;
if (dat->search[dat->searchCount].hProcess == NULL) failures++;
else dat->searchCount++;
@@ -234,7 +234,7 @@ int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const cha else {
dat->search=(struct ProtoSearchInfo*)mir_alloc(sizeof(struct ProtoSearchInfo));
dat->searchCount=1;
- dat->search[0].hProcess=(HANDLE)CallProtoService(szProto, szSearchService, 0, (LPARAM)pvSearchParams);
+ dat->search[0].hProcess=(HANDLE)CallProtoServiceInt(NULL,szProto, szSearchService, 0, (LPARAM)pvSearchParams);
dat->search[0].szProto=szProto;
if (dat->search[0].hProcess == NULL) {
//infuriatingly vague error message. fixme.
@@ -358,7 +358,7 @@ void ShowMoreOptionsMenu(HWND hwndDlg, int x, int y) lsr=(struct ListSearchResult*)lvi.lParam;
}
- hMenu=LoadMenu(hMirandaInst, MAKEINTRESOURCE(IDR_CONTEXT));
+ hMenu=LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT));
hPopupMenu=GetSubMenu(hMenu, 4);
TranslateMenu(hPopupMenu);
commandId=TrackPopupMenu(hPopupMenu, TPM_RIGHTBUTTON|TPM_RETURNCMD, x, y, 0, hwndDlg, NULL);
@@ -375,13 +375,13 @@ void ShowMoreOptionsMenu(HWND hwndDlg, int x, int y) }
case IDC_DETAILS:
{ HANDLE hContact;
- hContact=(HANDLE)CallProtoService(lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr);
+ hContact=(HANDLE)CallProtoServiceInt(NULL,lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr);
CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0);
break;
}
case IDC_SENDMESSAGE:
{ HANDLE hContact;
- hContact=(HANDLE)CallProtoService(lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr);
+ hContact=(HANDLE)CallProtoServiceInt(NULL,lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr);
CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, (LPARAM)(const char*)NULL);
break;
}
diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp index c026e26d72..8c82f5ac91 100644 --- a/src/modules/fonts/FontOptions.cpp +++ b/src/modules/fonts/FontOptions.cpp @@ -371,7 +371,7 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const TCHAR *groupName, if (sectionName = _tcschr(sectionName, '/'))
*sectionName = 0;
- pItemName = LangPackTranslateStringT(hLangpack, pItemName);
+ pItemName = TranslateTH(hLangpack, pItemName);
hItem = sttFindNamedTreeItemAt(hwndTree, hSection, pItemName);
if ( !sectionName || !hItem) {
@@ -528,7 +528,7 @@ static INT_PTR CALLBACK ChooseEffectDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wPar static BOOL ChooseEffectDialog(HWND hwndParent, FONTEFFECT * es)
{
- return (DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_CHOOSE_FONT_EFFECT), hwndParent, ChooseEffectDlgProc, (LPARAM) es) == IDOK);
+ return (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CHOOSE_FONT_EFFECT), hwndParent, ChooseEffectDlgProc, (LPARAM) es) == IDOK);
}
static void sttSaveFontData(HWND hwndDlg, FontInternal &F)
@@ -1014,14 +1014,14 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, {
cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS | CF_EFFECTS | CF_ENABLETEMPLATE | CF_ENABLEHOOK;
// use custom font dialog to disable colour selection
- cf.hInstance = hMirandaInst;
+ cf.hInstance = hInst;
cf.lpTemplateName = MAKEINTRESOURCE(IDD_CUSTOM_FONT);
cf.lpfnHook = CFHookProc;
}
else if (F.flags & FIDF_DISABLESTYLES) { // no style selection, mutually exclusive with FIDF_ALLOWEFFECTS
cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS | CF_ENABLETEMPLATE | CF_ENABLEHOOK | CF_TTONLY | CF_NOOEMFONTS;
cf.lCustData = F.flags;
- cf.hInstance = hMirandaInst;
+ cf.hInstance = hInst;
cf.lpTemplateName = MAKEINTRESOURCE(IDD_CUSTOM_FONT);
cf.lpfnHook = CFHookProc;
lf.lfWeight = FW_NORMAL;
@@ -1284,7 +1284,7 @@ int OptInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = {0};
odp.cbSize = sizeof(odp);
odp.position = -790000000;
- odp.hInstance = hMirandaInst;;
+ odp.hInstance = hInst;;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FONTS);
odp.pszTitle = LPGEN("Fonts & Colors");
odp.pszGroup = LPGEN("Customize");
@@ -1390,7 +1390,7 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar if (pf->flags & FIDF_ALLOWEFFECTS) {
cf.Flags |= CF_EFFECTS | CF_ENABLETEMPLATE | CF_ENABLEHOOK;
// use custom font dialog to disable colour selection
- cf.hInstance = hMirandaInst;
+ cf.hInstance = hInst;
cf.lpTemplateName = MAKEINTRESOURCE(IDD_CUSTOM_FONT);
cf.lpfnHook = CFHookProc;
}
@@ -1452,7 +1452,7 @@ int FontsModernOptInit(WPARAM wParam, LPARAM lParam) obj.cbSize = sizeof(obj);
obj.dwFlags = MODEROPT_FLG_TCHAR|MODEROPT_FLG_NORESIZE;
obj.hIcon = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA);
- obj.hInstance = hMirandaInst;
+ obj.hInstance = hInst;
obj.iSection = MODERNOPT_PAGE_SKINS;
obj.iType = MODERNOPT_TYPE_SUBSECTIONPAGE;
obj.iBoldControls = iBoldControls;
diff --git a/src/modules/fonts/FontService.h b/src/modules/fonts/FontService.h index 8042d668bf..578649f13b 100644 --- a/src/modules/fonts/FontService.h +++ b/src/modules/fonts/FontService.h @@ -30,7 +30,7 @@ struct FontInternal : public FontIDT FontSettingsT value;
int hLangpack;
- __inline TCHAR* getName() const { return LangPackTranslateStringT(hLangpack, name); }
+ __inline TCHAR* getName() const { return TranslateTH(hLangpack, name); }
__inline bool isHeader() const
{
@@ -46,7 +46,7 @@ struct FontInternal : public FontIDT struct ColourInternal : public ColourIDT
{
- __inline TCHAR* getName() const { return LangPackTranslateStringT(hLangpack, name); }
+ __inline TCHAR* getName() const { return TranslateTH(hLangpack, name); }
COLORREF value;
int hLangpack;
@@ -54,7 +54,7 @@ struct ColourInternal : public ColourIDT struct EffectInternal : public EffectIDT
{
- __inline TCHAR* getName() const { return LangPackTranslateStringT(hLangpack, name); }
+ __inline TCHAR* getName() const { return TranslateTH(hLangpack, name); }
int hLangpack;
};
diff --git a/src/modules/fonts/services.cpp b/src/modules/fonts/services.cpp index 09ac106fb5..adc5d216f2 100644 --- a/src/modules/fonts/services.cpp +++ b/src/modules/fonts/services.cpp @@ -297,22 +297,21 @@ static int sttRegisterFontWorker(FontIDW* font_id, int hLangpack) char idstr[256];
mir_snprintf(idstr, SIZEOF(idstr), "%sFlags", font_id->prefix);
DBWriteContactSettingDword(0, font_id->dbSettingsGroup, idstr, font_id->flags);
- {
- FontInternal* newItem = new FontInternal;
- memset(newItem, 0, sizeof(FontIDW));
- memcpy(newItem, font_id, font_id->cbSize);
-
- if ( !lstrcmp(newItem->deffontsettings.szFace, _T("MS Shell Dlg"))) {
- LOGFONT lf;
- SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, FALSE);
- lstrcpyn(newItem->deffontsettings.szFace, lf.lfFaceName, SIZEOF(newItem->deffontsettings.szFace));
- if ( !newItem->deffontsettings.size)
- newItem->deffontsettings.size = lf.lfHeight;
- }
-
- UpdateFontSettings(font_id, &newItem->value);
- font_id_list.insert(newItem);
+
+ FontInternal* newItem = new FontInternal;
+ memset(newItem, 0, sizeof(FontIDW));
+ memcpy(newItem, font_id, font_id->cbSize);
+
+ if ( !lstrcmp(newItem->deffontsettings.szFace, _T("MS Shell Dlg"))) {
+ LOGFONT lf;
+ SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, FALSE);
+ lstrcpyn(newItem->deffontsettings.szFace, lf.lfFaceName, SIZEOF(newItem->deffontsettings.szFace));
+ if ( !newItem->deffontsettings.size)
+ newItem->deffontsettings.size = lf.lfHeight;
}
+
+ UpdateFontSettings(font_id, &newItem->value);
+ font_id_list.insert(newItem);
return 0;
}
@@ -344,7 +343,8 @@ static INT_PTR sttGetFontWorker(FontIDW* font_id, LOGFONT* lf) }
return colour;
- } }
+ }
+ }
GetDefaultFontSetting(lf, &colour);
return colour;
@@ -358,9 +358,10 @@ INT_PTR GetFontW(WPARAM wParam, LPARAM lParam) INT_PTR GetFont(WPARAM wParam, LPARAM lParam)
{
FontIDW temp;
- LOGFONT lftemp;
- if ( !ConvertFontID((FontID*)wParam, &temp)) return -1;
+ if ( !ConvertFontID((FontID*)wParam, &temp))
+ return -1;
+ LOGFONT lftemp;
int ret = sttGetFontWorker(&temp, &lftemp);
ConvertLOGFONT(&lftemp, (LOGFONTA*)lParam);
return ret;
@@ -436,7 +437,6 @@ INT_PTR GetColour(WPARAM wParam, LPARAM) void UpdateEffectSettings(EffectIDW* effect_id, FONTEFFECT* effectsettings)
{
char str[256];
-
mir_snprintf(str, SIZEOF(str), "%sEffect", effect_id->setting);
effectsettings->effectIndex = DBGetContactSettingByte(NULL, effect_id->dbSettingsGroup, str, effect_id->defeffect.effectIndex);
diff --git a/src/modules/help/about.cpp b/src/modules/help/about.cpp index 2d7616c0ed..93f869466a 100644 --- a/src/modules/help/about.cpp +++ b/src/modules/help/about.cpp @@ -67,9 +67,9 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar }
ShowWindow(GetDlgItem(hwndDlg, IDC_CREDITSFILE), SW_HIDE);
{
- HRSRC hResInfo = FindResource(hMirandaInst, MAKEINTRESOURCE(IDR_CREDITS), _T("TEXT"));
- DWORD ResSize = SizeofResource(hMirandaInst, hResInfo);
- HGLOBAL hRes = LoadResource(hMirandaInst, hResInfo);
+ HRSRC hResInfo = FindResource(hInst, MAKEINTRESOURCE(IDR_CREDITS), _T("TEXT"));
+ DWORD ResSize = SizeofResource(hInst, hResInfo);
+ HGLOBAL hRes = LoadResource(hInst, hResInfo);
char* pszMsg = (char*)LockResource(hRes);
if (pszMsg)
{
diff --git a/src/modules/help/help.cpp b/src/modules/help/help.cpp index 33b37e86b0..a1984ca32e 100644 --- a/src/modules/help/help.cpp +++ b/src/modules/help/help.cpp @@ -34,7 +34,7 @@ static INT_PTR AboutCommand(WPARAM wParam, LPARAM) SetFocus(hAboutDlg);
return 0;
}
- hAboutDlg=CreateDialog(hMirandaInst, MAKEINTRESOURCE(IDD_ABOUT), (HWND)wParam, DlgProcAbout);
+ hAboutDlg=CreateDialog(hInst, MAKEINTRESOURCE(IDD_ABOUT), (HWND)wParam, DlgProcAbout);
return 0;
}
diff --git a/src/modules/history/history.cpp b/src/modules/history/history.cpp index 8e759f471c..218b040d01 100644 --- a/src/modules/history/history.cpp +++ b/src/modules/history/history.cpp @@ -39,7 +39,7 @@ static INT_PTR UserHistoryCommand(WPARAM wParam, LPARAM) SetFocus(hwnd);
return 0;
}
- CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_HISTORY), NULL, DlgProcHistory, wParam);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_HISTORY), NULL, DlgProcHistory, wParam);
return 0;
}
@@ -290,7 +290,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP UTILRESIZEDIALOG urd={0};
urd.cbSize=sizeof(urd);
urd.hwndDlg=hwndDlg;
- urd.hInstance=hMirandaInst;
+ urd.hInstance=hInst;
urd.lpTemplate=MAKEINTRESOURCEA(IDD_HISTORY);
urd.lParam=(LPARAM)NULL;
urd.pfnResizer=HistoryDlgResizer;
@@ -305,7 +305,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP return TRUE;
case IDC_FIND:
- ShowWindow(CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_HISTORY_FIND), hwndDlg, DlgProcHistoryFind, (LPARAM)hwndDlg), SW_SHOW);
+ ShowWindow(CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_HISTORY_FIND), hwndDlg, DlgProcHistoryFind, (LPARAM)hwndDlg), SW_SHOW);
return TRUE;
case IDC_DELETEHISTORY:
diff --git a/src/modules/icolib/IcoLib.h b/src/modules/icolib/IcoLib.h index 30121729a8..550de7ad9b 100644 --- a/src/modules/icolib/IcoLib.h +++ b/src/modules/icolib/IcoLib.h @@ -75,7 +75,7 @@ struct IconItem HICON temp_icon;
BOOL temp_reset;
- __inline TCHAR* getDescr() const { return LangPackTranslateStringT(hLangpack, description); }
+ __inline TCHAR* getDescr() const { return TranslateTH(hLangpack, description); }
};
// extracticon.c
diff --git a/src/modules/icolib/skin2icons.cpp b/src/modules/icolib/skin2icons.cpp index 2d6d9ab9cd..7001bbae3b 100644 --- a/src/modules/icolib/skin2icons.cpp +++ b/src/modules/icolib/skin2icons.cpp @@ -112,7 +112,7 @@ IconSourceFile* IconSourceFile_Get(const TCHAR* file, bool isPath) return NULL;
if (isPath)
- pathToAbsoluteT(file, fileFull, NULL);
+ PathToAbsoluteT(file, fileFull, NULL);
/// TODO: convert path to long - eliminate duplicate items
else
_tcscpy(fileFull, file);
@@ -534,9 +534,9 @@ HANDLE IcoLib_AddNewIcon(int hLangpack, SKINICONDESC* sid) if (sid->pszDefaultFile) {
WCHAR fileFull[ MAX_PATH ];
if (utf_path)
- pathToAbsoluteT(sid->pwszDefaultFile, fileFull, NULL);
+ PathToAbsoluteT(sid->pwszDefaultFile, fileFull, NULL);
else
- pathToAbsoluteT( StrConvT(sid->pszDefaultFile), fileFull, NULL);
+ PathToAbsoluteT( StrConvT(sid->pszDefaultFile), fileFull, NULL);
item->default_file = mir_wstrdup(fileFull);
}
item->default_indx = sid->iDefaultIndex;
diff --git a/src/modules/icolib/skin2opts.cpp b/src/modules/icolib/skin2opts.cpp index 0d230d7930..9c6f3f2a41 100644 --- a/src/modules/icolib/skin2opts.cpp +++ b/src/modules/icolib/skin2opts.cpp @@ -56,7 +56,7 @@ static HICON ExtractIconFromPath(const TCHAR *path, int cxIcon, int cyIcon) n = _ttoi(comma+1);
*comma = 0;
}
- pathToAbsoluteT(file, fileFull, NULL);
+ PathToAbsoluteT(file, fileFull, NULL);
hIcon = NULL;
//SHOULD BE REPLACED WITH GOOD ENOUGH FUNCTION
@@ -242,7 +242,7 @@ static int OpenPopupMenu(HWND hwndDlg) int cmd;
GetCursorPos(&pt);
- hMenu = LoadMenu(hMirandaInst, MAKEINTRESOURCE(IDR_ICOLIB_CONTEXT));
+ hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_ICOLIB_CONTEXT));
hPopup = GetSubMenu(hMenu, 0);
TranslateMenu(hPopup);
cmd = TrackPopupMenu(hPopup, TPM_RIGHTBUTTON|TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
@@ -586,7 +586,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if ( !IsIconic(hwndDlg)) {
UTILRESIZEDIALOG urd = {0};
urd.cbSize = sizeof(urd);
- urd.hInstance = hMirandaInst;
+ urd.hInstance = hInst;
urd.hwndDlg = hwndDlg;
urd.lParam = 0; // user-defined
urd.lpTemplate = MAKEINTRESOURCEA(IDD_ICOLIB_IMPORT);
@@ -856,7 +856,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_COMMAND:
if (LOWORD(wParam) == IDC_IMPORT) {
- dat->hwndIndex = CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_ICOLIB_IMPORT), GetParent(hwndDlg), DlgProcIconImport, (LPARAM)hwndDlg);
+ dat->hwndIndex = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ICOLIB_IMPORT), GetParent(hwndDlg), DlgProcIconImport, (LPARAM)hwndDlg);
EnableWindow((HWND)lParam, FALSE);
}
else if (LOWORD(wParam) == IDC_GETMORE) {
@@ -1037,7 +1037,7 @@ int SkinOptionsInit(WPARAM wParam, LPARAM) {
OPTIONSDIALOGPAGE odp = {0};
odp.cbSize = sizeof(odp);
- odp.hInstance = hMirandaInst;
+ odp.hInstance = hInst;
odp.flags = ODPF_BOLDGROUPS;
odp.position = -180000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ICOLIB);
diff --git a/src/modules/idle/idle.cpp b/src/modules/idle/idle.cpp index d502e99e13..2577812207 100644 --- a/src/modules/idle/idle.cpp +++ b/src/modules/idle/idle.cpp @@ -441,7 +441,7 @@ static int IdleOptInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 };
odp.cbSize = sizeof(odp);
odp.position = 100000000;
- odp.hInstance = hMirandaInst;
+ odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_IDLE);
odp.pszGroup = LPGEN("Status");
odp.pszTitle = LPGEN("Idle");
@@ -477,7 +477,7 @@ static int IdleModernOptInit(WPARAM wParam, LPARAM) MODERNOPTOBJECT obj = {0};
obj.cbSize = sizeof(obj);
- obj.hInstance = hMirandaInst;
+ obj.hInstance = hInst;
obj.dwFlags = MODEROPT_FLG_TCHAR | MODEROPT_FLG_NORESIZE;
obj.iSection = MODERNOPT_PAGE_STATUS;
obj.iType = MODERNOPT_TYPE_SECTIONPAGE;
diff --git a/src/modules/ignore/ignore.cpp b/src/modules/ignore/ignore.cpp index bc9cf143f8..b5b88343d0 100644 --- a/src/modules/ignore/ignore.cpp +++ b/src/modules/ignore/ignore.cpp @@ -178,8 +178,8 @@ static void SetAllContactIcons(HWND hwndList) szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if (szProto == NULL) proto1Caps=proto4Caps=0;
else {
- proto1Caps=CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
- proto4Caps=CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0);
+ proto1Caps=CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_1, 0);
+ proto4Caps=CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_4, 0);
}
InitialiseItem(hwndList, hContact, hItem, proto1Caps, proto4Caps);
if ( !DBGetContactSettingByte(hContact, "CList", "Hidden", 0))
@@ -345,7 +345,7 @@ static int IgnoreOptInitialise(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 };
odp.cbSize = sizeof(odp);
odp.position = 900000000;
- odp.hInstance = hMirandaInst;
+ odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_IGNORE);
odp.pszTitle = LPGEN("Ignore");
odp.pszGroup = LPGEN("Events");
@@ -437,7 +437,7 @@ static int IgnoreModernOptInit(WPARAM wParam, LPARAM) MODERNOPTOBJECT obj = {0};
obj.cbSize = sizeof(obj);
- obj.hInstance = hMirandaInst;
+ obj.hInstance = hInst;
obj.dwFlags = MODEROPT_FLG_TCHAR;
obj.iSection = MODERNOPT_PAGE_IGNORE;
obj.iType = MODERNOPT_TYPE_SECTIONPAGE;
diff --git a/src/modules/langpack/lpservices.cpp b/src/modules/langpack/lpservices.cpp index 983d069fda..af4262783c 100644 --- a/src/modules/langpack/lpservices.cpp +++ b/src/modules/langpack/lpservices.cpp @@ -2,8 +2,8 @@ Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
-all portions of this codebase are copyrighted to the people
+Copyright 2000-2009 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
listed in contributors.txt.
This program is free software; you can redistribute it and/or
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -22,104 +22,28 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "..\..\core\commonheaders.h"
-#define FLAGS LANG_UNICODE
-
-LangPackMuuid* __fastcall LangPackLookupUuid(WPARAM);
-int LangPackMarkPluginLoaded(PLUGININFOEX* pInfo);
+MIR_CORE_DLL(int) LangPackMarkPluginLoaded(PLUGININFOEX* pInfo);
/////////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR TranslateString(WPARAM wParam, LPARAM lParam)
-{
- return (INT_PTR)LangPackTranslateString(LangPackLookupUuid(wParam), (const char *)lParam, (wParam & LANG_UNICODE) ? 1 : 0);
-}
-
-TCHAR* LangPackTranslateStringT(int hLangpack, const TCHAR* tszEnglish)
+static INT_PTR srvTranslateString(WPARAM wParam, LPARAM lParam)
{
- LangPackMuuid* pUuid = (hLangpack) ? LangPackLookupUuid(hLangpack) : 0;
- return (TCHAR*)LangPackTranslateString(pUuid, (LPCSTR)tszEnglish, 1);
+ if (wParam & LANG_UNICODE)
+ return (INT_PTR)TranslateW_LP((const WCHAR*)lParam, wParam);
+ return (INT_PTR)TranslateA_LP((const char *)lParam, wParam);
}
/////////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR TranslateMenu(WPARAM wParam, LPARAM lParam)
-{
- HMENU hMenu = (HMENU)wParam;
- LangPackMuuid* uuid = LangPackLookupUuid(lParam);
-
- MENUITEMINFO mii;
- mii.cbSize = MENUITEMINFO_V4_SIZE;
- for (int i = GetMenuItemCount(hMenu)-1; i >= 0; i--) {
- TCHAR str[256];
- mii.fMask = MIIM_TYPE|MIIM_SUBMENU;
- mii.dwTypeData = (TCHAR*)str;
- mii.cch = SIZEOF(str);
- GetMenuItemInfo(hMenu, i, TRUE, &mii);
-
- if (mii.cch && mii.dwTypeData) {
- TCHAR* result = (TCHAR*)LangPackTranslateString(uuid, (const char*)mii.dwTypeData, FLAGS);
- if (result != mii.dwTypeData) {
- mii.dwTypeData = result;
- mii.fMask = MIIM_TYPE;
- SetMenuItemInfo(hMenu, i, TRUE, &mii);
- } }
-
- if (mii.hSubMenu != NULL) TranslateMenu((WPARAM)mii.hSubMenu, lParam);
- }
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-static void TranslateWindow(LangPackMuuid* pUuid, HWND hwnd)
-{
- TCHAR title[2048];
- GetWindowText(hwnd, title, SIZEOF(title));
- {
- TCHAR* result = (TCHAR*)LangPackTranslateString(pUuid, (const char*)title, FLAGS);
- if (result != title)
- SetWindowText(hwnd, result);
-} }
-
-static BOOL CALLBACK TranslateDialogEnumProc(HWND hwnd, LPARAM lParam)
-{
- LANGPACKTRANSLATEDIALOG *lptd = (LANGPACKTRANSLATEDIALOG*)lParam;
- TCHAR szClass[32];
- int i, id = GetDlgCtrlID(hwnd);
-
- if (lptd->ignoreControls != NULL)
- for (i=0; lptd->ignoreControls[i]; i++)
- if (lptd->ignoreControls[i] == id)
- return TRUE;
-
- LangPackMuuid* uuid = LangPackLookupUuid(lptd->flags);
-
- GetClassName(hwnd, szClass, SIZEOF(szClass));
- if ( !lstrcmpi(szClass, _T("static")) || !lstrcmpi(szClass, _T("hyperlink")) || !lstrcmpi(szClass, _T("button")) || !lstrcmpi(szClass, _T("MButtonClass")) || !lstrcmpi(szClass, _T("MHeaderbarCtrl")))
- TranslateWindow(uuid, hwnd);
- else if ( !lstrcmpi(szClass, _T("edit"))) {
- if (lptd->flags & LPTDF_NOIGNOREEDIT || GetWindowLongPtr(hwnd, GWL_STYLE) & ES_READONLY)
- TranslateWindow(uuid, hwnd);
- }
- return TRUE;
-}
-
-static INT_PTR TranslateDialog(WPARAM wParam, LPARAM lParam)
+static INT_PTR srvTranslateMenu(WPARAM wParam, LPARAM lParam)
{
- LANGPACKTRANSLATEDIALOG *lptd = (LANGPACKTRANSLATEDIALOG*)lParam;
- if (lptd == NULL || lptd->cbSize != sizeof(LANGPACKTRANSLATEDIALOG))
- return 1;
-
- if ( !(lptd->flags & LPTDF_NOTITLE))
- TranslateWindow(LangPackLookupUuid(lptd->flags), lptd->hwndDlg);
-
- EnumChildWindows(lptd->hwndDlg, TranslateDialogEnumProc, lParam);
+ TranslateMenu_LP((HMENU)wParam, lParam);
return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR LPRegister(WPARAM wParam, LPARAM lParam)
+static INT_PTR srvRegisterLP(WPARAM wParam, LPARAM lParam)
{
*(int*)wParam = LangPackMarkPluginLoaded((PLUGININFOEX*)lParam);
return 0;
@@ -127,50 +51,51 @@ static INT_PTR LPRegister(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR GetDefaultCodePage(WPARAM, LPARAM)
+static INT_PTR srvGetDefaultCodePage(WPARAM, LPARAM)
{
return LangPackGetDefaultCodePage();
}
/////////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR GetDefaultLocale(WPARAM, LPARAM)
+static INT_PTR srvGetDefaultLocale(WPARAM, LPARAM)
{
return LangPackGetDefaultLocale();
}
/////////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR PcharToTchar(WPARAM wParam, LPARAM lParam)
+static INT_PTR srvPcharToTchar(WPARAM wParam, LPARAM lParam)
{
char* pszStr = (char*)lParam;
if (pszStr == NULL)
return NULL;
- LangPackMuuid* uuid = LangPackLookupUuid(wParam);
-
- { int len = (int)strlen(pszStr);
- TCHAR* result = (TCHAR*)alloca((len+1)*sizeof(TCHAR));
- MultiByteToWideChar(LangPackGetDefaultCodePage(), 0, pszStr, -1, result, len);
- result[len] = 0;
- return (INT_PTR)mir_wstrdup((wchar_t*)LangPackTranslateString(uuid, (char*)result, 1));
- }
+ int len = (int)strlen(pszStr);
+ TCHAR* result = (TCHAR*)alloca((len+1)*sizeof(TCHAR));
+ MultiByteToWideChar(LangPackGetDefaultCodePage(), 0, pszStr, -1, result, len);
+ result[len] = 0;
+ return (INT_PTR)mir_wstrdup( TranslateW_LP(result, wParam));
}
/////////////////////////////////////////////////////////////////////////////////////////
-INT_PTR ReloadLangpack(WPARAM wParam, LPARAM lParam);
+INT_PTR srvReloadLangpack(WPARAM wParam, LPARAM lParam)
+{
+ ReloadLangpack(( TCHAR* )lParam);
+ return 0;
+}
-int LoadLangPackServices(void)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+int LoadLangPackModule(void)
{
- CreateServiceFunction(MS_LANGPACK_TRANSLATESTRING, TranslateString);
- CreateServiceFunction(MS_LANGPACK_TRANSLATEMENU, TranslateMenu);
- CreateServiceFunction(MS_LANGPACK_TRANSLATEDIALOG, TranslateDialog);
- CreateServiceFunction(MS_LANGPACK_GETCODEPAGE, GetDefaultCodePage);
- CreateServiceFunction(MS_LANGPACK_GETLOCALE, GetDefaultLocale);
- CreateServiceFunction(MS_LANGPACK_PCHARTOTCHAR, PcharToTchar);
- CreateServiceFunction(MS_LANGPACK_REGISTER, LPRegister);
- CreateServiceFunction(MS_LANGPACK_RELOAD, ReloadLangpack);
+ CreateServiceFunction(MS_LANGPACK_TRANSLATESTRING, srvTranslateString);
+ CreateServiceFunction(MS_LANGPACK_TRANSLATEMENU, srvTranslateMenu);
+ CreateServiceFunction(MS_LANGPACK_GETCODEPAGE, srvGetDefaultCodePage);
+ CreateServiceFunction(MS_LANGPACK_GETLOCALE, srvGetDefaultLocale);
+ CreateServiceFunction(MS_LANGPACK_PCHARTOTCHAR, srvPcharToTchar);
+ CreateServiceFunction(MS_LANGPACK_REGISTER, srvRegisterLP);
+ CreateServiceFunction(MS_LANGPACK_RELOAD, srvReloadLangpack);
return 0;
}
-
diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp index 5c4656fd90..3e1265d4dd 100644 --- a/src/modules/netlib/netliblog.cpp +++ b/src/modules/netlib/netliblog.cpp @@ -146,7 +146,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa GetWindowText((HWND)lParam, path, MAX_PATH);
TCHAR *pszNewPath = Utils_ReplaceVarsT(path);
- pathToAbsoluteT(pszNewPath, path, NULL);
+ PathToAbsoluteT(pszNewPath, path, NULL);
SetDlgItemText(hwndDlg, IDC_PATH, path);
mir_free(pszNewPath);
}
@@ -299,7 +299,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa void NetlibLogShowOptions(void)
{
if (logOptions.hwndOpts == NULL)
- logOptions.hwndOpts=CreateDialog(hMirandaInst, MAKEINTRESOURCE(IDD_NETLIBLOGOPTS), NULL, LogOptionsDlgProc);
+ logOptions.hwndOpts=CreateDialog(hInst, MAKEINTRESOURCE(IDD_NETLIBLOGOPTS), NULL, LogOptionsDlgProc);
SetForegroundWindow(logOptions.hwndOpts);
}
@@ -397,11 +397,8 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam) LeaveCriticalSection(&logOptions.cs);
}
- if (((THook*)hLogEvent)->subscriberCount)
- {
- LOGMSG logMsg = { szHead, pszMsg };
- CallHookSubscribers(hLogEvent, (WPARAM)nlu, (LPARAM)&logMsg);
- }
+ LOGMSG logMsg = { szHead, pszMsg };
+ CallHookSubscribers(hLogEvent, (WPARAM)nlu, (LPARAM)&logMsg);
SetLastError(dwOriginalLastError);
return 1;
@@ -410,7 +407,7 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam) static INT_PTR NetlibLogW(WPARAM wParam, LPARAM lParam)
{
const wchar_t *pszMsg = (const wchar_t*)lParam;
- char* szMsg = Utf8EncodeUcs2(pszMsg);
+ char* szMsg = Utf8EncodeW(pszMsg);
INT_PTR res = NetlibLog(wParam, (LPARAM)szMsg);
mir_free(szMsg);
return res;
@@ -454,12 +451,9 @@ void NetlibDumpData(struct NetlibConnection *nlc, PBYTE buf, int len, int sent, return;
// Check user's log settings
- if ( !(logOptions.toOutputDebugString ||
- ((THook*)hLogEvent)->subscriberCount ||
- (logOptions.toFile && logOptions.szFile[0])))
+ if ( !(logOptions.toOutputDebugString || (logOptions.toFile && logOptions.szFile[0])))
return;
- if ((sent && !logOptions.dumpSent) ||
- ( !sent && !logOptions.dumpRecv))
+ if ((sent && !logOptions.dumpSent) || (!sent && !logOptions.dumpRecv))
return;
if ((flags & MSG_DUMPPROXY) && !logOptions.dumpProxy)
return;
@@ -593,7 +587,7 @@ void NetlibLogInit(void) TCHAR *pszNewPath = Utils_ReplaceVarsT(dbv.ptszVal);
TCHAR path[MAX_PATH];
- pathToAbsoluteT(pszNewPath, path, NULL);
+ PathToAbsoluteT(pszNewPath, path, NULL);
logOptions.szFile = mir_tstrdup(path);
mir_free(pszNewPath);
diff --git a/src/modules/netlib/netlibopts.cpp b/src/modules/netlib/netlibopts.cpp index 20e90d9932..34a07d6df7 100644 --- a/src/modules/netlib/netlibopts.cpp +++ b/src/modules/netlib/netlibopts.cpp @@ -546,7 +546,7 @@ int NetlibOptInitialise(WPARAM wParam, LPARAM) odp.cbSize = sizeof(odp);
odp.position = 900000000;
- odp.hInstance = hMirandaInst;
+ odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_NETLIB);
odp.pszTitle = LPGEN("Network");
odp.pfnDlgProc = DlgProcNetlibOpts;
diff --git a/src/modules/netlib/netlibsock.cpp b/src/modules/netlib/netlibsock.cpp index eabbc79484..30db9ce256 100644 --- a/src/modules/netlib/netlibsock.cpp +++ b/src/modules/netlib/netlibsock.cpp @@ -58,11 +58,9 @@ INT_PTR NetlibSend(WPARAM wParam, LPARAM lParam) }
NetlibLeaveNestedCS(&nlc->ncsSend);
- if (((THook*)hSendEvent)->subscriberCount)
- {
- NETLIBNOTIFY nln = { nlb, result };
- CallHookSubscribers(hSendEvent, (WPARAM)&nln, (LPARAM)&nlc->nlu->user);
- }
+ NETLIBNOTIFY nln = { nlb, result };
+ CallHookSubscribers(hSendEvent, (WPARAM)&nln, (LPARAM)&nlc->nlu->user);
+
return result;
}
@@ -95,8 +93,7 @@ INT_PTR NetlibRecv(WPARAM wParam, LPARAM lParam) NetlibDumpData(nlc, (PBYTE)nlb->buf, recvResult, 0, nlb->flags);
- if ((nlb->flags & MSG_PEEK) == 0 && ((THook*)hRecvEvent)->subscriberCount)
- {
+ if ((nlb->flags & MSG_PEEK) == 0) {
NETLIBNOTIFY nln = { nlb, recvResult };
CallHookSubscribers(hRecvEvent, (WPARAM)&nln, (LPARAM)&nlc->nlu->user);
}
diff --git a/src/modules/options/descbutton.cpp b/src/modules/options/descbutton.cpp index d4ceed2d44..813779f375 100644 --- a/src/modules/options/descbutton.cpp +++ b/src/modules/options/descbutton.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "..\..\core\commonheaders.h"
#include "m_descbutton.h"
-extern HINSTANCE hMirandaInst;
+extern HINSTANCE hInst;
////////////////////////////////////////////////////////////////////////////////////
// Internals
diff --git a/src/modules/options/filter.cpp b/src/modules/options/filter.cpp index 2ea0aa4752..8b72f4e67d 100644 --- a/src/modules/options/filter.cpp +++ b/src/modules/options/filter.cpp @@ -192,7 +192,7 @@ static int OnOptionsInitialise(WPARAM wParam, LPARAM) odp.cbSize = sizeof(odp);
odp.position = -190000000;
- odp.hInstance = hMirandaInst;
+ odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_KEYWORDFILTER);
odp.pszTitle = LPGEN("Options search");
odp.pszGroup = LPGEN("Customize");
diff --git a/src/modules/options/filter.h b/src/modules/options/filter.h index d64801eee5..ced8845b95 100644 --- a/src/modules/options/filter.h +++ b/src/modules/options/filter.h @@ -98,10 +98,5 @@ public: ~CPageList() {};
};
-
-
-int LangPackGetDefaultLocale();
-
-
#endif //M_OPTIONS_FILTERING_H
diff --git a/src/modules/options/headerbar.cpp b/src/modules/options/headerbar.cpp index 66661b9983..44a729089d 100644 --- a/src/modules/options/headerbar.cpp +++ b/src/modules/options/headerbar.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "..\..\core\commonheaders.h"
#include "m_iconheader.h"
-extern HINSTANCE hMirandaInst;
+extern HINSTANCE hInst;
static BOOL IsAeroMode()
diff --git a/src/modules/options/iconheader.cpp b/src/modules/options/iconheader.cpp index 01a3bc99bf..e3f27c8289 100644 --- a/src/modules/options/iconheader.cpp +++ b/src/modules/options/iconheader.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "m_iconheader.h"
-extern HINSTANCE hMirandaInst;
+extern HINSTANCE hInst;
static BOOL IsAeroMode()
{
diff --git a/src/modules/options/options.cpp b/src/modules/options/options.cpp index aa6180a972..e949ff31c5 100644 --- a/src/modules/options/options.cpp +++ b/src/modules/options/options.cpp @@ -236,7 +236,7 @@ static TCHAR *GetPluginName(HINSTANCE hInstance, TCHAR *buffer, int size) PageHash GetPluginPageHash(const OptionsPageData *page)
{
- return hashstr(page->ptszGroup) + hashstr(page->ptszTitle) + hashstr(page->ptszTab);
+ return mir_hashstrT(page->ptszGroup) + mir_hashstrT(page->ptszTitle) + mir_hashstrT(page->ptszTab);
}
static void FindFilterStrings(int enableKeywordFiltering, int current, HWND hWndParent, const OptionsPageData *page)
@@ -497,7 +497,7 @@ static void FillFilterCombo(int enableKeywordFiltering, HWND hDlg, OptionsDlgDat int index = SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT) CB_ADDSTRING, (WPARAM)0, (LPARAM)TranslateTS(ALL_MODULES_FILTER));
SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT) CB_SETITEMDATA, (WPARAM)index, (LPARAM)NULL);
index = SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT) CB_ADDSTRING, (WPARAM)0, (LPARAM)TranslateTS(CORE_MODULES_FILTER));
- SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT) CB_SETITEMDATA, (WPARAM)index, (LPARAM)hMirandaInst);
+ SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT) CB_SETITEMDATA, (WPARAM)index, (LPARAM)hInst);
TCHAR* tszModuleName = (TCHAR*)alloca(MAX_PATH*sizeof(TCHAR));
for (int i = 0; i < dat->arOpd.getCount(); i++) {
TCHAR * dllName = NULL;
@@ -507,7 +507,7 @@ static void FillFilterCombo(int enableKeywordFiltering, HWND hDlg, OptionsDlgDat if ( !enableKeywordFiltering)
FindFilterStrings(enableKeywordFiltering, FALSE, hDlg, dat->arOpd[i]); // only modules name (fast enougth)
- if (inst == hMirandaInst) continue;
+ if (inst == hInst) continue;
for (j = 0; j<countKnownInst; j++)
if (KnownInstances[j] == inst) break;
if (j != countKnownInst) continue;
@@ -839,9 +839,9 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L continue;
OptionsPageData* opd = dat->arOpd[i];
- TCHAR* ptszGroup = LangPackTranslateStringT(opd->hLangpack, opd->ptszGroup);
- TCHAR* ptszTitle = LangPackTranslateStringT(opd->hLangpack, opd->ptszTitle);
- TCHAR* ptszTab = LangPackTranslateStringT(opd->hLangpack, opd->ptszTab);
+ TCHAR* ptszGroup = TranslateTH(opd->hLangpack, opd->ptszGroup);
+ TCHAR* ptszTitle = TranslateTH(opd->hLangpack, opd->ptszTitle);
+ TCHAR* ptszTab = TranslateTH(opd->hLangpack, opd->ptszTab);
tvis.hParent = NULL;
if (FilterInst != NULL) {
@@ -1089,7 +1089,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L if ( lstrcmp(opd->ptszTitle, p->ptszTitle) || lstrcmpnull(opd->ptszGroup, p->ptszGroup))
continue;
- tie.pszText = LangPackTranslateStringT(opd->hLangpack, opd->ptszTab);
+ tie.pszText = TranslateTH(opd->hLangpack, opd->ptszTab);
tie.lParam = i;
TabCtrl_InsertItem(hwndTab, pages, &tie);
if ( !lstrcmp(opd->ptszTab, p->ptszTab))
@@ -1390,7 +1390,7 @@ void OpenAccountOptions(PROTOACCOUNT* pa) psh.pStartPage = (LPCTSTR)&ood;
psh.pszCaption = tszTitle;
psh.ppsp = (PROPSHEETPAGE*)opi.odp;
- hwndOptions = CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_OPTIONSPAGE), NULL, OptionsDlgProc, (LPARAM)&psh);
+ hwndOptions = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_OPTIONSPAGE), NULL, OptionsDlgProc, (LPARAM)&psh);
mir_free((void*)ood.pszPage);
FreeOptionsData(&opi);
} }
@@ -1436,7 +1436,7 @@ static void OpenOptionsNow(const char *pszGroup, const char *pszPage, const char psh.pszCaption = TranslateT("Miranda IM Options");
psh.ppsp = (PROPSHEETPAGE*)opi.odp; //blatent misuse of the structure, but what the hell
- hwndOptions = CreateDialogParam(hMirandaInst,
+ hwndOptions = CreateDialogParam(hInst,
MAKEINTRESOURCE(bSinglePage ? IDD_OPTIONSPAGE : IDD_OPTIONS),
NULL, OptionsDlgProc, (LPARAM)&psh);
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp index 64eff30f5b..391e76408d 100644 --- a/src/modules/plugins/newplugins.cpp +++ b/src/modules/plugins/newplugins.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2010 Miranda ICQ/IM project,
+Copyright 2000-2010 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -23,19 +23,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "..\..\core\commonheaders.h"
#include "plugins.h"
-static int sttComparePlugins(const pluginEntry* p1, const pluginEntry* p2)
-{
- if (p1->bpi.hInst == p2->bpi.hInst)
- return 0;
-
- return (p1->bpi.hInst < p2->bpi.hInst) ? -1 : 1;
-}
-
static int sttComparePluginsByName(const pluginEntry* p1, const pluginEntry* p2)
{ return lstrcmp(p1->pluginname, p2->pluginname);
}
-LIST<pluginEntry> pluginList(10, sttComparePluginsByName), pluginListAddr(10, sttComparePlugins);
+LIST<pluginEntry> pluginList(10, sttComparePluginsByName);
/////////////////////////////////////////////////////////////////////////////////////////
@@ -44,8 +36,8 @@ LIST<pluginEntry> pluginList(10, sttComparePluginsByName), pluginListAddr(10, st struct PluginUUIDList {
MUUID uuid;
DWORD maxVersion;
-}
-static const pluginBannedList[] =
+}
+static const pluginBannedList[] =
{
{{0x7f65393b, 0x7771, 0x4f3f, { 0xa9, 0xeb, 0x5d, 0xba, 0xf2, 0xb3, 0x61, 0xf1 }}, MAX_MIR_VER}, // png2dib
{{0xe00f1643, 0x263c, 0x4599, { 0xb8, 0x4b, 0x05, 0x3e, 0x5c, 0x51, 0x1d, 0x28 }}, MAX_MIR_VER}, // loadavatars (unicode)
@@ -73,8 +65,6 @@ void UninitIni(void); #define PLUGINDISABLELIST "PluginDisable"
-int CallHookSubscribers(HANDLE hEvent, WPARAM wParam, LPARAM lParam);
-
int LoadDatabaseModule(void);
char* GetPluginNameByInstance(HINSTANCE hInstance)
@@ -89,29 +79,6 @@ char* GetPluginNameByInstance(HINSTANCE hInstance) return NULL;
}
-HINSTANCE GetInstByAddress(void* codePtr)
-{
- int idx;
- HINSTANCE result;
- pluginEntry p; p.bpi.hInst = (HINSTANCE)codePtr;
-
- if (pluginListAddr.getCount() == 0)
- return NULL;
-
- List_GetIndex((SortedList*)&pluginListAddr, &p, &idx);
- if (idx > 0)
- idx--;
-
- result = pluginListAddr[idx]->bpi.hInst;
-
- if (result < hMirandaInst && codePtr > hMirandaInst)
- result = hMirandaInst;
- else if (idx == 0 && codePtr < (void*)result)
- result = NULL;
-
- return result;
-}
-
int equalUUID(const MUUID& u1, const MUUID& u2)
{
return memcmp(&u1, &u2, sizeof(MUUID))?0:1;
@@ -159,22 +126,22 @@ static int isPluginBanned(MUUID u1, DWORD dwVersion) * historyeditor added by nightwish - plugin is problematic and can ruin database as it does not understand UTF-8 message
* storage
*/
-
-static const TCHAR* modulesToSkip[] =
-{
- _T("autoloadavatars.dll"), _T("multiwindow.dll"), _T("fontservice.dll"),
- _T("icolib.dll"), _T("historyeditor.dll")
+
+static const TCHAR* modulesToSkip[] =
+{
+ _T("autoloadavatars.dll"), _T("multiwindow.dll"), _T("fontservice.dll"),
+ _T("icolib.dll"), _T("historyeditor.dll")
};
// The following plugins will be checked for a valid MUUID or they will not be loaded
-static const TCHAR* expiredModulesToSkip[] =
-{
- _T("scriver.dll"), _T("nconvers.dll"), _T("tabsrmm.dll"), _T("nhistory.dll"),
- _T("historypp.dll"), _T("help.dll"), _T("loadavatars.dll"), _T("tabsrmm_unicode.dll"),
- _T("clist_nicer_plus.dll"), _T("changeinfo.dll"), _T("png2dib.dll"), _T("dbx_mmap.dll"),
- _T("dbx_3x.dll"), _T("sramm.dll"), _T("srmm_mod.dll"), _T("srmm_mod (no Unicode).dll"),
- _T("singlemodeSRMM.dll"), _T("msg_export.dll"), _T("clist_modern.dll"),
- _T("clist_nicer.dll")
+static const TCHAR* expiredModulesToSkip[] =
+{
+ _T("scriver.dll"), _T("nconvers.dll"), _T("tabsrmm.dll"), _T("nhistory.dll"),
+ _T("historypp.dll"), _T("help.dll"), _T("loadavatars.dll"), _T("tabsrmm_unicode.dll"),
+ _T("clist_nicer_plus.dll"), _T("changeinfo.dll"), _T("png2dib.dll"), _T("dbx_mmap.dll"),
+ _T("dbx_3x.dll"), _T("sramm.dll"), _T("srmm_mod.dll"), _T("srmm_mod (no Unicode).dll"),
+ _T("singlemodeSRMM.dll"), _T("msg_export.dll"), _T("clist_modern.dll"),
+ _T("clist_nicer.dll")
};
static int checkPI(BASIC_PLUGIN_INFO* bpi, PLUGININFOEX* pi)
@@ -191,16 +158,16 @@ static int checkPI(BASIC_PLUGIN_INFO* bpi, PLUGININFOEX* pi) bHasValidInfo = TRUE;
}
-
+
if ( !bHasValidInfo)
return FALSE;
- if (pi->shortName == NULL || pi->description == NULL || pi->author == NULL ||
+ if (pi->shortName == NULL || pi->description == NULL || pi->author == NULL ||
pi->authorEmail == NULL || pi->copyright == NULL || pi->homepage == NULL)
return FALSE;
- if (pi->replacesDefaultModule > DEFMOD_HIGHEST ||
- pi->replacesDefaultModule == DEFMOD_REMOVED_UIPLUGINOPTS ||
+ if (pi->replacesDefaultModule > DEFMOD_HIGHEST ||
+ pi->replacesDefaultModule == DEFMOD_REMOVED_UIPLUGINOPTS ||
pi->replacesDefaultModule == DEFMOD_REMOVED_PROTOCOLNETLIB)
return FALSE;
@@ -342,8 +309,8 @@ void Plugin_Uninit(pluginEntry* p, bool bDynamic) FreeLibrary(p->bpi.hInst);
ZeroMemory(&p->bpi, sizeof(p->bpi));
}
+ UnregisterModule(p->bpi.hInst);
pluginList.remove(p);
- pluginListAddr.remove(p);
}
void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam)
@@ -494,7 +461,7 @@ int isPluginOnWhiteList(const TCHAR* pluginname) if (MessageBox(NULL, buf, TranslateT("Re-enable Miranda plugin?"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
SetPluginOnWhiteList(pluginname, 1);
rc = 0;
- }
+ }
}
return rc == 0;
@@ -526,16 +493,16 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic) return false;
}
- pluginListAddr.insert(p);
+ RegisterModule(p->bpi.hInst);
if (bpi.Load(&pluginCoreLink) != 0)
return false;
-
+
p->pclass |= PCLASS_LOADED;
if (rm) pluginDefModList[rm]=p;
}
}
else if (p->bpi.hInst != NULL) {
- pluginListAddr.insert(p);
+ RegisterModule(p->bpi.hInst);
p->pclass |= PCLASS_LOADED;
}
return true;
@@ -552,7 +519,7 @@ static pluginEntry* getCListModule(TCHAR * exe, TCHAR * slice, int useWhiteList) if (checkAPI(exe, &bpi, mirandaVersion, CHECKAPI_CLIST)) {
p->bpi = bpi;
p->pclass |= PCLASS_LAST | PCLASS_OK | PCLASS_BASICAPI;
- pluginListAddr.insert(p);
+ RegisterModule(p->bpi.hInst);
if (bpi.clistlink(&pluginCoreLink) == 0) {
p->bpi = bpi;
p->pclass |= PCLASS_LOADED;
@@ -575,7 +542,7 @@ int UnloadPlugin(TCHAR* buf, int bufLen) GetModuleFileName(p->bpi.hInst, buf, bufLen);
Plugin_Uninit(p);
return TRUE;
- }
+ }
}
return FALSE;
@@ -625,7 +592,7 @@ int LoadServiceModePlugin(void) p->pclass |= PCLASS_LOADED;
if (CallService(MS_SERVICEMODE_LAUNCH, 0, 0) != CALLSERVICE_NOTFOUND)
return 1;
-
+
MessageBox(NULL, TranslateT("Unable to load plugin in Service Mode!"), p->pluginname, 0);
return -1;
}
@@ -672,7 +639,7 @@ int LoadNewPluginsModule(void) askAboutIgnoredPlugins=(UINT) GetPrivateProfileInt(_T("PluginLoader"), _T("AskAboutIgnoredPlugins"), 0, mirandabootini);
// if Crash Dumper is present, load it to provide Crash Reports
- if (pluginList_crshdmp != NULL && isPluginOnWhiteList(pluginList_crshdmp->pluginname))
+ if (pluginList_crshdmp != NULL && isPluginOnWhiteList(pluginList_crshdmp->pluginname))
{
if (pluginList_crshdmp->bpi.Load(&pluginCoreLink) == 0)
pluginList_crshdmp->pclass |= PCLASS_LOADED | PCLASS_LAST;
@@ -775,7 +742,7 @@ int LoadNewPluginsModuleInfos(void) pluginCoreLink.KillObjectEventHooks = KillObjectEventHooks;
// remember where the mirandaboot.ini goes
- pathToAbsoluteT(_T("mirandaboot.ini"), mirandabootini, NULL);
+ PathToAbsoluteT(_T("mirandaboot.ini"), mirandabootini, NULL);
// look for all *.dll's
enumPlugins(scanPluginsDir, 0, 0);
// the database will select which db plugin to use, or fail if no profile is selected
@@ -817,6 +784,5 @@ void UnloadNewPluginsModule(void) hPluginListHeap=0;
pluginList.destroy();
- pluginListAddr.destroy();
UninitIni();
}
diff --git a/src/modules/plugins/pluginopts.cpp b/src/modules/plugins/pluginopts.cpp index b87c86b8e5..a62dc08378 100644 --- a/src/modules/plugins/pluginopts.cpp +++ b/src/modules/plugins/pluginopts.cpp @@ -403,7 +403,7 @@ int PluginOptionsInit(WPARAM wParam, LPARAM) {
OPTIONSDIALOGPAGE odp = { 0 };
odp.cbSize = sizeof(odp);
- odp.hInstance = hMirandaInst;
+ odp.hInstance = hInst;
odp.pfnDlgProc = DlgPluginOpt;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_PLUGINS);
odp.position = 1300000000;
diff --git a/src/modules/plugins/plugins.h b/src/modules/plugins/plugins.h index 6b03fad7c0..fe6de60b8c 100644 --- a/src/modules/plugins/plugins.h +++ b/src/modules/plugins/plugins.h @@ -50,7 +50,7 @@ struct pluginEntry pluginEntry* nextclass;
};
-extern LIST<pluginEntry> pluginList, pluginListAddr;
+extern LIST<pluginEntry> pluginList;
extern MUUID miid_last;
int PluginOptionsInit(WPARAM, LPARAM);
diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp index 891474baed..4846d84b87 100644 --- a/src/modules/protocols/protoaccs.cpp +++ b/src/modules/protocols/protoaccs.cpp @@ -375,7 +375,7 @@ static INT_PTR stub43(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam) PROTO_AVATAR_INFORMATIONW tmp = { 0 };
tmp.cbSize = sizeof(tmp);
tmp.hContact = p->hContact;
- int result = CallProtoService(ppi->m_szModuleName, PS_GETAVATARINFOW, wParam, (LPARAM)&tmp);
+ int result = CallProtoServiceInt(NULL,ppi->m_szModuleName, PS_GETAVATARINFOW, wParam, (LPARAM)&tmp);
p->format = tmp.format;
@@ -390,7 +390,7 @@ static INT_PTR stub43(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam) static INT_PTR stub44(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam)
{
wchar_t* buf = (wchar_t*)_alloca(sizeof(wchar_t) * (lParam + 1));
- int result = CallProtoService(ppi->m_szModuleName, PS_GETMYAVATARW, WPARAM(buf), lParam);
+ int result = CallProtoServiceInt(NULL,ppi->m_szModuleName, PS_GETMYAVATARW, WPARAM(buf), lParam);
if (result == 0)
{
wchar_t* filename = (wchar_t*)_alloca(sizeof(wchar_t) * (lParam + 1));
@@ -405,7 +405,7 @@ static INT_PTR stub44(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam) static INT_PTR stub45(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam)
{
- return CallProtoService(ppi->m_szModuleName, PS_SETMYAVATARW, wParam, (LPARAM)(LPCTSTR)StrConvT((char*)lParam));
+ return CallProtoServiceInt(NULL,ppi->m_szModuleName, PS_SETMYAVATARW, wParam, (LPARAM)(LPCTSTR)StrConvT((char*)lParam));
}
diff --git a/src/modules/protocols/protochains.cpp b/src/modules/protocols/protochains.cpp index 73a12d2bd5..05d39b07e4 100644 --- a/src/modules/protocols/protochains.cpp +++ b/src/modules/protocols/protochains.cpp @@ -42,7 +42,7 @@ INT_PTR Proto_CallContactService(WPARAM wParam, LPARAM lParam) if (DBGetContactSettingString(ccs->hContact, "_Filter", str, &dbv))
break;
- if ((ret = CallProtoService(dbv.pszVal, ccs->szProtoService, i+1, lParam)) != CALLSERVICE_NOTFOUND) {
+ if ((ret = CallProtoServiceInt(NULL,dbv.pszVal, ccs->szProtoService, i+1, lParam)) != CALLSERVICE_NOTFOUND) {
//chain was started, exit
mir_free(dbv.pszVal);
return ret;
@@ -93,7 +93,7 @@ static INT_PTR CallRecvChain(WPARAM wParam, LPARAM lParam) if (DBGetContactSettingString(ccs->hContact, "_Filter", str, &dbv)) //never happens
return 1;
- if ((ret = CallProtoService(dbv.pszVal, ccs->szProtoService, i+1, lParam)) != CALLSERVICE_NOTFOUND) {
+ if ((ret = CallProtoServiceInt(NULL,dbv.pszVal, ccs->szProtoService, i+1, lParam)) != CALLSERVICE_NOTFOUND) {
//chain was started, exit
mir_free(dbv.pszVal);
return ret;
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index 1ec4872e23..69f3c846cd 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -262,7 +262,7 @@ static int Proto_ValidTypingContact(HANDLE hContact, char *szProto) if ( !hContact || !szProto)
return 0;
- return (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_SUPPORTTYPING) ? 1 : 0;
+ return (CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_SUPPORTTYPING) ? 1 : 0;
}
static INT_PTR Proto_SelfIsTyping(WPARAM wParam, LPARAM lParam)
@@ -273,7 +273,7 @@ static INT_PTR Proto_SelfIsTyping(WPARAM wParam, LPARAM lParam) return 0;
if (Proto_ValidTypingContact((HANDLE)wParam, szProto))
- CallProtoService(szProto, PSS_USERISTYPING, wParam, lParam);
+ CallProtoServiceInt(NULL,szProto, PSS_USERISTYPING, wParam, lParam);
}
return 0;
@@ -300,7 +300,7 @@ static INT_PTR Proto_ContactIsTyping(WPARAM wParam, LPARAM lParam) void Proto_SetStatus(const char* szProto, unsigned status)
{
- if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)
+ if (CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)
{
TCHAR* awayMsg = (TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGW, (WPARAM) status, (LPARAM) szProto);
if ((INT_PTR)awayMsg == CALLSERVICE_NOTFOUND)
@@ -314,10 +314,10 @@ void Proto_SetStatus(const char* szProto, unsigned status) }
if ((INT_PTR)awayMsg != CALLSERVICE_NOTFOUND)
{
- CallProtoService(szProto, PS_SETAWAYMSGT, status, (LPARAM) awayMsg);
+ CallProtoServiceInt(NULL,szProto, PS_SETAWAYMSGT, status, (LPARAM) awayMsg);
mir_free(awayMsg);
} }
- CallProtoService(szProto, PS_SETSTATUS, status, 0);
+ CallProtoServiceInt(NULL,szProto, PS_SETSTATUS, status, 0);
}
@@ -398,6 +398,11 @@ static INT_PTR srvProto_IsAccountLocked(WPARAM, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
+INT_PTR CallProtoService(const char* szModule, const char* szService, WPARAM wParam, LPARAM lParam)
+{
+ return CallProtoServiceInt(NULL, szModule, szService, wParam, lParam);
+}
+
INT_PTR CallProtoServiceInt(HANDLE hContact, const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam)
{
PROTOACCOUNT* pa = Proto_GetAccount(szModule);
@@ -405,196 +410,186 @@ INT_PTR CallProtoServiceInt(HANDLE hContact, const char *szModule, const char *s PROTO_INTERFACE* ppi;
if ((ppi = pa->ppro) == NULL)
return CALLSERVICE_NOTFOUND;
- else {
- TServiceListItem *item = serviceItems.find((TServiceListItem*)&szService);
- if (item) {
- switch(item->id) {
- case 1:
-
- if (ppi->m_iVersion > 1 || !(((PROTOSEARCHRESULT*)lParam)->flags & PSR_UNICODE))
- return (INT_PTR)ppi->AddToList(wParam, (PROTOSEARCHRESULT*)lParam);
- else {
- PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
- PROTOSEARCHRESULT *psra =(PROTOSEARCHRESULT*)mir_alloc(psr->cbSize);
- memcpy(psra, psr, psr->cbSize);
- psra->nick = (PROTOCHAR*)mir_u2a(psr->nick);
- psra->firstName = (PROTOCHAR*)mir_u2a(psr->firstName);
- psra->lastName = (PROTOCHAR*)mir_u2a(psr->lastName);
- psra->email = (PROTOCHAR*)mir_u2a(psr->email);
+
+ TServiceListItem *item = serviceItems.find((TServiceListItem*)&szService);
+ if (item) {
+ switch(item->id) {
+ case 1:
+ if (ppi->m_iVersion > 1 || !(((PROTOSEARCHRESULT*)lParam)->flags & PSR_UNICODE))
+ return (INT_PTR)ppi->AddToList(wParam, (PROTOSEARCHRESULT*)lParam);
+ else {
+ PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
+ PROTOSEARCHRESULT *psra =(PROTOSEARCHRESULT*)mir_alloc(psr->cbSize);
+ memcpy(psra, psr, psr->cbSize);
+ psra->nick = (PROTOCHAR*)mir_u2a(psr->nick);
+ psra->firstName = (PROTOCHAR*)mir_u2a(psr->firstName);
+ psra->lastName = (PROTOCHAR*)mir_u2a(psr->lastName);
+ psra->email = (PROTOCHAR*)mir_u2a(psr->email);
- INT_PTR res = (INT_PTR)ppi->AddToList(wParam, psra);
+ INT_PTR res = (INT_PTR)ppi->AddToList(wParam, psra);
- mir_free(psra->nick);
- mir_free(psra->firstName);
- mir_free(psra->lastName);
- mir_free(psra->email);
- mir_free(psra);
+ mir_free(psra->nick);
+ mir_free(psra->firstName);
+ mir_free(psra->lastName);
+ mir_free(psra->email);
+ mir_free(psra);
- return res;
- }
-
- case 2: return (INT_PTR)ppi->AddToListByEvent(LOWORD(wParam), HIWORD(wParam), (HANDLE)lParam);
- case 3: return (INT_PTR)ppi->Authorize((HANDLE)wParam);
- case 4:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->AuthDeny((HANDLE)wParam, StrConvT((char*)lParam));
- else
- return (INT_PTR)ppi->AuthDeny((HANDLE)wParam, (PROTOCHAR*)lParam);
- case 5: return (INT_PTR)ppi->AuthRecv(hContact, (PROTORECVEVENT*)lParam);
- case 6:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->AuthRequest(hContact, StrConvT((char*)lParam));
- else
- return (INT_PTR)ppi->AuthRequest(hContact, (PROTOCHAR*)lParam);
- case 7: return (INT_PTR)ppi->ChangeInfo(wParam, (void*)lParam);
- case 8:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, StrConvT((char*)lParam));
- else
- return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, (PROTOCHAR*)lParam);
- case 9: return (INT_PTR)ppi->FileCancel(hContact, (HANDLE)wParam);
- case 10:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, StrConvT((char*)lParam));
- else
- return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, (PROTOCHAR*)lParam);
- case 11: {
- PROTOFILERESUME* pfr = (PROTOFILERESUME*)lParam;
-
- if (ppi->m_iVersion > 1) {
- PROTOCHAR* szFname = mir_a2t((char*)pfr->szFilename);
- INT_PTR res = (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action,
- (const PROTOCHAR**)&szFname);
- mir_free((PROTOCHAR*)pfr->szFilename);
- pfr->szFilename = (PROTOCHAR*)mir_t2a(szFname); mir_free(szFname);
- }
- else
-
- return (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action,
- (const PROTOCHAR**)&pfr->szFilename);
- }
- case 12: return (INT_PTR)ppi->GetCaps(wParam, (HANDLE)lParam);
- case 13: return (INT_PTR)ppi->GetIcon(wParam);
- case 14: return (INT_PTR)ppi->GetInfo(hContact, wParam);;
- case 15:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SearchBasic(StrConvT((char*)lParam));
- else
- return (INT_PTR)ppi->SearchBasic((TCHAR*)lParam);
- case 16:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SearchByEmail(StrConvT((char*)lParam));
- else
- return (INT_PTR)ppi->SearchByEmail((TCHAR*)lParam);
- case 17: {
- PROTOSEARCHBYNAME* psbn = (PROTOSEARCHBYNAME*)lParam;
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SearchByName(StrConvT((char*)psbn->pszNick),
- StrConvT((char*)psbn->pszFirstName), StrConvT((char*)psbn->pszLastName));
- else
- return (INT_PTR)ppi->SearchByName(psbn->pszNick, psbn->pszFirstName, psbn->pszLastName);
- }
- case 18: return (INT_PTR)ppi->SearchAdvanced((HWND)lParam);
- case 19: return (INT_PTR)ppi->CreateExtendedSearchUI ((HWND)lParam);
- case 20: return (INT_PTR)ppi->RecvContacts(hContact, (PROTORECVEVENT*)lParam);
- case 21: return (INT_PTR)ppi->RecvFile(hContact, (PROTOFILEEVENT*)lParam);
- case 22: return (INT_PTR)ppi->RecvMsg(hContact, (PROTORECVEVENT*)lParam);
- case 23: return (INT_PTR)ppi->RecvUrl(hContact, (PROTORECVEVENT*)lParam);
- case 24: return (INT_PTR)ppi->SendContacts(hContact, LOWORD(wParam), HIWORD(wParam),
- (HANDLE*)lParam);
- case 25:
-
- if (ppi->m_iVersion > 1) {
- TCHAR** files = Proto_FilesMatrixU((char**)lParam);
- INT_PTR res = (INT_PTR)ppi->SendFile(hContact, StrConvT((char*)wParam), (TCHAR**)files);
- if (res == 0) FreeFilesMatrix(&files);
- return res;
- }
- else
-
- return (INT_PTR)ppi->SendFile(hContact, (TCHAR*)wParam, (TCHAR**)lParam);
- case 26: return (INT_PTR)ppi->SendMsg(hContact, wParam, (const char*)lParam);
- case 27: return (INT_PTR)ppi->SendUrl(hContact, wParam, (const char*)lParam);
- case 28: return (INT_PTR)ppi->SetApparentMode(hContact, wParam);
- case 29: return (INT_PTR)ppi->SetStatus(wParam);
- case 30: return (INT_PTR)ppi->GetAwayMsg(hContact);
- case 31: return (INT_PTR)ppi->RecvAwayMsg(hContact, wParam, (PROTORECVEVENT*)lParam);
- case 32: return (INT_PTR)ppi->SendAwayMsg(hContact, (HANDLE)wParam, (const char*)lParam);
- case 33:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SetAwayMsg(wParam, StrConvT((char*)lParam));
- else
- return (INT_PTR)ppi->SetAwayMsg(wParam, (TCHAR*)lParam);
- case 34: return (INT_PTR)ppi->UserIsTyping((HANDLE)wParam, lParam);
- case 35: lstrcpynA((char*)lParam, ppi->m_szModuleName, wParam); return 0;
- case 36: return ppi->m_iStatus;
-
-
- case 100:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SetAwayMsg(wParam, (TCHAR*)lParam);
- else
- return (INT_PTR)ppi->SetAwayMsg(wParam, StrConvA((TCHAR*)lParam));
- case 102:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SendFile(hContact, (TCHAR*)wParam, (TCHAR**)lParam);
- else {
- char** files = Proto_FilesMatrixA((TCHAR**)lParam);
- INT_PTR res = (INT_PTR)ppi->SendFile(hContact, StrConvA((TCHAR*)wParam), (TCHAR**)files);
- if (res == 0) FreeFilesMatrix((TCHAR***)&files);
- return res;
- }
- case 103:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, (TCHAR*)lParam);
- else
- return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, StrConvA((TCHAR*)lParam));
- case 104:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, (TCHAR*)lParam);
- else
- return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, StrConvA((TCHAR*)lParam));
- case 105: {
- PROTOFILERESUME* pfr = (PROTOFILERESUME*)lParam;
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action,
- (const PROTOCHAR**)&pfr->szFilename);
- else {
- char* szFname = mir_t2a(pfr->szFilename);
- INT_PTR res = (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action,
- (const PROTOCHAR**)&szFname);
- mir_free(szFname);
- } }
- case 106:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->AuthRequest(hContact, (const TCHAR*)lParam);
- else
- return (INT_PTR)ppi->AuthRequest(hContact, StrConvA((const TCHAR*)lParam));
- case 107:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->AuthDeny((HANDLE)wParam, (const TCHAR*)lParam);
- else
- return (INT_PTR)ppi->AuthDeny((HANDLE)wParam, StrConvA((const TCHAR*)lParam));
- case 108:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SearchBasic((const TCHAR*)lParam);
- else
- return (INT_PTR)ppi->SearchBasic(StrConvA((const TCHAR*)lParam));
- case 109: {
- PROTOSEARCHBYNAME* psbn = (PROTOSEARCHBYNAME*)lParam;
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SearchByName(psbn->pszNick, psbn->pszFirstName, psbn->pszLastName);
- else
- return (INT_PTR)ppi->SearchByName(StrConvA((TCHAR*)psbn->pszNick),
- StrConvA((TCHAR*)psbn->pszFirstName), StrConvA((TCHAR*)psbn->pszLastName));
- }
- case 110:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SearchByEmail((const TCHAR*)lParam);
- else
- return (INT_PTR)ppi->SearchByEmail(StrConvA((const TCHAR*)lParam));
-
- } } } }
+ return res;
+ }
+
+ case 2: return (INT_PTR)ppi->AddToListByEvent(LOWORD(wParam), HIWORD(wParam), (HANDLE)lParam);
+ case 3: return (INT_PTR)ppi->Authorize((HANDLE)wParam);
+ case 4:
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->AuthDeny((HANDLE)wParam, StrConvT((char*)lParam));
+ else
+ return (INT_PTR)ppi->AuthDeny((HANDLE)wParam, (PROTOCHAR*)lParam);
+ case 5: return (INT_PTR)ppi->AuthRecv(hContact, (PROTORECVEVENT*)lParam);
+ case 6:
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->AuthRequest(hContact, StrConvT((char*)lParam));
+ else
+ return (INT_PTR)ppi->AuthRequest(hContact, (PROTOCHAR*)lParam);
+ case 7: return (INT_PTR)ppi->ChangeInfo(wParam, (void*)lParam);
+ case 8:
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, StrConvT((char*)lParam));
+ else
+ return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, (PROTOCHAR*)lParam);
+ case 9: return (INT_PTR)ppi->FileCancel(hContact, (HANDLE)wParam);
+ case 10:
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, StrConvT((char*)lParam));
+ else
+ return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, (PROTOCHAR*)lParam);
+ case 11: {
+ PROTOFILERESUME* pfr = (PROTOFILERESUME*)lParam;
+ if (ppi->m_iVersion > 1) {
+ PROTOCHAR* szFname = mir_a2t((char*)pfr->szFilename);
+ INT_PTR res = (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action, (const PROTOCHAR**)&szFname);
+ mir_free((PROTOCHAR*)pfr->szFilename);
+ pfr->szFilename = (PROTOCHAR*)mir_t2a(szFname); mir_free(szFname);
+ }
+ else
+ return (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action, (const PROTOCHAR**)&pfr->szFilename);
+ }
+ case 12: return (INT_PTR)ppi->GetCaps(wParam, (HANDLE)lParam);
+ case 13: return (INT_PTR)ppi->GetIcon(wParam);
+ case 14: return (INT_PTR)ppi->GetInfo(hContact, wParam);;
+ case 15:
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->SearchBasic(StrConvT((char*)lParam));
+ else
+ return (INT_PTR)ppi->SearchBasic((TCHAR*)lParam);
+ case 16:
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->SearchByEmail(StrConvT((char*)lParam));
+ else
+ return (INT_PTR)ppi->SearchByEmail((TCHAR*)lParam);
+ case 17: {
+ PROTOSEARCHBYNAME* psbn = (PROTOSEARCHBYNAME*)lParam;
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->SearchByName(StrConvT((char*)psbn->pszNick),
+ StrConvT((char*)psbn->pszFirstName), StrConvT((char*)psbn->pszLastName));
+ else
+ return (INT_PTR)ppi->SearchByName(psbn->pszNick, psbn->pszFirstName, psbn->pszLastName);
+ }
+ case 18: return (INT_PTR)ppi->SearchAdvanced((HWND)lParam);
+ case 19: return (INT_PTR)ppi->CreateExtendedSearchUI ((HWND)lParam);
+ case 20: return (INT_PTR)ppi->RecvContacts(hContact, (PROTORECVEVENT*)lParam);
+ case 21: return (INT_PTR)ppi->RecvFile(hContact, (PROTOFILEEVENT*)lParam);
+ case 22: return (INT_PTR)ppi->RecvMsg(hContact, (PROTORECVEVENT*)lParam);
+ case 23: return (INT_PTR)ppi->RecvUrl(hContact, (PROTORECVEVENT*)lParam);
+ case 24: return (INT_PTR)ppi->SendContacts(hContact, LOWORD(wParam), HIWORD(wParam), (HANDLE*)lParam);
+ case 25:
+ if (ppi->m_iVersion > 1) {
+ TCHAR** files = Proto_FilesMatrixU((char**)lParam);
+ INT_PTR res = (INT_PTR)ppi->SendFile(hContact, StrConvT((char*)wParam), (TCHAR**)files);
+ if (res == 0) FreeFilesMatrix(&files);
+ return res;
+ }
+ else return (INT_PTR)ppi->SendFile(hContact, (TCHAR*)wParam, (TCHAR**)lParam);
+
+ case 26: return (INT_PTR)ppi->SendMsg(hContact, wParam, (const char*)lParam);
+ case 27: return (INT_PTR)ppi->SendUrl(hContact, wParam, (const char*)lParam);
+ case 28: return (INT_PTR)ppi->SetApparentMode(hContact, wParam);
+ case 29: return (INT_PTR)ppi->SetStatus(wParam);
+ case 30: return (INT_PTR)ppi->GetAwayMsg(hContact);
+ case 31: return (INT_PTR)ppi->RecvAwayMsg(hContact, wParam, (PROTORECVEVENT*)lParam);
+ case 32: return (INT_PTR)ppi->SendAwayMsg(hContact, (HANDLE)wParam, (const char*)lParam);
+ case 33:
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->SetAwayMsg(wParam, StrConvT((char*)lParam));
+ else
+ return (INT_PTR)ppi->SetAwayMsg(wParam, (TCHAR*)lParam);
+ case 34: return (INT_PTR)ppi->UserIsTyping((HANDLE)wParam, lParam);
+ case 35: lstrcpynA((char*)lParam, ppi->m_szModuleName, wParam); return 0;
+ case 36: return ppi->m_iStatus;
+
+ case 100:
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->SetAwayMsg(wParam, (TCHAR*)lParam);
+ else
+ return (INT_PTR)ppi->SetAwayMsg(wParam, StrConvA((TCHAR*)lParam));
+ case 102:
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->SendFile(hContact, (TCHAR*)wParam, (TCHAR**)lParam);
+ else {
+ char** files = Proto_FilesMatrixA((TCHAR**)lParam);
+ INT_PTR res = (INT_PTR)ppi->SendFile(hContact, StrConvA((TCHAR*)wParam), (TCHAR**)files);
+ if (res == 0) FreeFilesMatrix((TCHAR***)&files);
+ return res;
+ }
+ case 103:
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, (TCHAR*)lParam);
+ else
+ return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, StrConvA((TCHAR*)lParam));
+ case 104:
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, (TCHAR*)lParam);
+ else
+ return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, StrConvA((TCHAR*)lParam));
+ case 105: {
+ PROTOFILERESUME* pfr = (PROTOFILERESUME*)lParam;
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action,
+ (const PROTOCHAR**)&pfr->szFilename);
+ else {
+ char* szFname = mir_t2a(pfr->szFilename);
+ INT_PTR res = (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action,
+ (const PROTOCHAR**)&szFname);
+ mir_free(szFname);
+ } }
+ case 106:
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->AuthRequest(hContact, (const TCHAR*)lParam);
+ else
+ return (INT_PTR)ppi->AuthRequest(hContact, StrConvA((const TCHAR*)lParam));
+ case 107:
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->AuthDeny((HANDLE)wParam, (const TCHAR*)lParam);
+ else
+ return (INT_PTR)ppi->AuthDeny((HANDLE)wParam, StrConvA((const TCHAR*)lParam));
+ case 108:
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->SearchBasic((const TCHAR*)lParam);
+ else
+ return (INT_PTR)ppi->SearchBasic(StrConvA((const TCHAR*)lParam));
+ case 109: {
+ PROTOSEARCHBYNAME* psbn = (PROTOSEARCHBYNAME*)lParam;
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->SearchByName(psbn->pszNick, psbn->pszFirstName, psbn->pszLastName);
+ else
+ return (INT_PTR)ppi->SearchByName(StrConvA((TCHAR*)psbn->pszNick),
+ StrConvA((TCHAR*)psbn->pszFirstName), StrConvA((TCHAR*)psbn->pszLastName));
+ }
+ case 110:
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->SearchByEmail((const TCHAR*)lParam);
+ else
+ return (INT_PTR)ppi->SearchByEmail(StrConvA((const TCHAR*)lParam));
+ } } }
if ( !strcmp(szService, PS_ADDTOLIST)) {
@@ -618,10 +613,8 @@ INT_PTR CallProtoServiceInt(HANDLE hContact, const char *szModule, const char *s }
}
-
INT_PTR res = MyCallProtoService(szModule, szService, wParam, lParam);
-
if (res == CALLSERVICE_NOTFOUND && pa && pa->bOldProto && pa->ppro && strchr(szService, 'W')) {
TServiceListItem *item = serviceItems.find((TServiceListItem*)&szService);
if ( !item) return res;
diff --git a/src/modules/protocols/protoopts.cpp b/src/modules/protocols/protoopts.cpp index 9339c1e282..007e827388 100644 --- a/src/modules/protocols/protoopts.cpp +++ b/src/modules/protocols/protoopts.cpp @@ -339,7 +339,7 @@ static LRESULT CALLBACK AccListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA rc.bottom = rc.top + max(GetSystemMetrics(SM_CXSMICON), parentDat->titleHeight) + 4 - 1;
++rc.top; --rc.right;
- dat->hwndEdit = CreateWindow(_T("EDIT"), pa->tszAccountName, WS_CHILD|WS_BORDER|ES_AUTOHSCROLL, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, hwnd, NULL, hMirandaInst, NULL);
+ dat->hwndEdit = CreateWindow(_T("EDIT"), pa->tszAccountName, WS_CHILD|WS_BORDER|ES_AUTOHSCROLL, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, hwnd, NULL, hInst, NULL);
SetWindowLongPtr(dat->hwndEdit, GWLP_USERDATA, SetWindowLongPtr(dat->hwndEdit, GWLP_WNDPROC, (LONG_PTR)sttEditSubclassProc));
SendMessage(dat->hwndEdit, WM_SETFONT, (WPARAM)parentDat->hfntTitle, 0);
SendMessage(dat->hwndEdit, EM_SETMARGINS, EC_LEFTMARGIN|EC_RIGHTMARGIN|EC_USEFONTINFO, 0);
@@ -781,7 +781,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM }
else pa->type = PROTOTYPE_DISPROTO; }
else {
- DWORD dwStatus = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
+ DWORD dwStatus = CallProtoServiceInt(NULL,pa->szModuleName, PS_GETSTATUS, 0, 0);
if (dwStatus >= ID_STATUS_ONLINE) {
if (IDCANCEL == ::MessageBox(hwndDlg,
TranslateT("Account is online. Disable account?"),
@@ -829,7 +829,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM case IDC_ADD:
{
AccFormDlgParam param = { PRAC_ADDED, NULL };
- if (IDOK == DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_ACCFORM), hwndDlg, AccFormDlgProc, (LPARAM)¶m))
+ if (IDOK == DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ACCFORM), hwndDlg, AccFormDlgProc, (LPARAM)¶m))
SendMessage(hwndDlg, WM_MY_REFRESH, 0, 0);
}
break;
@@ -904,7 +904,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM int idx = ListBox_GetCurSel(hList);
if (idx != -1) {
AccFormDlgParam param = { PRAC_UPGRADED, (PROTOACCOUNT*)ListBox_GetItemData(hList, idx) };
- DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_ACCFORM), hwndDlg, AccFormDlgProc, (LPARAM)¶m);
+ DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ACCFORM), hwndDlg, AccFormDlgProc, (LPARAM)¶m);
} }
break;
@@ -1024,7 +1024,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM static INT_PTR OptProtosShow(WPARAM, LPARAM)
{
if ( !hAccMgr)
- hAccMgr = CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_ACCMGR), NULL, AccMgrDlgProc, 0);
+ hAccMgr = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ACCMGR), NULL, AccMgrDlgProc, 0);
ShowWindow(hAccMgr, SW_RESTORE);
SetForegroundWindow(hAccMgr);
diff --git a/src/modules/skin/hotkey_opts.cpp b/src/modules/skin/hotkey_opts.cpp index 929bb8be74..6bebcdc273 100644 --- a/src/modules/skin/hotkey_opts.cpp +++ b/src/modules/skin/hotkey_opts.cpp @@ -1005,7 +1005,7 @@ int HotkeyOptionsInit(WPARAM wParam, LPARAM) {
OPTIONSDIALOGPAGE odp = {0};
odp.cbSize = sizeof(odp);
- odp.hInstance = hMirandaInst;
+ odp.hInstance = hInst;
odp.flags = ODPF_BOLDGROUPS;
odp.position = -180000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_HOTKEYS);
diff --git a/src/modules/skin/hotkeys.cpp b/src/modules/skin/hotkeys.cpp index 76a31b6f2e..a36dd152d1 100644 --- a/src/modules/skin/hotkeys.cpp +++ b/src/modules/skin/hotkeys.cpp @@ -332,7 +332,7 @@ int LoadSkinHotkeys(void) wcl.style = 0;
wcl.cbClsExtra = 0;
wcl.cbWndExtra = 0;
- wcl.hInstance = hMirandaInst;
+ wcl.hInstance = hInst;
wcl.hIcon = NULL;
wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
@@ -343,7 +343,7 @@ int LoadSkinHotkeys(void) g_pid = GetCurrentProcessId();
- g_hwndHotkeyHost = CreateWindow(_T("MirandaHotkeyHostWnd"), NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hMirandaInst, NULL);
+ g_hwndHotkeyHost = CreateWindow(_T("MirandaHotkeyHostWnd"), NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hInst, NULL);
SetWindowPos(g_hwndHotkeyHost, 0, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING|SWP_HIDEWINDOW);
hhkKeyboard = SetWindowsHookEx(WH_KEYBOARD, sttKeyboardProc, NULL, GetCurrentThreadId());
diff --git a/src/modules/skin/skin.h b/src/modules/skin/skin.h index 274b0d82df..bd8783e17d 100644 --- a/src/modules/skin/skin.h +++ b/src/modules/skin/skin.h @@ -56,8 +56,8 @@ struct THotkeyItem bool UnregisterHotkey; // valid only during WM_APP message in options UI, used to remove unregistered hotkeys from options
- __inline TCHAR* getSection() const { return LangPackTranslateStringT(hLangpack, ptszSection); }
- __inline TCHAR* getDescr() const { return LangPackTranslateStringT(hLangpack, ptszDescription); }
+ __inline TCHAR* getSection() const { return TranslateTH(hLangpack, ptszSection); }
+ __inline TCHAR* getDescr() const { return TranslateTH(hLangpack, ptszDescription); }
};
extern LIST<THotkeyItem> hotkeys;
diff --git a/src/modules/skin/skinicons.cpp b/src/modules/skin/skinicons.cpp index 24138e0000..509135ae20 100644 --- a/src/modules/skin/skinicons.cpp +++ b/src/modules/skin/skinicons.cpp @@ -135,7 +135,7 @@ HICON LoadIconEx(HINSTANCE hInstance, LPCTSTR lpIconName, BOOL bShared) {
HICON hResIcon = bShared ? LoadSmallIcon(hInstance, lpIconName) : LoadSmallIconShared(hInstance, lpIconName);
if ( !hResIcon) { //Icon not found in hInstance lets try to load it from core
- HINSTANCE hCoreInstance=hMirandaInst;
+ HINSTANCE hCoreInstance=hInst;
if (hCoreInstance != hInstance)
hResIcon = bShared ? LoadSmallIcon(hCoreInstance, lpIconName) : LoadSmallIconShared(hCoreInstance, lpIconName);
}
@@ -144,7 +144,7 @@ HICON LoadIconEx(HINSTANCE hInstance, LPCTSTR lpIconName, BOOL bShared) int ImageList_AddIcon_NotShared(HIMAGELIST hIml, LPCTSTR szResource)
{
- HICON hTempIcon=LoadIconEx(hMirandaInst, szResource, 0);
+ HICON hTempIcon=LoadIconEx(hInst, szResource, 0);
int res = ImageList_AddIcon(hIml, hTempIcon);
Safe_DestroyIcon(hTempIcon);
return res;
@@ -222,7 +222,7 @@ HICON LoadSkinProtoIcon(const char* szProto, int status, bool big) int i, statusIndx = -1;
char iconName[MAX_PATH];
HICON hIcon;
- DWORD caps2 = (szProto == NULL) ? (DWORD)-1 : CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_2, 0);
+ DWORD caps2 = (szProto == NULL) ? (DWORD)-1 : CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_2, 0);
if (status >= ID_STATUS_CONNECTING && status < ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES) {
mir_snprintf(iconName, SIZEOF(iconName), "%s%d", mainIconsFmt, 7);
@@ -276,7 +276,7 @@ HICON LoadSkinProtoIcon(const char* szProto, int status, bool big) sid.cbSize = sizeof(sid);
sid.flags = SIDF_ALL_TCHAR;
- GetModuleFileName(hMirandaInst, szPath, MAX_PATH);
+ GetModuleFileName(hInst, szPath, MAX_PATH);
str = _tcsrchr(szPath, '\\');
if (str != NULL)
*str = 0;
diff --git a/src/modules/skin/sounds.cpp b/src/modules/skin/sounds.cpp index 94da829145..24b4e44476 100644 --- a/src/modules/skin/sounds.cpp +++ b/src/modules/skin/sounds.cpp @@ -30,8 +30,8 @@ struct SoundItem TCHAR* ptszTempFile;
int hLangpack;
- __inline TCHAR* getSection() const { return LangPackTranslateStringT(hLangpack, ptszSection); }
- __inline TCHAR* getDescr() const { return LangPackTranslateStringT(hLangpack, ptszDescription); }
+ __inline TCHAR* getSection() const { return TranslateTH(hLangpack, ptszSection); }
+ __inline TCHAR* getDescr() const { return TranslateTH(hLangpack, ptszDescription); }
__inline void clear(void)
{
@@ -112,7 +112,7 @@ static INT_PTR ServiceSkinPlaySound(WPARAM, LPARAM lParam) DBVARIANT dbv;
if ( DBGetContactSettingTString(NULL, "SkinSounds", pszSoundName, &dbv) == 0) {
TCHAR szFull[MAX_PATH];
- pathToAbsoluteT(dbv.ptszVal, szFull, NULL);
+ PathToAbsoluteT(dbv.ptszVal, szFull, NULL);
NotifyEventHooks(hPlayEvent, 0, (LPARAM)szFull);
DBFreeVariant(&dbv);
}
@@ -236,7 +236,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM DBVARIANT dbv;
if ( !DBGetContactSettingTString(NULL, "SkinSounds", arSounds[tvi.lParam].name, &dbv)) {
TCHAR szPathFull[MAX_PATH];
- pathToAbsoluteT(dbv.ptszVal, szPathFull, NULL);
+ PathToAbsoluteT(dbv.ptszVal, szPathFull, NULL);
NotifyEventHooks(hPlayEvent, 1, (LPARAM)szPathFull);
DBFreeVariant(&dbv);
}
@@ -266,12 +266,12 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (DBGetContactSettingByte(NULL, "SkinSoundsOff", snd.name, 0) == 0) {
DBVARIANT dbv;
if (DBGetContactSettingTString(NULL, "SkinSounds", snd.name, &dbv) == 0) {
- pathToAbsoluteT(dbv.ptszVal, strdir, NULL);
+ PathToAbsoluteT(dbv.ptszVal, strdir, NULL);
DBFreeVariant(&dbv);
} } }
mir_sntprintf(strFull, SIZEOF(strFull), _T("%s"), snd.ptszTempFile ? snd.ptszTempFile : _T(""));
- pathToAbsoluteT(strFull, strdir, NULL);
+ PathToAbsoluteT(strFull, strdir, NULL);
OPENFILENAME ofn;
ZeroMemory(&ofn, sizeof(ofn));
@@ -411,7 +411,7 @@ static int SkinOptionsInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 };
odp.cbSize = sizeof(odp);
odp.position = -200000000;
- odp.hInstance = hMirandaInst;
+ odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SOUND);
odp.pszGroup = LPGEN("Customize");
odp.pszTitle = LPGEN("Sounds");
diff --git a/src/modules/srauth/auth.cpp b/src/modules/srauth/auth.cpp index c8257c3e20..61dedc06be 100644 --- a/src/modules/srauth/auth.cpp +++ b/src/modules/srauth/auth.cpp @@ -30,14 +30,14 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar INT_PTR ShowReqWindow(WPARAM, LPARAM lParam)
{
- CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_AUTHREQ), NULL, DlgProcAuthReq,
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_AUTHREQ), NULL, DlgProcAuthReq,
(LPARAM)((CLISTEVENT *)lParam)->hDbEvent);
return 0;
}
INT_PTR ShowAddedWindow(WPARAM, LPARAM lParam)
{
- CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_ADDED), NULL, DlgProcAdded,
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDED), NULL, DlgProcAdded,
(LPARAM)((CLISTEVENT *)lParam)->hDbEvent);
return 0;
}
diff --git a/src/modules/srauth/authdialogs.cpp b/src/modules/srauth/authdialogs.cpp index b5693e01dd..7a19f54642 100644 --- a/src/modules/srauth/authdialogs.cpp +++ b/src/modules/srauth/authdialogs.cpp @@ -52,8 +52,8 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar char* last = first + strlen(first) + 1;
char* email = last + strlen(last) + 1;
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0));
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_LARGE, 0));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, CallProtoServiceInt(NULL,dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0));
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG, CallProtoServiceInt(NULL,dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_LARGE, 0));
PROTOACCOUNT* acc = Proto_GetAccount(dbei.szModule);
@@ -184,8 +184,8 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP email = last + strlen(last) + 1;
reason = email + strlen(email) + 1;
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0));
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_LARGE, 0));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, CallProtoServiceInt(NULL,dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0));
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG, CallProtoServiceInt(NULL,dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_LARGE, 0));
PROTOACCOUNT* acc = Proto_GetAccount(dbei.szModule);
@@ -234,7 +234,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
SendDlgItemMessage(hwndDlg, IDC_DENYREASON, EM_LIMITTEXT, 255, 0);
- if (CallProtoService(dbei.szModule, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_NOAUTHDENYREASON)
+ if (CallProtoServiceInt(NULL,dbei.szModule, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_NOAUTHDENYREASON)
{
EnableWindow(GetDlgItem(hwndDlg, IDC_DENYREASON), FALSE);
SetDlgItemText(hwndDlg, IDC_DENYREASON, TranslateT("Feature is not supported by protocol"));
@@ -267,7 +267,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DBEVENTINFO dbei = {0};
dbei.cbSize = sizeof(dbei);
CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
- CallProtoService(dbei.szModule, PS_AUTHALLOW, (WPARAM)hDbEvent, 0);
+ CallProtoServiceInt(NULL,dbei.szModule, PS_AUTHALLOW, (WPARAM)hDbEvent, 0);
if (IsDlgButtonChecked(hwndDlg, IDC_ADDCHECK))
{
@@ -291,10 +291,10 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP {
TCHAR szReason[256];
GetDlgItemText(hwndDlg, IDC_DENYREASON, szReason, SIZEOF(szReason));
- CallProtoService(dbei.szModule, PS_AUTHDENYT, (WPARAM)hDbEvent, (LPARAM)szReason);
+ CallProtoServiceInt(NULL,dbei.szModule, PS_AUTHDENYT, (WPARAM)hDbEvent, (LPARAM)szReason);
}
else
- CallProtoService(dbei.szModule, PS_AUTHDENYT, (WPARAM)hDbEvent, 0);
+ CallProtoServiceInt(NULL,dbei.szModule, PS_AUTHDENYT, (WPARAM)hDbEvent, 0);
}
DestroyWindow(hwndDlg);
break;;
diff --git a/src/modules/srawaymsg/awaymsg.cpp b/src/modules/srawaymsg/awaymsg.cpp index e480dab74a..82ea8f2121 100644 --- a/src/modules/srawaymsg/awaymsg.cpp +++ b/src/modules/srawaymsg/awaymsg.cpp @@ -125,7 +125,7 @@ static INT_PTR GetMessageCommand(WPARAM wParam, LPARAM) SetForegroundWindow(hwnd);
SetFocus(hwnd);
}
- else CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_READAWAYMSG), NULL, ReadAwayMsgDlgProc, wParam);
+ else CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_READAWAYMSG), NULL, ReadAwayMsgDlgProc, wParam);
return 0;
}
@@ -146,8 +146,8 @@ static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM) int status = DBGetContactSettingWord((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE);
mir_sntprintf(str, SIZEOF(str), TranslateT("Re&ad %s Message"), cli.pfnGetStatusModeDescription(status, 0));
clmi.ptszName = str;
- if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV) {
- if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(status)) {
+ if (CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV) {
+ if (CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(status)) {
clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_NOTOFFLINE | CMIM_ICON | CMIF_TCHAR;
clmi.hIcon = LoadSkinProtoIcon(szProto, status);
} } } }
diff --git a/src/modules/srawaymsg/sendmsg.cpp b/src/modules/srawaymsg/sendmsg.cpp index d11f80715a..843b43f64f 100644 --- a/src/modules/srawaymsg/sendmsg.cpp +++ b/src/modules/srawaymsg/sendmsg.cpp @@ -73,7 +73,7 @@ static TCHAR* GetAwayMessage(int statusMode, char *szProto) {
DBVARIANT dbv;
- if (szProto && !(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(statusMode)))
+ if (szProto && !(CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(statusMode)))
return NULL;
if (DBGetContactSettingByte(NULL, "SRAway", StatusModeToDbSetting(statusMode, "Ignore"), 0))
@@ -176,13 +176,13 @@ void ChangeAllProtoMessages(char *szProto, int statusMode, TCHAR *msg) {
PROTOACCOUNT* pa = accounts[i];
if ( !Proto_IsAccountEnabled(pa)) continue;
- if ((CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) &&
+ if ((CallProtoServiceInt(NULL,pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) &&
!Proto_IsAccountLocked(pa))
- CallProtoService(pa->szModuleName, PS_SETAWAYMSGT, statusMode, (LPARAM)msg);
+ CallProtoServiceInt(NULL,pa->szModuleName, PS_SETAWAYMSGT, statusMode, (LPARAM)msg);
}
}
else
- CallProtoService(szProto, PS_SETAWAYMSGT, statusMode, (LPARAM)msg);
+ CallProtoServiceInt(NULL,szProto, PS_SETAWAYMSGT, statusMode, (LPARAM)msg);
}
struct SetAwayMsgData
@@ -323,8 +323,8 @@ static int StatusModeChange(WPARAM wParam, LPARAM lParam) else
{
// If its a single protocol check the PFLAGNUM_3 for the single protocol
- if ( !(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) ||
- !(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(statusMode)))
+ if ( !(CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) ||
+ !(CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(statusMode)))
return 0;
}
@@ -346,7 +346,7 @@ static int StatusModeChange(WPARAM wParam, LPARAM lParam) newdat->statusMode = statusMode;
if (hwndStatusMsg)
DestroyWindow(hwndStatusMsg);
- hwndStatusMsg = CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_SETAWAYMSG),
+ hwndStatusMsg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SETAWAYMSG),
NULL, SetAwayMsgDlgProc, (LPARAM)newdat);
}
return 0;
@@ -547,7 +547,7 @@ static int AwayMsgOptInitialise(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 };
odp.cbSize = sizeof(odp);
odp.position = 870000000;
- odp.hInstance = hMirandaInst;
+ odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_AWAYMSG);
odp.pszTitle = LPGEN("Status Messages");
odp.pszGroup = LPGEN("Status");
@@ -570,7 +570,7 @@ static int AwayMsgSendModernOptInit(WPARAM wParam, LPARAM) MODERNOPTOBJECT obj = {0};
obj.cbSize = sizeof(obj);
- obj.hInstance = hMirandaInst;
+ obj.hInstance = hInst;
obj.dwFlags = MODEROPT_FLG_TCHAR | MODEROPT_FLG_NORESIZE;
obj.iSection = MODERNOPT_PAGE_STATUS;
obj.iType = MODERNOPT_TYPE_SECTIONPAGE;
@@ -590,7 +590,7 @@ static int AwayMsgSendAccountsChanged(WPARAM, LPARAM) for (int i=0; i < accounts.getCount(); i++)
{
if ( !Proto_IsAccountEnabled(accounts[i])) continue;
- protoModeMsgFlags |= CallProtoService(accounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
+ protoModeMsgFlags |= CallProtoServiceInt(NULL,accounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
}
return 0;
diff --git a/src/modules/srfile/file.cpp b/src/modules/srfile/file.cpp index 6f3b3e0ddf..b398294c8d 100644 --- a/src/modules/srfile/file.cpp +++ b/src/modules/srfile/file.cpp @@ -33,7 +33,7 @@ static INT_PTR SendFileCommand(WPARAM wParam, LPARAM) struct FileSendData fsd;
fsd.hContact=(HANDLE)wParam;
fsd.ppFiles=NULL;
- CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
return 0;
}
@@ -52,7 +52,7 @@ static INT_PTR SendSpecificFiles(WPARAM wParam, LPARAM lParam) fsd.ppFiles[i] = (const TCHAR*)mir_a2t(ppFiles[i]);
fsd.ppFiles[ count ] = NULL;
- CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
for (int j=0; j < count; j++)
mir_free((void*)fsd.ppFiles[j]);
return 0;
@@ -63,7 +63,7 @@ static INT_PTR SendSpecificFilesT(WPARAM wParam, LPARAM lParam) FileSendData fsd;
fsd.hContact=(HANDLE)wParam;
fsd.ppFiles=(const TCHAR**)lParam;
- CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
return 0;
}
@@ -79,7 +79,7 @@ static INT_PTR GetReceivedFilesFolder(WPARAM wParam, LPARAM lParam) static INT_PTR RecvFileCommand(WPARAM, LPARAM lParam)
{
- CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_FILERECV), NULL, DlgProcRecvFile, lParam);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILERECV), NULL, DlgProcRecvFile, lParam);
return 0;
}
@@ -91,7 +91,7 @@ void PushFileEvent(HANDLE hContact, HANDLE hdbe, LPARAM lParam) cle.hDbEvent = hdbe;
cle.lParam = lParam;
if (DBGetContactSettingByte(NULL, "SRFile", "AutoAccept", 0) && !DBGetContactSettingByte(hContact, "CList", "NotOnList", 0)) {
- CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_FILERECV), NULL, DlgProcRecvFile, (LPARAM)&cle);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILERECV), NULL, DlgProcRecvFile, (LPARAM)&cle);
}
else {
SkinPlaySound("RecvFile");
@@ -284,8 +284,8 @@ static int SRFilePreBuildMenu(WPARAM wParam, LPARAM) char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
if (szProto != NULL) {
- if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_FILESEND) {
- if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_OFFLINEFILES)
+ if (CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_FILESEND) {
+ if (CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_OFFLINEFILES)
mi.flags = CMIM_FLAGS;
else if (DBGetContactSettingWord((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
mi.flags = CMIM_FLAGS;
diff --git a/src/modules/srfile/fileexistsdlg.cpp b/src/modules/srfile/fileexistsdlg.cpp index d98ce59f78..1975226b90 100644 --- a/src/modules/srfile/fileexistsdlg.cpp +++ b/src/modules/srfile/fileexistsdlg.cpp @@ -189,7 +189,7 @@ void __cdecl LoadIconsAndTypesThread(void* param) else {
iconIndex = _ttoi(pszComma+1); *pszComma='\0';
}
- hIcon = ExtractIcon(hMirandaInst, szIconFile, iconIndex);
+ hIcon = ExtractIcon(hInst, szIconFile, iconIndex);
if (hIcon)
fileInfo.hIcon = hIcon;
}
diff --git a/src/modules/srfile/fileopts.cpp b/src/modules/srfile/fileopts.cpp index e68781da7c..b8c8c0133a 100644 --- a/src/modules/srfile/fileopts.cpp +++ b/src/modules/srfile/fileopts.cpp @@ -234,7 +234,7 @@ int FileOptInitialise(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = {0};
odp.cbSize = sizeof(odp);
odp.position = 900000000;
- odp.hInstance = hMirandaInst;
+ odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FILETRANSFER);
odp.pszTitle = LPGEN("File Transfers");
odp.pszGroup = LPGEN("Events");
diff --git a/src/modules/srfile/filerecvdlg.cpp b/src/modules/srfile/filerecvdlg.cpp index 61f2c29153..7249291b6d 100644 --- a/src/modules/srfile/filerecvdlg.cpp +++ b/src/modules/srfile/filerecvdlg.cpp @@ -330,7 +330,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (szProto) {
HICON hIcon;
- hIcon=(HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
+ hIcon=(HICON)CallProtoServiceInt(NULL,szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
if (hIcon) {
DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
DestroyIcon(hIcon);
diff --git a/src/modules/srfile/filesenddlg.cpp b/src/modules/srfile/filesenddlg.cpp index d1d0f26c16..92875ddbdb 100644 --- a/src/modules/srfile/filesenddlg.cpp +++ b/src/modules/srfile/filesenddlg.cpp @@ -281,7 +281,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0);
if (szProto) {
- HICON hIcon = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
+ HICON hIcon = (HICON)CallProtoServiceInt(NULL,szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
if (hIcon) {
DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
DestroyIcon(hIcon);
diff --git a/src/modules/srfile/filexferdlg.cpp b/src/modules/srfile/filexferdlg.cpp index 743e220051..3dc4e27bd5 100644 --- a/src/modules/srfile/filexferdlg.cpp +++ b/src/modules/srfile/filexferdlg.cpp @@ -45,7 +45,7 @@ struct virusscanthreadstartinfo { TCHAR* PFTS_StringToTchar(int flags, const PROTOCHAR* s)
{
if (flags & PFTS_UTF)
- return Utf8DecodeUcs2((char*)s);
+ return Utf8DecodeW((char*)s);
else if (flags & PFTS_UNICODE)
return mir_tstrdup(s);
else
@@ -55,7 +55,7 @@ TCHAR* PFTS_StringToTchar(int flags, const PROTOCHAR* s) int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS* ft, const PROTOCHAR* s, TCHAR* r)
{
if (ft->flags & PFTS_UTF) {
- TCHAR* ts = Utf8DecodeUcs2((char*)s);
+ TCHAR* ts = Utf8DecodeW((char*)s);
int res = _tcscmp(ts, r);
mir_free(ts);
return res;
@@ -314,14 +314,14 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (dat->bytesRecvedHistory[0] == dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1])
lstrcpy(szTime, _T("??:??:??"));
else {
- li.QuadPart=BIGI(10000000)*(dat->transferStatus.currentFileSize-dat->transferStatus.currentFileProgress)*dat->bytesRecvedHistorySize/(dat->bytesRecvedHistory[0]-dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1]);
- ft.dwHighDateTime=li.HighPart; ft.dwLowDateTime=li.LowPart;
+ li.QuadPart = BIGI(10000000)*(dat->transferStatus.currentFileSize-dat->transferStatus.currentFileProgress)*dat->bytesRecvedHistorySize/(dat->bytesRecvedHistory[0]-dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1]);
+ ft.dwHighDateTime = li.HighPart; ft.dwLowDateTime = li.LowPart;
FileTimeToSystemTime(&ft, &st);
GetTimeFormat(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT|TIME_NOTIMEMARKER, &st, NULL, szTime, SIZEOF(szTime));
}
if (dat->bytesRecvedHistory[0] != dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1]) {
li.QuadPart=BIGI(10000000)*(dat->transferStatus.totalBytes-dat->transferStatus.totalProgress)*dat->bytesRecvedHistorySize/(dat->bytesRecvedHistory[0]-dat->bytesRecvedHistory[dat->bytesRecvedHistorySize-1]);
- ft.dwHighDateTime=li.HighPart; ft.dwLowDateTime=li.LowPart;
+ ft.dwHighDateTime = li.HighPart; ft.dwLowDateTime = li.LowPart;
FileTimeToSystemTime(&ft, &st);
GetTimeFormat(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT|TIME_NOTIMEMARKER, &st, NULL, szTime, SIZEOF(szTime));
}
@@ -502,7 +502,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR break;
}
mir_free(szOriginalFilename);
- CallProtoService(szProto, PS_FILERESUMET, (WPARAM)dat->fs, (LPARAM)pfr);
+ CallProtoServiceInt(NULL,szProto, PS_FILERESUMET, (WPARAM)dat->fs, (LPARAM)pfr);
if (pfr->szFilename) mir_free((char*)pfr->szFilename);
mir_free(pfr);
break;
@@ -556,7 +556,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (dat->resumeBehaviour == FILERESUME_ASK) {
TDlgProcFileExistsParam param = { hwndDlg, fts };
ShowWindow(hwndDlg, SW_SHOWNORMAL);
- CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_FILEEXISTS), hwndDlg, DlgProcFileExists, (LPARAM)¶m);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILEEXISTS), hwndDlg, DlgProcFileExists, (LPARAM)¶m);
EnableWindow(hwndDlg, FALSE);
}
else {
@@ -720,7 +720,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR UTILRESIZEDIALOG urd={0};
urd.cbSize=sizeof(urd);
urd.hwndDlg=hwndDlg;
- urd.hInstance=hMirandaInst;
+ urd.hInstance=hInst;
urd.lpTemplate=MAKEINTRESOURCEA(IDD_FILETRANSFERINFO);
urd.pfnResizer=FileTransferDlgResizer;
CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
diff --git a/src/modules/srfile/ftmanager.cpp b/src/modules/srfile/ftmanager.cpp index 08b4a9e59c..7e0dcfc9cc 100644 --- a/src/modules/srfile/ftmanager.cpp +++ b/src/modules/srfile/ftmanager.cpp @@ -313,8 +313,8 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM dat->hhkPreshutdown = HookEventMessage(ME_SYSTEM_PRESHUTDOWN, hwnd, M_PRESHUTDOWN);
- dat->hwndIncoming = CreateDialog(hMirandaInst, MAKEINTRESOURCE(IDD_FTPAGE), hwnd, FtMgrPageDlgProc);
- dat->hwndOutgoing = CreateDialog(hMirandaInst, MAKEINTRESOURCE(IDD_FTPAGE), hwnd, FtMgrPageDlgProc);
+ dat->hwndIncoming = CreateDialog(hInst, MAKEINTRESOURCE(IDD_FTPAGE), hwnd, FtMgrPageDlgProc);
+ dat->hwndOutgoing = CreateDialog(hInst, MAKEINTRESOURCE(IDD_FTPAGE), hwnd, FtMgrPageDlgProc);
ShowWindow(dat->hwndIncoming, SW_SHOW);
tci.mask = TCIF_PARAM|TCIF_TEXT;
@@ -537,7 +537,7 @@ HWND FtMgr_Show(bool bForceActivate, bool bFromMenu) bool bJustCreated = (hwndFtMgr == NULL);
if (bJustCreated)
{
- hwndFtMgr = CreateDialog(hMirandaInst, MAKEINTRESOURCE(IDD_FTMGR), NULL, FtMgrDlgProc);
+ hwndFtMgr = CreateDialog(hInst, MAKEINTRESOURCE(IDD_FTMGR), NULL, FtMgrDlgProc);
}
if (bFromMenu) /* lqbe */
{
@@ -584,7 +584,7 @@ HWND FtMgr_AddTransfer(FileDlgData *fdd) TFtMgrData *dat = (TFtMgrData*)GetWindowLongPtr(FtMgr_Show(bForceActivate, false), GWLP_USERDATA);
if (dat == NULL) return NULL;
HWND hwndBox = fdd->send ? dat->hwndOutgoing : dat->hwndIncoming;
- HWND hwndFt = CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_FILETRANSFERINFO), hwndBox, DlgProcFileTransfer, (LPARAM)fdd);
+ HWND hwndFt = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILETRANSFERINFO), hwndBox, DlgProcFileTransfer, (LPARAM)fdd);
ShowWindow(hwndFt, SW_SHOWNA);
SendMessage(hwndBox, WM_FT_ADD, 0, (LPARAM)hwndFt);
FtMgr_ShowPage(fdd->send ? 1 : 0);
diff --git a/src/modules/srurl/url.cpp b/src/modules/srurl/url.cpp index 4eafff94a2..fe790330c0 100644 --- a/src/modules/srurl/url.cpp +++ b/src/modules/srurl/url.cpp @@ -34,7 +34,7 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP static INT_PTR ReadUrlCommand(WPARAM, LPARAM lParam)
{
- CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_URLRECV), NULL, DlgProcUrlRecv, lParam);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_URLRECV), NULL, DlgProcUrlRecv, lParam);
return 0;
}
@@ -66,7 +66,7 @@ static int UrlEventAdded(WPARAM wParam, LPARAM lParam) static INT_PTR SendUrlCommand(WPARAM wParam, LPARAM)
{
- CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_URLSEND), NULL, DlgProcUrlSend, wParam);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_URLSEND), NULL, DlgProcUrlSend, wParam);
return 0;
}
@@ -121,7 +121,7 @@ static int SRUrlPreBuildMenu(WPARAM wParam, LPARAM) char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
if (szProto != NULL)
- if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_URLSEND)
+ if (CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_URLSEND)
mi.flags = CMIM_FLAGS;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hSRUrlMenuItem, (LPARAM)&mi);
diff --git a/src/modules/srurl/urldialogs.cpp b/src/modules/srurl/urldialogs.cpp index 6e26068ce8..6fb5e7f33a 100644 --- a/src/modules/srurl/urldialogs.cpp +++ b/src/modules/srurl/urldialogs.cpp @@ -145,7 +145,7 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (szProto) {
HICON hIcon;
- hIcon = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
+ hIcon = (HICON)CallProtoServiceInt(NULL,szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
if (hIcon) {
DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
DestroyIcon(hIcon);
@@ -166,7 +166,7 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP RECT rc;
char url[256];
- hMenu=LoadMenu(hMirandaInst, MAKEINTRESOURCE(IDR_CONTEXT));
+ hMenu=LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT));
hSubMenu=GetSubMenu(hMenu, 6);
TranslateMenu(hSubMenu);
GetWindowRect((HWND)lParam, &rc);
@@ -524,7 +524,7 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (dis->hwndItem == GetDlgItem(hwndDlg, IDC_PROTOCOL)) {
char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0);
if (szProto) {
- HICON hIcon = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
+ HICON hIcon = (HICON)CallProtoServiceInt(NULL,szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
if (hIcon) {
DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
DestroyIcon(hIcon);
diff --git a/src/modules/updatenotify/updatenotify.cpp b/src/modules/updatenotify/updatenotify.cpp index e27bd5503e..184f46a42b 100644 --- a/src/modules/updatenotify/updatenotify.cpp +++ b/src/modules/updatenotify/updatenotify.cpp @@ -138,7 +138,7 @@ static int UpdateNotifyOptInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 };
odp.cbSize = sizeof(odp);
odp.position = 100000000;
- odp.hInstance = hMirandaInst;
+ odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_UPDATENOTIFY);
odp.pszGroup = LPGEN("Events");
odp.pszTitle = LPGEN("Update Notify");
@@ -162,7 +162,7 @@ static INT_PTR UpdateNotifyMenuCommand(WPARAM, LPARAM) { DBWriteContactSettingDword(NULL, UN_MOD, UN_CURRENTVERSIONFND, und.reqTime);
}
und.isManual = 1;
- DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_UPDATE_NOTIFY), 0, UpdateNotifyProc, (LPARAM)&und);
+ DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_UPDATE_NOTIFY), 0, UpdateNotifyProc, (LPARAM)&und);
hwndManualUpdateDlg = 0;
return 0;
}
@@ -517,7 +517,7 @@ static void UpdateNotifyPerform(void *) if (notify) {
DBWriteContactSettingString(NULL, UN_MOD, UN_CURRENTVERSION, und.versionReal);
DBWriteContactSettingDword(NULL, UN_MOD, UN_CURRENTVERSIONFND, und.reqTime);
- DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_UPDATE_NOTIFY), 0, UpdateNotifyProc, (LPARAM)&und);
+ DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_UPDATE_NOTIFY), 0, UpdateNotifyProc, (LPARAM)&und);
hwndUpdateDlg = 0;
}
}
diff --git a/src/modules/userinfo/contactinfo.cpp b/src/modules/userinfo/contactinfo.cpp index f83c1c5a5c..64c84cf221 100644 --- a/src/modules/userinfo/contactinfo.cpp +++ b/src/modules/userinfo/contactinfo.cpp @@ -209,7 +209,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
if (hHandCursor == NULL) {
if (IsWinVer2000Plus()) hHandCursor=LoadCursor(NULL, IDC_HAND);
- else hHandCursor=LoadCursor(hMirandaInst, MAKEINTRESOURCE(IDC_HYPERLINKHAND));
+ else hHandCursor=LoadCursor(hInst, MAKEINTRESOURCE(IDC_HYPERLINKHAND));
}
TranslateDialogDefault(hwndDlg);
{ LVCOLUMN lvc;
@@ -441,7 +441,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP char szNewData[256]="", idstr[33];
int i;
DBVARIANT dbv;
- if (IDOK != DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc, (LPARAM)szNewData))
+ if (IDOK != DialogBoxParam(hInst, MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc, (LPARAM)szNewData))
break;
for (i=0;;i++) {
mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i);
@@ -477,7 +477,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (DBGetContactSettingString(hContact, "UserInfo", idstr, &dbv)) break;
lstrcpynA(szText, dbv.pszVal, SIZEOF(szText));
DBFreeVariant(&dbv);
- if (IDOK != DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc, (LPARAM)szText))
+ if (IDOK != DialogBoxParam(hInst, MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc, (LPARAM)szText))
break;
DBWriteContactSettingString(hContact, "UserInfo", idstr, szText);
SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
diff --git a/src/modules/userinfo/stdinfo.cpp b/src/modules/userinfo/stdinfo.cpp index 40f749efdf..42f2b3241d 100644 --- a/src/modules/userinfo/stdinfo.cpp +++ b/src/modules/userinfo/stdinfo.cpp @@ -38,7 +38,7 @@ static int Proto_GetContactInfoSetting(HANDLE hContact, const char *szProto, con DBCONTACTGETSETTING cgs={szModule, szSetting, dbv};
dbv->type=(BYTE)nType;
- return CallProtoService(szProto, PS_GETINFOSETTING, (WPARAM)hContact, (LPARAM)&cgs);
+ return CallProtoServiceInt(NULL,szProto, PS_GETINFOSETTING, (WPARAM)hContact, (LPARAM)&cgs);
}
static void Proto_FreeInfoVariant(DBVARIANT *dbv)
@@ -69,7 +69,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, HANDLE hContact, char *szModule, TCHAR* ptstr = NULL;
int unspecified=0;
char* szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- bool proto_service = szProto && (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC);
+ bool proto_service = szProto && (CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC);
dbv.type=DBVT_DELETED;
if (szModule == NULL) unspecified=1;
@@ -385,7 +385,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (hContact != NULL) {
char *szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if (szProto == NULL) break;
- bool proto_service = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC) == PF4_INFOSETTINGSVC;
+ bool proto_service = (CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC) == PF4_INFOSETTINGSVC;
SetValue(hwndDlg, IDC_WEBPAGE, hContact, szProto, "Homepage", SVS_ZEROISUNSPEC);
//past
@@ -570,7 +570,7 @@ int DetailsInit(WPARAM wParam, LPARAM lParam) odp.cbSize = sizeof(odp);
odp.hIcon = NULL;
- odp.hInstance = hMirandaInst;
+ odp.hInstance = hInst;
odp.flags = 0;
odp.pfnDlgProc = SummaryDlgProc;
diff --git a/src/modules/userinfo/userinfo.cpp b/src/modules/userinfo/userinfo.cpp index 599902f9ad..c636534b19 100644 --- a/src/modules/userinfo/userinfo.cpp +++ b/src/modules/userinfo/userinfo.cpp @@ -100,7 +100,7 @@ static INT_PTR ShowDetailsDialogCommand(WPARAM wParam, LPARAM) psh.pszCaption = (TCHAR*)wParam; //more abuses of structure: this is hContact
psh.ppsp = (PROPSHEETPAGE*)opi.odp; //blatent misuse of the structure, but what the hell
- CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_DETAILS), NULL, DlgProcDetails, (LPARAM)&psh);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DETAILS), NULL, DlgProcDetails, (LPARAM)&psh);
for (i=0;i<opi.pageCount;i++) {
//cleanup moved to WM_DESTROY
//mir_free((char*)opi.odp[i].pszTitle);
@@ -397,7 +397,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dat->hContact != NULL) {
szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0);
if (szProto == NULL) {EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); break;}
- if (CallProtoService(szProto, PS_GETSTATUS, 0, 0)<ID_STATUS_ONLINE) EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE);
+ if (CallProtoServiceInt(NULL,szProto, PS_GETSTATUS, 0, 0)<ID_STATUS_ONLINE) EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE);
else EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), !IsWindowVisible(GetDlgItem(hwndDlg, IDC_UPDATING)));
}
break;
diff --git a/src/modules/utils/bmpfilter.cpp b/src/modules/utils/bmpfilter.cpp index 2e656dbf63..46db86baaf 100644 --- a/src/modules/utils/bmpfilter.cpp +++ b/src/modules/utils/bmpfilter.cpp @@ -36,7 +36,7 @@ static INT_PTR sttBitmapLoader(const TCHAR* ptszFileName) short picType;
TCHAR szFilename[MAX_PATH];
- if ( !pathToAbsoluteT(ptszFileName, szFilename, NULL))
+ if ( !PathToAbsoluteT(ptszFileName, szFilename, NULL))
mir_sntprintf(szFilename, SIZEOF(szFilename), _T("%s"), ptszFileName);
int filenameLen = lstrlen(szFilename);
@@ -48,7 +48,7 @@ static INT_PTR sttBitmapLoader(const TCHAR* ptszFileName) if ( !lstrcmpi(pszExt, _T(".bmp")) || !lstrcmpi(pszExt, _T(".rle"))) {
//LoadImage can do this much faster
- return (INT_PTR)LoadImage(hMirandaInst, szFilename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
+ return (INT_PTR)LoadImage(hInst, szFilename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
}
if ( !lstrcmpi(pszExt, _T(".png"))) {
diff --git a/src/modules/utils/colourpicker.cpp b/src/modules/utils/colourpicker.cpp index 731f61f1e1..dd31bf7155 100644 --- a/src/modules/utils/colourpicker.cpp +++ b/src/modules/utils/colourpicker.cpp @@ -47,7 +47,7 @@ static LRESULT CALLBACK ColourPickerWndProc(HWND hwnd, UINT message, WPARAM wPar custColours[0]=GetWindowLongPtr(hwnd, sizeof(COLORREF));
cc.lStructSize=sizeof(CHOOSECOLOR);
cc.hwndOwner=hwnd;
- cc.hInstance=(HWND)hMirandaInst;
+ cc.hInstance=(HWND)hInst;
cc.rgbResult=GetWindowLongPtr(hwnd, 0);
cc.lpCustColors=custColours;
cc.Flags=CC_ANYCOLOR|CC_FULLOPEN|CC_RGBINIT;
@@ -95,7 +95,7 @@ int InitColourPicker(void) wcl.lpfnWndProc=ColourPickerWndProc;
wcl.cbClsExtra=0;
wcl.cbWndExtra=sizeof(COLORREF)*2;
- wcl.hInstance=hMirandaInst;
+ wcl.hInstance=hInst;
wcl.hCursor=NULL;
wcl.lpszClassName=WNDCLASS_COLOURPICKER;
wcl.hbrBackground=(HBRUSH)(COLOR_BTNFACE+1);
diff --git a/src/modules/utils/hyperlink.cpp b/src/modules/utils/hyperlink.cpp index 2705347f36..ae372a9017 100644 --- a/src/modules/utils/hyperlink.cpp +++ b/src/modules/utils/hyperlink.cpp @@ -261,7 +261,7 @@ int InitHyperlink(void) wcl.lpfnWndProc=HyperlinkWndProc;
wcl.cbClsExtra=0;
wcl.cbWndExtra=sizeof(struct HyperlinkWndData*);
- wcl.hInstance=hMirandaInst;
+ wcl.hInstance=hInst;
if (IsWinVer2000Plus()) wcl.hCursor=NULL;
else wcl.hCursor=LoadCursor(wcl.hInstance, MAKEINTRESOURCE(IDC_HYPERLINKHAND));
wcl.lpszClassName=WNDCLASS_HYPERLINK;
diff --git a/src/modules/utils/path.cpp b/src/modules/utils/path.cpp index b31267ad2a..bf875f9d74 100644 --- a/src/modules/utils/path.cpp +++ b/src/modules/utils/path.cpp @@ -26,99 +26,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern TCHAR g_profileDir[MAX_PATH];
-static char szMirandaPath[MAX_PATH];
-static char szMirandaPathLower[MAX_PATH];
-
static INT_PTR replaceVars(WPARAM wParam, LPARAM lParam);
-static int pathIsAbsolute(const char *path)
-{
- if (strlen(path) <= 2)
- return 0;
- if ((path[1] == ':' && path[2] == '\\') || (path[0] == '\\' && path[1] == '\\'))
- return 1;
- return 0;
-}
-
static INT_PTR pathToRelative(WPARAM wParam, LPARAM lParam)
{
- char *pSrc = (char*)wParam;
- char *pOut = (char*)lParam;
- if ( !pSrc || !strlen(pSrc) || strlen(pSrc)>MAX_PATH) return 0;
- if ( !pathIsAbsolute(pSrc)) {
- mir_snprintf(pOut, MAX_PATH, "%s", pSrc);
- return strlen(pOut);
- }
- else {
- char szTmp[MAX_PATH];
-
- mir_snprintf(szTmp, SIZEOF(szTmp), "%s", pSrc);
- _strlwr(szTmp);
- if (strstr(szTmp, szMirandaPathLower)) {
- mir_snprintf(pOut, MAX_PATH, "%s", pSrc+strlen(szMirandaPathLower));
- return strlen(pOut);
- }
- else {
- mir_snprintf(pOut, MAX_PATH, "%s", pSrc);
- return strlen(pOut);
- }
- }
-}
-
-int pathToAbsolute(const char *pSrc, char *pOut, char* base)
-{
- if ( !pSrc || !strlen(pSrc) || strlen(pSrc) > MAX_PATH)
- return 0;
-
- if (base == NULL)
- base = szMirandaPath;
-
- char buf[MAX_PATH];
- if (pSrc[0] < ' ')
- return mir_snprintf(pOut, MAX_PATH, "%s", pSrc);
- else if (pathIsAbsolute(pSrc))
- return GetFullPathNameA(pSrc, MAX_PATH, pOut, NULL);
- else if (pSrc[0] != '\\')
- mir_snprintf(buf, MAX_PATH, "%s%s", base, pSrc);
- else
- mir_snprintf(buf, MAX_PATH, "%s%s", base, pSrc+1);
-
- return GetFullPathNameA(buf, MAX_PATH, pOut, NULL);
+ return PathToRelative((char*)wParam, (char*)lParam);
}
static INT_PTR pathToAbsolute(WPARAM wParam, LPARAM lParam)
{
- return pathToAbsolute((char*)wParam, (char*)lParam, szMirandaPath);
-}
-
-void CreatePathToFile(char* szFilePath)
-{
- char* pszLastBackslash = strrchr(szFilePath, '\\');
- if (pszLastBackslash == NULL)
- return;
-
- *pszLastBackslash = '\0';
- CreateDirectoryTree(szFilePath);
- *pszLastBackslash = '\\';
-}
-
-int CreateDirectoryTree(const char *szDir)
-{
- DWORD dwAttributes;
- char *pszLastBackslash, szTestDir[ MAX_PATH ];
-
- lstrcpynA(szTestDir, szDir, SIZEOF(szTestDir));
- if ((dwAttributes = GetFileAttributesA(szTestDir)) != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
- return 0;
-
- pszLastBackslash = strrchr(szTestDir, '\\');
- if (pszLastBackslash == NULL)
- return 0;
-
- *pszLastBackslash = '\0';
- CreateDirectoryTree(szTestDir);
- *pszLastBackslash = '\\';
- return (CreateDirectoryA(szTestDir, NULL) == 0) ? GetLastError() : 0;
+ return PathToAbsolute((char*)wParam, (char*)lParam, NULL);
}
static INT_PTR createDirTree(WPARAM, LPARAM lParam)
@@ -129,94 +46,14 @@ static INT_PTR createDirTree(WPARAM, LPARAM lParam) return CreateDirectoryTree((char*)lParam);
}
-static TCHAR szMirandaPathW[MAX_PATH];
-static TCHAR szMirandaPathWLower[MAX_PATH];
-
-static int pathIsAbsoluteW(const TCHAR *path)
-{
- if (lstrlen(path) <= 2)
- return 0;
- if ((path[1] == ':' && path[2] == '\\') || (path[0] == '\\' && path[1] == '\\'))
- return 1;
- return 0;
-}
-
static INT_PTR pathToRelativeW(WPARAM wParam, LPARAM lParam)
{
- TCHAR *pSrc = (TCHAR*)wParam;
- TCHAR *pOut = (TCHAR*)lParam;
- if ( !pSrc || !lstrlen(pSrc) || lstrlen(pSrc) > MAX_PATH)
- return 0;
-
- if ( !pathIsAbsoluteW(pSrc))
- mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc);
- else {
- TCHAR szTmp[MAX_PATH];
-
- mir_sntprintf(szTmp, SIZEOF(szTmp), _T("%s"), pSrc);
- _tcslwr(szTmp);
- if (_tcsstr(szTmp, szMirandaPathWLower))
- mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc+lstrlen(szMirandaPathWLower));
- else
- mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc);
- }
- return lstrlen(pOut);
-}
-
-int pathToAbsoluteW(const TCHAR *pSrc, TCHAR *pOut, TCHAR* base)
-{
- if ( !pSrc || !wcslen(pSrc) || wcslen(pSrc) > MAX_PATH)
- return 0;
-
- if (base == NULL)
- base = szMirandaPathW;
-
- TCHAR buf[MAX_PATH];
- if (pSrc[0] < ' ')
- return mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc);
- else if (pathIsAbsoluteW(pSrc))
- return GetFullPathName(pSrc, MAX_PATH, pOut, NULL);
- else if (pSrc[0] != '\\')
- mir_sntprintf(buf, MAX_PATH, _T("%s%s"), base, pSrc);
- else
- mir_sntprintf(buf, MAX_PATH, _T("%s%s"), base, pSrc+1);
-
- return GetFullPathName(buf, MAX_PATH, pOut, NULL);
+ return PathToRelativeW((WCHAR*)wParam, (WCHAR*)lParam );
}
static INT_PTR pathToAbsoluteW(WPARAM wParam, LPARAM lParam)
{
- return pathToAbsoluteW((TCHAR*)wParam, (TCHAR*)lParam, szMirandaPathW);
-}
-
-void CreatePathToFileW(WCHAR* wszFilePath)
-{
- WCHAR* pszLastBackslash = wcsrchr(wszFilePath, '\\');
- if (pszLastBackslash == NULL)
- return;
-
- *pszLastBackslash = '\0';
- CreateDirectoryTreeW(wszFilePath);
- *pszLastBackslash = '\\';
-}
-
-int CreateDirectoryTreeW(const WCHAR* szDir)
-{
- DWORD dwAttributes;
- WCHAR* pszLastBackslash, szTestDir[ MAX_PATH ];
-
- lstrcpynW(szTestDir, szDir, SIZEOF(szTestDir));
- if ((dwAttributes = GetFileAttributesW(szTestDir)) != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
- return 0;
-
- pszLastBackslash = wcsrchr(szTestDir, '\\');
- if (pszLastBackslash == NULL)
- return 0;
-
- *pszLastBackslash = '\0';
- CreateDirectoryTreeW(szTestDir);
- *pszLastBackslash = '\\';
- return (CreateDirectoryW(szTestDir, NULL) == 0) ? GetLastError() : 0;
+ return PathToAbsoluteW((WCHAR*)wParam, (WCHAR*)lParam, NULL);
}
static INT_PTR createDirTreeW(WPARAM, LPARAM lParam)
@@ -227,20 +64,6 @@ static INT_PTR createDirTreeW(WPARAM, LPARAM lParam) return CreateDirectoryTreeW((WCHAR*)lParam);
}
-int InitPathUtilsW(void)
-{
- GetModuleFileName(hMirandaInst, szMirandaPathW, SIZEOF(szMirandaPathW));
- TCHAR *p = _tcsrchr(szMirandaPathW, '\\');
- if (p)
- p[1] = 0;
- mir_sntprintf(szMirandaPathWLower, SIZEOF(szMirandaPathWLower), _T("%s"), szMirandaPathW);
- _tcslwr(szMirandaPathWLower);
- CreateServiceFunction(MS_UTILS_PATHTORELATIVEW, pathToRelativeW);
- CreateServiceFunction(MS_UTILS_PATHTOABSOLUTEW, pathToAbsoluteW);
- CreateServiceFunction(MS_UTILS_CREATEDIRTREEW, createDirTreeW);
- return 0;
-}
-
TCHAR *GetContactID(HANDLE hContact)
{
TCHAR *theValue = {0};
@@ -251,7 +74,7 @@ TCHAR *GetContactID(HANDLE hContact) theValue = (TCHAR *)mir_tstrdup(dbv.ptszVal);
DBFreeVariant(&dbv);
return theValue;
- } }
+ } }
else {
CONTACTINFO ci = {0};
ci.cbSize = sizeof(ci);
@@ -266,7 +89,7 @@ TCHAR *GetContactID(HANDLE hContact) case CNFT_DWORD:
return _itot(ci.dVal, (TCHAR *)mir_alloc(sizeof(TCHAR)*32), 10);
break;
- } } }
+ } } }
return NULL;
}
@@ -574,17 +397,15 @@ static INT_PTR replaceVars(WPARAM wParam, LPARAM lParam) int InitPathUtils(void)
{
- char *p = 0;
- GetModuleFileNameA(hMirandaInst, szMirandaPath, SIZEOF(szMirandaPath));
- p = strrchr(szMirandaPath, '\\');
- if (p)
- p[1] = 0;
- mir_snprintf(szMirandaPathLower, MAX_PATH, "%s", szMirandaPath);
- _strlwr(szMirandaPathLower);
CreateServiceFunction(MS_UTILS_PATHTORELATIVE, pathToRelative);
+ CreateServiceFunction(MS_UTILS_PATHTORELATIVEW, pathToRelativeW);
+
CreateServiceFunction(MS_UTILS_PATHTOABSOLUTE, pathToAbsolute);
+ CreateServiceFunction(MS_UTILS_PATHTOABSOLUTEW, pathToAbsoluteW);
+
CreateServiceFunction(MS_UTILS_CREATEDIRTREE, createDirTree);
- CreateServiceFunction(MS_UTILS_REPLACEVARS, replaceVars);
+ CreateServiceFunction(MS_UTILS_CREATEDIRTREEW, createDirTreeW);
- return InitPathUtilsW();
+ CreateServiceFunction(MS_UTILS_REPLACEVARS, replaceVars);
+ return 0;
}
diff --git a/src/modules/utils/timezones.cpp b/src/modules/utils/timezones.cpp index 05e83afa51..d90a303e49 100644 --- a/src/modules/utils/timezones.cpp +++ b/src/modules/utils/timezones.cpp @@ -169,7 +169,7 @@ static HANDLE timeapiGetInfoByName(LPCTSTR tszName, DWORD dwFlags) return (dwFlags & TZF_DIFONLY) ? NULL : &myInfo.myTZ;
MIM_TIMEZONE tzsearch;
- tzsearch.hash = hashstr(tszName);
+ tzsearch.hash = mir_hashstrT(tszName);
MIM_TIMEZONE *tz = g_timezones.find(&tzsearch);
if (tz == NULL)
@@ -381,7 +381,7 @@ static int timeapiSelectListItem(HANDLE hContact, HWND hWnd, DWORD dwFlags) DBVARIANT dbv;
if ( !DBGetContactSettingTString(hContact, "UserInfo", "TzName", &dbv))
{
- unsigned hash = hashstr(dbv.ptszVal);
+ unsigned hash = mir_hashstrT(dbv.ptszVal);
for (int i = 0; i < g_timezonesBias.getCount(); ++i)
{
if (hash == g_timezonesBias[i]->hash)
@@ -607,7 +607,7 @@ void InitTimeZones(void) tz->tzi.DaylightBias = tzi.DaylightBias;
_tcscpy(tz->tszName, tszName);
- tz->hash = hashstr(tszName);
+ tz->hash = mir_hashstrT(tszName);
tz->offset = INT_MIN;
GetLocalizedString(hSubKey, _T("Display"), tz->szDisplay, SIZEOF(tz->szDisplay));
diff --git a/src/modules/utils/utils.cpp b/src/modules/utils/utils.cpp index c9c1e3a65e..964e9a920f 100644 --- a/src/modules/utils/utils.cpp +++ b/src/modules/utils/utils.cpp @@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. INT_PTR ResizeDialog(WPARAM wParam, LPARAM lParam);
int InitOpenUrl(void);
int InitWindowList(void);
+int InitPathUtils(void);
void FreeWindowList(void);
int InitHyperlink(void);
int InitColourPicker(void);
@@ -461,98 +462,6 @@ static INT_PTR GenerateRandom(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
-char* __fastcall rtrim(char* str)
-{
- if (str == NULL) return NULL;
- char* p = strchr(str, 0);
- while (--p >= str)
- {
- switch (*p)
- {
- case ' ': case '\t': case '\n': case '\r':
- *p = 0; break;
- default:
- return str;
- }
- }
- return str;
-}
-
-TCHAR* __fastcall rtrim(TCHAR *str)
-{
- if (str == NULL) return NULL;
- TCHAR* p = _tcschr(str, 0);
- while (--p >= str)
- {
- switch (*p)
- {
- case ' ': case '\t': case '\n': case '\r':
- *p = 0; break;
- default:
- return str;
- }
- }
- return str;
-}
-
-char* __fastcall ltrim(char* str)
-{
- if (str == NULL) return NULL;
- char* p = str;
-
- for (;;)
- {
- switch (*p)
- {
- case ' ': case '\t': case '\n': case '\r':
- ++p; break;
- default:
- memmove(str, p, strlen(p) + 1);
- return str;
- }
- }
-}
-
-char* __fastcall ltrimp(char* str)
-{
- if (str == NULL) return NULL;
- char* p = str;
-
- for (;;)
- {
- switch (*p)
- {
- case ' ': case '\t': case '\n': case '\r':
- ++p; break;
- default:
- return p;
- }
- }
-}
-
-bool __fastcall wildcmp(char * name, char * mask)
-{
- char * last='\0';
- for (;; mask++, name++)
- {
- if (*mask != '?' && *mask != *name) break;
- if (*name == '\0') return ((BOOL)!*mask);
- }
- if (*mask != '*') return FALSE;
- for (;; mask++, name++)
- {
- while (*mask == '*')
- {
- last = mask++;
- if (*mask == '\0') return ((BOOL)!*mask); /* true */
- }
- if (*name == '\0') return ((BOOL)!*mask); /* *mask == EOS */
- if (*mask != '?' && *mask != *name) name -= (size_t)(mask - last) - 1, mask = last;
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
int LoadUtilsModule(void)
{
bModuleInitialized = TRUE;
@@ -570,6 +479,7 @@ int LoadUtilsModule(void) InitOpenUrl();
InitWindowList();
InitHyperlink();
+ InitPathUtils();
InitColourPicker();
InitBitmapFilter();
InitXmlApi();
diff --git a/src/modules/visibility/visibility.cpp b/src/modules/visibility/visibility.cpp index 9575830f63..b7e67a2cd4 100644 --- a/src/modules/visibility/visibility.cpp +++ b/src/modules/visibility/visibility.cpp @@ -111,7 +111,7 @@ static void SetAllContactIcons(HWND hwndList) szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if (szProto == NULL) {flags=0; status=0;}
else {
- flags=CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
+ flags=CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_1, 0);
status=DBGetContactSettingWord(hContact, szProto, "ApparentMode", 0);
}
if (flags&PF1_INVISLIST) {
@@ -280,7 +280,7 @@ static int VisibilityOptInitialise(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 };
odp.cbSize = sizeof(odp);
odp.position = 850000000;
- odp.hInstance = hMirandaInst;
+ odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_VISIBILITY);
odp.pszTitle = LPGEN("Visibility");
odp.pszGroup = LPGEN("Status");
|