From 53ff4acbf341b20b772bdd87d06fed30e0d1b28a Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Tue, 14 Jan 2014 17:25:20 +0000 Subject: minor cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@7647 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Variables/Variables_10.vcxproj | 4 +- plugins/Variables/Variables_10.vcxproj.filters | 8 +- plugins/Variables/src/contact.cpp | 90 ++++++++++---------- plugins/Variables/src/contact.h | 88 +++++++++---------- plugins/Variables/src/enumprocs.cpp | 10 +-- plugins/Variables/src/help.cpp | 64 ++++++-------- plugins/Variables/src/main.cpp | 4 +- plugins/Variables/src/options.cpp | 4 +- plugins/Variables/src/parse_alias.cpp | 5 +- plugins/Variables/src/parse_alias.h | 2 +- plugins/Variables/src/parse_external.cpp | 8 +- plugins/Variables/src/parse_external.h | 4 +- plugins/Variables/src/parse_inet.cpp | 11 ++- plugins/Variables/src/parse_inet.h | 8 +- plugins/Variables/src/parse_logic.cpp | 40 ++++----- plugins/Variables/src/parse_logic.h | 32 +++---- plugins/Variables/src/parse_math.cpp | 26 +++--- plugins/Variables/src/parse_math.h | 22 ++--- plugins/Variables/src/parse_metacontacts.cpp | 10 +-- plugins/Variables/src/parse_metacontacts.h | 6 +- plugins/Variables/src/parse_miranda.cpp | 113 ++++++++++++------------- plugins/Variables/src/parse_miranda.h | 52 ++++++------ plugins/Variables/src/parse_regexp.cpp | 7 +- plugins/Variables/src/parse_regexp.h | 4 +- plugins/Variables/src/parse_str.cpp | 81 +++++++++--------- plugins/Variables/src/parse_str.h | 74 ++++++++-------- plugins/Variables/src/parse_system.cpp | 45 +++++----- plugins/Variables/src/parse_system.h | 40 ++++----- plugins/Variables/src/parse_variables.cpp | 9 +- plugins/Variables/src/parse_variables.h | 6 +- plugins/Variables/src/variables.h | 56 ++++++++---- 31 files changed, 461 insertions(+), 472 deletions(-) (limited to 'plugins/Variables') diff --git a/plugins/Variables/Variables_10.vcxproj b/plugins/Variables/Variables_10.vcxproj index f773fb6b17..5b971455b6 100644 --- a/plugins/Variables/Variables_10.vcxproj +++ b/plugins/Variables/Variables_10.vcxproj @@ -224,13 +224,15 @@ - + + + diff --git a/plugins/Variables/Variables_10.vcxproj.filters b/plugins/Variables/Variables_10.vcxproj.filters index f3e00ee9ac..16da9e7871 100644 --- a/plugins/Variables/Variables_10.vcxproj.filters +++ b/plugins/Variables/Variables_10.vcxproj.filters @@ -125,9 +125,6 @@ Header Files\Parse - - Header Files\Parse - Header Files @@ -149,4 +146,9 @@ Resource Files + + + Resource Files + + \ No newline at end of file diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp index b4d3a2de8c..2299324552 100644 --- a/plugins/Variables/src/contact.cpp +++ b/plugins/Variables/src/contact.cpp @@ -26,51 +26,51 @@ struct _tagType } static builtinCnfs[] = { - { CNF_FIRSTNAME, _T(STR_FIRSTNAME) }, - { CNF_LASTNAME, _T(STR_LASTNAME) }, - { CNF_NICK, _T(STR_NICK) }, - { CNF_CUSTOMNICK, _T(STR_CUSTOMNICK) }, - { CNF_EMAIL, _T(STR_EMAIL) }, - { CNF_CITY, _T(STR_CITY) }, - { CNF_STATE, _T(STR_STATE) }, - { CNF_COUNTRY, _T(STR_COUNTRY) }, - { CNF_PHONE, _T(STR_PHONE) }, - { CNF_HOMEPAGE, _T(STR_HOMEPAGE) }, - { CNF_ABOUT, _T(STR_ABOUT) }, - { CNF_GENDER, _T(STR_GENDER) }, - { CNF_AGE, _T(STR_AGE) }, - { CNF_FIRSTLAST, _T(STR_FIRSTLAST) }, - { CNF_UNIQUEID, _T(STR_UNIQUEID) }, - { CNF_DISPLAY, _T(STR_DISPLAY) }, - { CNF_FAX, _T(STR_FAX) }, - { CNF_CELLULAR, _T(STR_CELLULAR) }, - { CNF_TIMEZONE, _T(STR_TIMEZONE) }, - { CNF_MYNOTES, _T(STR_MYNOTES) }, - { CNF_BIRTHDAY, _T(STR_BIRTHDAY) }, - { CNF_BIRTHMONTH, _T(STR_BIRTHMONTH) }, - { CNF_BIRTHYEAR, _T(STR_BIRTHYEAR) }, - { CNF_STREET, _T(STR_STREET) }, - { CNF_ZIP, _T(STR_ZIP) }, - { CNF_LANGUAGE1, _T(STR_LANGUAGE1) }, - { CNF_LANGUAGE2, _T(STR_LANGUAGE2) }, - { CNF_LANGUAGE3, _T(STR_LANGUAGE3) }, - { CNF_CONAME, _T(STR_CONAME) }, - { CNF_CODEPT, _T(STR_CODEPT) }, - { CNF_COPOSITION, _T(STR_COPOSITION) }, - { CNF_COSTREET, _T(STR_COSTREET) }, - { CNF_COCITY, _T(STR_COCITY) }, - { CNF_COSTATE, _T(STR_COSTATE) }, - { CNF_COZIP, _T(STR_COZIP) }, - { CNF_COCOUNTRY, _T(STR_COCOUNTRY) }, - { CNF_COHOMEPAGE, _T(STR_COHOMEPAGE) }, - - { CCNF_ACCOUNT, _T(STR_ACCOUNT) }, - { CCNF_PROTOCOL, _T(STR_PROTOCOL) }, - { CCNF_STATUS, _T(STR_STATUS) }, - { CCNF_INTERNALIP, _T(STR_INTERNALIP) }, - { CCNF_EXTERNALIP, _T(STR_EXTERNALIP) }, - { CCNF_GROUP, _T(STR_GROUP) }, - { CCNF_PROTOID, _T(STR_PROTOID) } + { CNF_FIRSTNAME, STR_FIRSTNAME }, + { CNF_LASTNAME, STR_LASTNAME }, + { CNF_NICK, STR_NICK }, + { CNF_CUSTOMNICK, STR_CUSTOMNICK }, + { CNF_EMAIL, STR_EMAIL }, + { CNF_CITY, STR_CITY }, + { CNF_STATE, STR_STATE }, + { CNF_COUNTRY, STR_COUNTRY }, + { CNF_PHONE, STR_PHONE }, + { CNF_HOMEPAGE, STR_HOMEPAGE }, + { CNF_ABOUT, STR_ABOUT }, + { CNF_GENDER, STR_GENDER }, + { CNF_AGE, STR_AGE }, + { CNF_FIRSTLAST, STR_FIRSTLAST }, + { CNF_UNIQUEID, STR_UNIQUEID }, + { CNF_DISPLAY, STR_DISPLAY }, + { CNF_FAX, STR_FAX }, + { CNF_CELLULAR, STR_CELLULAR }, + { CNF_TIMEZONE, STR_TIMEZONE }, + { CNF_MYNOTES, STR_MYNOTES }, + { CNF_BIRTHDAY, STR_BIRTHDAY }, + { CNF_BIRTHMONTH, STR_BIRTHMONTH }, + { CNF_BIRTHYEAR, STR_BIRTHYEAR }, + { CNF_STREET, STR_STREET }, + { CNF_ZIP, STR_ZIP }, + { CNF_LANGUAGE1, STR_LANGUAGE1 }, + { CNF_LANGUAGE2, STR_LANGUAGE2 }, + { CNF_LANGUAGE3, STR_LANGUAGE3 }, + { CNF_CONAME, STR_CONAME }, + { CNF_CODEPT, STR_CODEPT }, + { CNF_COPOSITION, STR_COPOSITION }, + { CNF_COSTREET, STR_COSTREET }, + { CNF_COCITY, STR_COCITY }, + { CNF_COSTATE, STR_COSTATE }, + { CNF_COZIP, STR_COZIP }, + { CNF_COCOUNTRY, STR_COCOUNTRY }, + { CNF_COHOMEPAGE, STR_COHOMEPAGE }, + + { CCNF_ACCOUNT, STR_ACCOUNT }, + { CCNF_PROTOCOL, STR_PROTOCOL }, + { CCNF_STATUS, STR_STATUS }, + { CCNF_INTERNALIP, STR_INTERNALIP }, + { CCNF_EXTERNALIP, STR_EXTERNALIP }, + { CCNF_GROUP, STR_GROUP }, + { CCNF_PROTOID, STR_PROTOID } }; typedef struct { diff --git a/plugins/Variables/src/contact.h b/plugins/Variables/src/contact.h index 3c203baba4..5e5eae2e69 100644 --- a/plugins/Variables/src/contact.h +++ b/plugins/Variables/src/contact.h @@ -17,52 +17,52 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define STR_FIRSTNAME "first" -#define STR_LASTNAME "last" -#define STR_NICK "nick" -#define STR_CUSTOMNICK "cnick" -#define STR_EMAIL "email" -#define STR_CITY "city" -#define STR_STATE "state" -#define STR_COUNTRY "country" -#define STR_PHONE "phone" -#define STR_HOMEPAGE "homepage" -#define STR_ABOUT "about" -#define STR_GENDER "gender" -#define STR_AGE "age" -#define STR_FIRSTLAST "firstlast" -#define STR_UNIQUEID "id" -#define STR_DISPLAY "display" +#define STR_FIRSTNAME _T("first") +#define STR_LASTNAME _T("last") +#define STR_NICK _T("nick") +#define STR_CUSTOMNICK _T("cnick") +#define STR_EMAIL _T("email") +#define STR_CITY _T("city") +#define STR_STATE _T("state") +#define STR_COUNTRY _T("country") +#define STR_PHONE _T("phone") +#define STR_HOMEPAGE _T("homepage") +#define STR_ABOUT _T("about") +#define STR_GENDER _T("gender") +#define STR_AGE _T("age") +#define STR_FIRSTLAST _T("firstlast") +#define STR_UNIQUEID _T("id") +#define STR_DISPLAY _T("display") -#define STR_FAX "fax" -#define STR_CELLULAR "cellular" -#define STR_TIMEZONE "timezone" -#define STR_MYNOTES "mynotes" -#define STR_BIRTHDAY "bday" -#define STR_BIRTHMONTH "bmonth" -#define STR_BIRTHYEAR "byear" -#define STR_STREET "street" -#define STR_ZIP "zip" -#define STR_LANGUAGE1 "lang1" -#define STR_LANGUAGE2 "lang2" -#define STR_LANGUAGE3 "lang3" -#define STR_CONAME "coname" -#define STR_CODEPT "codept" -#define STR_COPOSITION "copos" -#define STR_COSTREET "costreet" -#define STR_COCITY "cocity" -#define STR_COSTATE "costate" -#define STR_COZIP "cozip" -#define STR_COCOUNTRY "cocountry" -#define STR_COHOMEPAGE "cohomepage" +#define STR_FAX _T("fax") +#define STR_CELLULAR _T("cellular") +#define STR_TIMEZONE _T("timezone") +#define STR_MYNOTES _T("mynotes") +#define STR_BIRTHDAY _T("bday") +#define STR_BIRTHMONTH _T("bmonth") +#define STR_BIRTHYEAR _T("byear") +#define STR_STREET _T("street") +#define STR_ZIP _T("zip") +#define STR_LANGUAGE1 _T("lang1") +#define STR_LANGUAGE2 _T("lang2") +#define STR_LANGUAGE3 _T("lang3") +#define STR_CONAME _T("coname") +#define STR_CODEPT _T("codept") +#define STR_COPOSITION _T("copos") +#define STR_COSTREET _T("costreet") +#define STR_COCITY _T("cocity") +#define STR_COSTATE _T("costate") +#define STR_COZIP _T("cozip") +#define STR_COCOUNTRY _T("cocountry") +#define STR_COHOMEPAGE _T("cohomepage") -#define STR_ACCOUNT "account" -#define STR_PROTOCOL "protocol" -#define STR_STATUS "status" -#define STR_INTERNALIP "intip" -#define STR_EXTERNALIP "extip" -#define STR_GROUP "group" -#define STR_PROTOID "protoid" +#define STR_ACCOUNT _T("account") +#define STR_PROTOCOL _T("protocol") +#define STR_STATUS _T("status") +#define STR_INTERNALIP _T("intip") +#define STR_EXTERNALIP _T("extip") +#define STR_GROUP _T("group") +#define STR_PROTOID _T("protoid") #define CCNF_ACCOUNT 51 // CUSTOM, returns contact's account name (0.8.0+) #define CCNF_PROTOCOL 50 // CUSTOM, returns the contact's protocol (human-readable) diff --git a/plugins/Variables/src/enumprocs.cpp b/plugins/Variables/src/enumprocs.cpp index 7ae68ed978..e35accfd0e 100644 --- a/plugins/Variables/src/enumprocs.cpp +++ b/plugins/Variables/src/enumprocs.cpp @@ -44,26 +44,24 @@ typedef struct { BOOL WINAPI EnumProcs(PROCENUMPROC lpProc, LPARAM lParam) { - OSVERSIONINFO osver; - HANDLE hSnapShot = NULL; LPDWORD lpdwPIDs = NULL; - PROCESSENTRY32 procentry; - BOOL bFlag; // Retrieve the OS version + OSVERSIONINFO osver; osver.dwOSVersionInfoSize = sizeof(osver); if (!GetVersionEx(&osver)) return FALSE; if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS || (osver.dwPlatformId == VER_PLATFORM_WIN32_NT && osver.dwMajorVersion > 4)) { // Get a handle to a Toolhelp snapshot of all processes. - hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (hSnapShot == INVALID_HANDLE_VALUE) return FALSE; // Get the first process' information. + PROCESSENTRY32 procentry; procentry.dwSize = sizeof(PROCESSENTRY32); - bFlag = Process32First(hSnapShot, &procentry); + BOOL bFlag = Process32First(hSnapShot, &procentry); // While there are processes, keep looping. while (bFlag) { diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp index b2ec3dae58..07f0ca8683 100644 --- a/plugins/Variables/src/help.cpp +++ b/plugins/Variables/src/help.cpp @@ -99,9 +99,6 @@ static INT_PTR CALLBACK extratextDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPA // dialog box for the %subject% selection void ResetCList(HWND hwndDlg) { - - int i; - if ((CallService(MS_CLUI_GETCAPS, 0, 0) & CLUIF_DISABLEGROUPS && !db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT)) || !(GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CLIST), GWL_STYLE)&CLS_USEGROUPS)) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, (WPARAM) FALSE, 0); else @@ -112,7 +109,7 @@ void ResetCList(HWND hwndDlg) { SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETBKBITMAP, 0, (LPARAM) (HBITMAP) NULL); SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETBKCOLOR, GetSysColor(COLOR_WINDOW), 0); SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETINDENT, 10, 0); - for (i = 0; i <= FONTID_MAX; i++) + for (int i = 0; i <= FONTID_MAX; i++) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETTEXTCOLOR, i, GetSysColor(COLOR_WINDOWTEXT)); } @@ -243,33 +240,28 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM // dialog box for the tokens static TCHAR *getTokenCategory(TOKENREGISTEREX *tr) { - - TCHAR *res; - - char *cat, *cur, *helpText; - if (tr == NULL) { return NULL; } - cat = NULL; - helpText = mir_strdup(tr->szHelpText); + char *cat = NULL; + char *helpText = mir_strdup(tr->szHelpText); if (helpText == NULL) { return NULL; } - cur = helpText; + char *cur = helpText; while (*cur != 0) { if (*cur == '\t') { *cur = 0; helpText = ( char* )mir_realloc(helpText, strlen(helpText)+1); - res = mir_a2t(helpText); + TCHAR *res = mir_a2t(helpText); mir_free(helpText); return res; } cur++; } - res = mir_a2t(helpText); + TCHAR *res = mir_a2t(helpText); mir_free(helpText); return res; @@ -402,14 +394,14 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM wPar continue; else if (hdd != NULL) { - if (!_tcscmp(tr->tszTokenString, _T(SUBJECT))) { + if (!_tcscmp(tr->tszTokenString, SUBJECT)) { if (hdd->vhs->flags&VHF_HIDESUBJECTTOKEN) continue; if (hdd->vhs->szSubjectDesc != NULL) tszHelpDesc = mir_a2t(hdd->vhs->szSubjectDesc); } - if (!_tcscmp(tr->tszTokenString, _T(MIR_EXTRATEXT))) { + if (!_tcscmp(tr->tszTokenString, MIR_EXTRATEXT)) { if (hdd->vhs->flags & VHF_HIDEEXTRATEXTTOKEN) continue; @@ -663,22 +655,22 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM case DM_SPLITTERMOVED: { - POINT pt; - RECT rc, rcTeststring, rcResult; - int oldSplitterY; - - if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTER)) { - GetClientRect(hwndDlg, &rc); - pt.x = 0; - pt.y = wParam; - ScreenToClient(hwndDlg, &pt); - oldSplitterY = dat->splitterPos; - dat->splitterPos = rc.bottom - pt.y + 223; - GetWindowRect(GetDlgItem(hwndDlg, IDC_TESTSTRING), &rcTeststring); - GetWindowRect(GetDlgItem(hwndDlg, IDC_RESULT), &rcResult); - if ((((rcTeststring.bottom - rcTeststring.top) - (dat->splitterPos - oldSplitterY)) < dat->minInputSize.y) || (((rcResult.bottom - rcResult.top) + (dat->splitterPos - oldSplitterY)) < dat->minResultSize.y)) - dat->splitterPos = oldSplitterY; - } } + POINT pt; + RECT rc, rcTeststring, rcResult; + int oldSplitterY; + + if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTER)) { + GetClientRect(hwndDlg, &rc); + pt.x = 0; + pt.y = wParam; + ScreenToClient(hwndDlg, &pt); + oldSplitterY = dat->splitterPos; + dat->splitterPos = rc.bottom - pt.y + 223; + GetWindowRect(GetDlgItem(hwndDlg, IDC_TESTSTRING), &rcTeststring); + GetWindowRect(GetDlgItem(hwndDlg, IDC_RESULT), &rcResult); + if ((((rcTeststring.bottom - rcTeststring.top) - (dat->splitterPos - oldSplitterY)) < dat->minInputSize.y) || (((rcResult.bottom - rcResult.top) + (dat->splitterPos - oldSplitterY)) < dat->minResultSize.y)) + dat->splitterPos = oldSplitterY; + } } SendMessage(hwndDlg, WM_SIZE, 0, 0); break; @@ -694,10 +686,10 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM case WM_GETMINMAXINFO: { - RECT rc, rcTeststring; - GetWindowRect(GetParent(hwndDlg), &rc); - GetWindowRect(GetDlgItem(hwndDlg, IDC_TESTSTRING), &rcTeststring); - ((MINMAXINFO*)lParam)->ptMinTrackSize.y = (rc.bottom - rc.top) - (((rcTeststring.bottom - rcTeststring.top) - dat->minResultSize.y)); + RECT rc, rcTeststring; + GetWindowRect(GetParent(hwndDlg), &rc); + GetWindowRect(GetDlgItem(hwndDlg, IDC_TESTSTRING), &rcTeststring); + ((MINMAXINFO*)lParam)->ptMinTrackSize.y = (rc.bottom - rc.top) - (((rcTeststring.bottom - rcTeststring.top) - dat->minResultSize.y)); } break; diff --git a/plugins/Variables/src/main.cpp b/plugins/Variables/src/main.cpp index 1df2b3ac41..2480565a8c 100644 --- a/plugins/Variables/src/main.cpp +++ b/plugins/Variables/src/main.cpp @@ -20,7 +20,6 @@ HINSTANCE hInst; -DWORD g_mirandaVersion; int hLangpack = 0; BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) @@ -46,9 +45,8 @@ PLUGININFOEX pluginInfoEx = { {0x59b0036e, 0x5403, 0x422e, {0x88, 0x3b, 0xc9, 0xaa, 0xf4, 0x25, 0x68, 0x2b}} }; -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { - g_mirandaVersion = mirandaVersion; return &pluginInfoEx; } diff --git a/plugins/Variables/src/options.cpp b/plugins/Variables/src/options.cpp index cca948aa3c..d55ea340ed 100644 --- a/plugins/Variables/src/options.cpp +++ b/plugins/Variables/src/options.cpp @@ -107,7 +107,7 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA if (string != NULL) { TCHAR *newString = variables_parsedup(string, NULL, NULL); if (newString != NULL) { - SetWindowText(GetDlgItem(hwndDlg, IDC_RESULT), newString); + SetDlgItemText(hwndDlg, IDC_RESULT, newString); mir_free(newString); } mir_free(string); @@ -127,7 +127,7 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA return FALSE; } -int OptionsInit(WPARAM wParam, LPARAM lParam) +int OptionsInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 150000000; diff --git a/plugins/Variables/src/parse_alias.cpp b/plugins/Variables/src/parse_alias.cpp index 848a91b3d0..01440e862e 100644 --- a/plugins/Variables/src/parse_alias.cpp +++ b/plugins/Variables/src/parse_alias.cpp @@ -186,11 +186,10 @@ static TCHAR *parseAddAlias(ARGUMENTSINFO *ai) return (res == 0) ? mir_tstrdup(_T("")) : NULL; } -int registerAliasTokens() +void registerAliasTokens() { - registerIntToken(_T(ADDALIAS), parseAddAlias, TRF_FUNCTION | TRF_UNPARSEDARGS, LPGEN("Variables")"\t(x,y)\t"LPGEN("stores y as alias named x"));//TRF_UNPARSEDARGS); + registerIntToken(ADDALIAS, parseAddAlias, TRF_FUNCTION | TRF_UNPARSEDARGS, LPGEN("Variables")"\t(x,y)\t"LPGEN("stores y as alias named x"));//TRF_UNPARSEDARGS); InitializeCriticalSection(&csAliasRegister); - return 0; } void unregisterAliasTokens() diff --git a/plugins/Variables/src/parse_alias.h b/plugins/Variables/src/parse_alias.h index 14ad03ac88..0ac0c09779 100644 --- a/plugins/Variables/src/parse_alias.h +++ b/plugins/Variables/src/parse_alias.h @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define ADDALIAS "alias" +#define ADDALIAS _T("alias") int isValidTokenChar(TCHAR tc); TCHAR *getArguments(TCHAR *string, TCHAR ***aargv, int *aargc); diff --git a/plugins/Variables/src/parse_external.cpp b/plugins/Variables/src/parse_external.cpp index 8ad844b0e7..dbdf91eb6c 100644 --- a/plugins/Variables/src/parse_external.cpp +++ b/plugins/Variables/src/parse_external.cpp @@ -102,10 +102,8 @@ static TCHAR *parseWinampState(ARGUMENTSINFO *ai) return mir_tstrdup(_T("Playing")); } -int registerExternalTokens() +void registerExternalTokens() { - registerIntToken(_T(WINAMPSONG), parseWinampSong, TRF_FIELD, LPGEN("External Applications")"\t"LPGEN("retrieves song name of the song currently playing in Winamp")); - registerIntToken(_T(WINAMPSTATE), parseWinampState, TRF_FIELD, LPGEN("External Applications")"\t"LPGEN("retrieves current Winamp state (Playing/Paused/Stopped)")); - - return 0; + registerIntToken(WINAMPSONG, parseWinampSong, TRF_FIELD, LPGEN("External Applications")"\t"LPGEN("retrieves song name of the song currently playing in Winamp")); + registerIntToken(WINAMPSTATE, parseWinampState, TRF_FIELD, LPGEN("External Applications")"\t"LPGEN("retrieves current Winamp state (Playing/Paused/Stopped)")); } \ No newline at end of file diff --git a/plugins/Variables/src/parse_external.h b/plugins/Variables/src/parse_external.h index d881cf04b8..53b8673555 100644 --- a/plugins/Variables/src/parse_external.h +++ b/plugins/Variables/src/parse_external.h @@ -17,6 +17,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define WINAMPSONG "winampsong" -#define WINAMPSTATE "winampstate" +#define WINAMPSONG _T("winampsong") +#define WINAMPSTATE _T("winampstate") #define DEF_WINAMPTITLE "Winamp3" diff --git a/plugins/Variables/src/parse_inet.cpp b/plugins/Variables/src/parse_inet.cpp index 126642eddf..4e02324658 100644 --- a/plugins/Variables/src/parse_inet.cpp +++ b/plugins/Variables/src/parse_inet.cpp @@ -97,11 +97,10 @@ static TCHAR *parseHToA(ARGUMENTSINFO *ai) return mir_a2t(inet_ntoa(in)); } -int registerInetTokens() +void registerInetTokens() { - registerIntToken(_T(URLENC), parseUrlEnc, TRF_FUNCTION, LPGEN("Internet Related")"\t(x)\t"LPGEN("converts each non-html character into hex format")); - registerIntToken(_T(URLDEC), parseUrlDec, TRF_FUNCTION, LPGEN("Internet Related")"\t(x)\t"LPGEN("converts each hex value into non-html character")); - registerIntToken(_T(NTOA), parseNToA, TRF_FUNCTION, LPGEN("Internet Related")"\t(x)\t"LPGEN("converts a 32-bit number to IPv4 dotted notation")); - registerIntToken(_T(HTOA), parseHToA, TRF_FUNCTION, LPGEN("Internet Related")"\t(x)\t"LPGEN("converts a 32-bit number (in host byte order) to IPv4 dotted notation")); - return 0; + registerIntToken(URLENC, parseUrlEnc, TRF_FUNCTION, LPGEN("Internet Related")"\t(x)\t"LPGEN("converts each non-html character into hex format")); + registerIntToken(URLDEC, parseUrlDec, TRF_FUNCTION, LPGEN("Internet Related")"\t(x)\t"LPGEN("converts each hex value into non-html character")); + registerIntToken(NTOA, parseNToA, TRF_FUNCTION, LPGEN("Internet Related")"\t(x)\t"LPGEN("converts a 32-bit number to IPv4 dotted notation")); + registerIntToken(HTOA, parseHToA, TRF_FUNCTION, LPGEN("Internet Related")"\t(x)\t"LPGEN("converts a 32-bit number (in host byte order) to IPv4 dotted notation")); } diff --git a/plugins/Variables/src/parse_inet.h b/plugins/Variables/src/parse_inet.h index 788d208d66..53c39a7152 100644 --- a/plugins/Variables/src/parse_inet.h +++ b/plugins/Variables/src/parse_inet.h @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define URLENC "urlenc" -#define URLDEC "urldec" -#define NTOA "ntoa" -#define HTOA "htoa" +#define URLENC _T("urlenc") +#define URLDEC _T("urldec") +#define NTOA _T("ntoa") +#define HTOA _T("htoa") diff --git a/plugins/Variables/src/parse_logic.cpp b/plugins/Variables/src/parse_logic.cpp index 211ef15e94..ea14e89660 100644 --- a/plugins/Variables/src/parse_logic.cpp +++ b/plugins/Variables/src/parse_logic.cpp @@ -271,10 +271,7 @@ static TCHAR *parseOr(ARGUMENTSINFO *ai) static TCHAR *parseTrue(ARGUMENTSINFO *ai) { - if (ai->argc != 1) - return NULL; - - return mir_tstrdup(_T("")); + return (ai->argc != 1) ? NULL : mir_tstrdup(_T("")); } static TCHAR *parseXor(ARGUMENTSINFO *ai) @@ -297,23 +294,22 @@ static TCHAR *parseXor(ARGUMENTSINFO *ai) return mir_tstrdup(_T("")); } -int registerLogicTokens() +void registerLogicTokens() { - registerIntToken(_T(AND), parseAnd, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y, ...)\t"LPGEN("performs logical AND (x && y && ...)")); - registerIntToken(_T(STR_FALSE), parseFalse, TRF_FIELD, LPGEN("Logical Expressions")"\t"LPGEN("Boolean FALSE")); - registerIntToken(_T(FOR), parseFor, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(w,x,y,z)\t"LPGEN("performs w, then shows z and performs y while x is TRUE")); - registerIntToken(_T(IF), parseIf, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y,z)\t"LPGEN("shows y if x is TRUE, otherwise it shows z")); - registerIntToken(_T(IF2), parseIf2, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y)\t"LPGEN("shows x if x is TRUE, otherwise it shows y (if(x,x,y))")); - registerIntToken(_T(IF3), parseIf3, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y, ...)\t"LPGEN("the first argument parsed successfully")); - registerIntToken(_T(IFEQUAL), parseIfequal, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(w,x,y,z)\t"LPGEN("y if w = x, else z")); - registerIntToken(_T(IFGREATER), parseIfgreater, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(w,x,y,z)\t"LPGEN("y if w > x, else z")); - registerIntToken(_T(IFLONGER), parseIflonger, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(w,x,y,z)\t"LPGEN("y if string length of w > x, else z")); - registerIntToken(_T(EQUAL), parseEqual, TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y)\t"LPGEN("TRUE if x = y")); - registerIntToken(_T(GREATER), parseGreater, TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y)\t"LPGEN("TRUE if x > y")); - registerIntToken(_T(LONGER), parseLonger, TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y)\t"LPGEN("TRUE if x is longer than y")); - registerIntToken(_T(NOT), parseNot, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x)\t"LPGEN("performs logical NOT (!x)")); - registerIntToken(_T(OR), parseOr, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y,...)\t"LPGEN("performs logical OR (x || y || ...)")); - registerIntToken(_T(STR_TRUE), parseTrue, TRF_FIELD, LPGEN("Logical Expressions")"\t"LPGEN("Boolean TRUE")); - registerIntToken(_T(XOR), parseXor, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y)\t"LPGEN("performs logical XOR (x ^ y)")); - return 0; + registerIntToken(AND, parseAnd, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y, ...)\t"LPGEN("performs logical AND (x && y && ...)")); + registerIntToken(STR_FALSE, parseFalse, TRF_FIELD, LPGEN("Logical Expressions")"\t"LPGEN("Boolean FALSE")); + registerIntToken(FOR, parseFor, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(w,x,y,z)\t"LPGEN("performs w, then shows z and performs y while x is TRUE")); + registerIntToken(IF, parseIf, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y,z)\t"LPGEN("shows y if x is TRUE, otherwise it shows z")); + registerIntToken(IF2, parseIf2, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y)\t"LPGEN("shows x if x is TRUE, otherwise it shows y (if(x,x,y))")); + registerIntToken(IF3, parseIf3, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y, ...)\t"LPGEN("the first argument parsed successfully")); + registerIntToken(IFEQUAL, parseIfequal, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(w,x,y,z)\t"LPGEN("y if w = x, else z")); + registerIntToken(IFGREATER, parseIfgreater, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(w,x,y,z)\t"LPGEN("y if w > x, else z")); + registerIntToken(IFLONGER, parseIflonger, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(w,x,y,z)\t"LPGEN("y if string length of w > x, else z")); + registerIntToken(EQUAL, parseEqual, TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y)\t"LPGEN("TRUE if x = y")); + registerIntToken(GREATER, parseGreater, TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y)\t"LPGEN("TRUE if x > y")); + registerIntToken(LONGER, parseLonger, TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y)\t"LPGEN("TRUE if x is longer than y")); + registerIntToken(NOT, parseNot, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x)\t"LPGEN("performs logical NOT (!x)")); + registerIntToken(OR, parseOr, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y,...)\t"LPGEN("performs logical OR (x || y || ...)")); + registerIntToken(STR_TRUE, parseTrue, TRF_FIELD, LPGEN("Logical Expressions")"\t"LPGEN("Boolean TRUE")); + registerIntToken(XOR, parseXor, TRF_UNPARSEDARGS | TRF_FUNCTION, LPGEN("Logical Expressions")"\t(x,y)\t"LPGEN("performs logical XOR (x ^ y)")); } diff --git a/plugins/Variables/src/parse_logic.h b/plugins/Variables/src/parse_logic.h index adc79d1626..084c28e03a 100644 --- a/plugins/Variables/src/parse_logic.h +++ b/plugins/Variables/src/parse_logic.h @@ -17,19 +17,19 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define AND "and" -#define STR_FALSE "false" -#define FOR "for" -#define EQUAL "equal" -#define GREATER "greater" -#define IF "if" -#define IF2 "if2" -#define IF3 "if3" -#define IFEQUAL "ifequal" -#define IFGREATER "ifgreater" -#define IFLONGER "iflonger" -#define LONGER "longer" -#define NOT "not" -#define OR "or" -#define STR_TRUE "true" -#define XOR "xor" +#define AND _T("and") +#define STR_FALSE _T("false") +#define FOR _T("for") +#define EQUAL _T("equal") +#define GREATER _T("greater") +#define IF _T("if") +#define IF2 _T("if2") +#define IF3 _T("if3") +#define IFEQUAL _T("ifequal") +#define IFGREATER _T("ifgreater") +#define IFLONGER _T("iflonger") +#define LONGER _T("longer") +#define NOT _T("not") +#define OR _T("or") +#define STR_TRUE _T("true") +#define XOR _T("xor") diff --git a/plugins/Variables/src/parse_math.cpp b/plugins/Variables/src/parse_math.cpp index cb8335f764..b7bf78f26e 100644 --- a/plugins/Variables/src/parse_math.cpp +++ b/plugins/Variables/src/parse_math.cpp @@ -173,20 +173,18 @@ static TCHAR *parseSub(ARGUMENTSINFO *ai) return itot(result); } -int registerMathTokens() +void registerMathTokens() { - registerIntToken(_T(ADD), parseAdd, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y ,...)\t"LPGEN("x + y + ...")); - registerIntToken(_T(DIV), parseDiv, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y)\t"LPGEN("x divided by y")); - registerIntToken(_T(HEX), parseHex, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y)\t"LPGEN("converts decimal value x to hex value and padds to length y")); - registerIntToken(_T(MOD), parseMod, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y)\t"LPGEN("x modulo y (remainder of x divided by y)")); - registerIntToken(_T(MUL), parseMul, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y)\t"LPGEN("x times y")); - registerIntToken(_T(MULDIV), parseMuldiv, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y,z)\t"LPGEN("x times y divided by z")); - registerIntToken(_T(MIN), parseMin, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y,...)\t"LPGEN("minimum value of (decimal) arguments")); - registerIntToken(_T(MAX), parseMax, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y,...)\t"LPGEN("maximum value of (decimal) arguments")); - registerIntToken(_T(NUM), parseNum, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y)\t"LPGEN("pads decimal value x to length y with zeros")); - registerIntToken(_T(RAND), parseRand, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t()\t"LPGEN("random number")); - registerIntToken(_T(SUB), parseSub, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y,...)\t"LPGEN("x - y - ...")); + registerIntToken(ADD, parseAdd, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y ,...)\t"LPGEN("x + y + ...")); + registerIntToken(DIV, parseDiv, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y)\t"LPGEN("x divided by y")); + registerIntToken(HEX, parseHex, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y)\t"LPGEN("converts decimal value x to hex value and padds to length y")); + registerIntToken(MOD, parseMod, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y)\t"LPGEN("x modulo y (remainder of x divided by y)")); + registerIntToken(MUL, parseMul, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y)\t"LPGEN("x times y")); + registerIntToken(MULDIV, parseMuldiv, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y,z)\t"LPGEN("x times y divided by z")); + registerIntToken(MIN, parseMin, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y,...)\t"LPGEN("minimum value of (decimal) arguments")); + registerIntToken(MAX, parseMax, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y,...)\t"LPGEN("maximum value of (decimal) arguments")); + registerIntToken(NUM, parseNum, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y)\t"LPGEN("pads decimal value x to length y with zeros")); + registerIntToken(RAND, parseRand, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t()\t"LPGEN("random number")); + registerIntToken(SUB, parseSub, TRF_FUNCTION, LPGEN("Mathematical Functions")"\t(x,y,...)\t"LPGEN("x - y - ...")); srand((unsigned int)GetTickCount()); - - return 0; } diff --git a/plugins/Variables/src/parse_math.h b/plugins/Variables/src/parse_math.h index f11bca68fc..36d3c3e04c 100644 --- a/plugins/Variables/src/parse_math.h +++ b/plugins/Variables/src/parse_math.h @@ -17,14 +17,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define ADD "add" -#define DIV "div" -#define HEX "hex" -#define MOD "mod" -#define MUL "mul" -#define MULDIV "muldiv" -#define MIN "min" -#define MAX "max" -#define NUM "num" -#define RAND "rand" -#define SUB "sub" +#define ADD _T("add") +#define DIV _T("div") +#define HEX _T("hex") +#define MOD _T("mod") +#define MUL _T("mul") +#define MULDIV _T("muldiv") +#define MIN _T("min") +#define MAX _T("max") +#define NUM _T("num") +#define RAND _T("rand") +#define SUB _T("sub") diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp index 4312d100d3..65ccfe638c 100644 --- a/plugins/Variables/src/parse_metacontacts.cpp +++ b/plugins/Variables/src/parse_metacontacts.cpp @@ -184,13 +184,11 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai) return res; } -int registerMetaContactsTokens() +void registerMetaContactsTokens() { if (ServiceExists(MS_MC_GETPROTOCOLNAME)) { - registerIntToken(_T(MC_GETPARENT), parseGetParent, TRF_FUNCTION, LPGEN("MetaContacts")"\t(x)\t"LPGEN("get parent metacontact of contact x")); - registerIntToken(_T(MC_GETDEFAULT), parseGetDefault, TRF_FUNCTION, LPGEN("MetaContacts")"\t(x)\t"LPGEN("get default subcontact x")); - registerIntToken(_T(MC_GETMOSTONLINE), parseGetMostOnline, TRF_FUNCTION, LPGEN("MetaContacts")"\t(x)\t"LPGEN("get the 'most online' subcontact x")); + registerIntToken(MC_GETPARENT, parseGetParent, TRF_FUNCTION, LPGEN("MetaContacts")"\t(x)\t"LPGEN("get parent metacontact of contact x")); + registerIntToken(MC_GETDEFAULT, parseGetDefault, TRF_FUNCTION, LPGEN("MetaContacts")"\t(x)\t"LPGEN("get default subcontact x")); + registerIntToken(MC_GETMOSTONLINE, parseGetMostOnline, TRF_FUNCTION, LPGEN("MetaContacts")"\t(x)\t"LPGEN("get the 'most online' subcontact x")); } - - return 0; } diff --git a/plugins/Variables/src/parse_metacontacts.h b/plugins/Variables/src/parse_metacontacts.h index d808213915..08b419d4d7 100644 --- a/plugins/Variables/src/parse_metacontacts.h +++ b/plugins/Variables/src/parse_metacontacts.h @@ -17,6 +17,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define MC_GETPARENT "mc_getparent" -#define MC_GETDEFAULT "mc_getdefault" -#define MC_GETMOSTONLINE "mc_getmostonline" +#define MC_GETPARENT _T("mc_getparent") +#define MC_GETDEFAULT _T("mc_getdefault") +#define MC_GETMOSTONLINE _T("mc_getmostonline") diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index b87dd9a500..2d3ff19b5e 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -36,33 +36,33 @@ static int getContactInfoFlags(TCHAR *tszDesc) { int flags = 0; for (TCHAR *cur = tszDesc; (cur < (tszDesc + _tcslen(tszDesc))); cur++) { - if (!_tcsnicmp(cur, _T(STR_PROTOID), _tcslen(_T(STR_PROTOID)))) { + if (!_tcsnicmp(cur, STR_PROTOID, _tcslen(STR_PROTOID))) { flags |= CI_PROTOID; - cur += _tcslen(_T(STR_PROTOID)) - 1; + cur += _tcslen(STR_PROTOID) - 1; } - else if (!_tcsnicmp(cur, _T(STR_NICK), _tcslen(_T(STR_NICK)))) { + else if (!_tcsnicmp(cur, STR_NICK, _tcslen(STR_NICK))) { flags |= CI_NICK; - cur += _tcslen(_T(STR_NICK)) - 1; + cur += _tcslen(STR_NICK) - 1; } - else if (!_tcsnicmp(cur, _T(STR_FIRSTNAME), _tcslen(_T(STR_FIRSTNAME)))) { + else if (!_tcsnicmp(cur, STR_FIRSTNAME, _tcslen(STR_FIRSTNAME))) { flags |= CI_FIRSTNAME; - cur += _tcslen(_T(STR_FIRSTNAME)) - 1; + cur += _tcslen(STR_FIRSTNAME) - 1; } - else if (!_tcsnicmp(cur, _T(STR_LASTNAME), _tcslen(_T(STR_LASTNAME)))) { + else if (!_tcsnicmp(cur, STR_LASTNAME, _tcslen(STR_LASTNAME))) { flags |= CI_LASTNAME; - cur += _tcslen(_T(STR_LASTNAME)) - 1; + cur += _tcslen(STR_LASTNAME) - 1; } - else if (!_tcsnicmp(cur, _T(STR_DISPLAY), _tcslen(_T(STR_DISPLAY)))) { + else if (!_tcsnicmp(cur, STR_DISPLAY, _tcslen(STR_DISPLAY))) { flags |= CI_LISTNAME; - cur += _tcslen(_T(STR_DISPLAY)) - 1; + cur += _tcslen(STR_DISPLAY) - 1; } - else if (!_tcsnicmp(cur, _T(STR_EMAIL), _tcslen(_T(STR_EMAIL)))) { + else if (!_tcsnicmp(cur, STR_EMAIL, _tcslen(STR_EMAIL))) { flags |= CI_EMAIL; - cur += _tcslen(_T(STR_EMAIL)) - 1; + cur += _tcslen(STR_EMAIL) - 1; } - else if (!_tcsnicmp(cur, _T(STR_UNIQUEID), _tcslen(_T(STR_UNIQUEID)))) { + else if (!_tcsnicmp(cur, STR_UNIQUEID, _tcslen(STR_UNIQUEID))) { flags |= CI_UNIQUEID; - cur += _tcslen(_T(STR_UNIQUEID)) - 1; + cur += _tcslen(STR_UNIQUEID) - 1; } } if (flags == 0) { @@ -405,11 +405,8 @@ static TCHAR* parseMyStatus(ARGUMENTSINFO *ai) else status = CallProtoService(_T2A(ai->targv[1]), PS_GETSTATUS, 0, 0); - TCHAR *szStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)status, GSMDF_UNICODE); - if (szStatus != NULL) - return mir_tstrdup(szStatus); - - return NULL; + TCHAR *szStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)status, GSMDF_TCHAR); + return (szStatus != NULL) ? mir_tstrdup(szStatus) : NULL; } static TCHAR* parseProtoInfo(ARGUMENTSINFO *ai) @@ -711,10 +708,7 @@ static TCHAR *parseContactNameString(ARGUMENTSINFO *ai) ai->flags |= AIF_DONTPARSE; TCHAR *ret = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ai->fi->hContact, GCDNF_TCHAR); - if (ret == NULL) - return NULL; - - return mir_tstrdup(ret); + return (ret == NULL) ? NULL : mir_tstrdup(ret); } static TCHAR *parseMirDateString(ARGUMENTSINFO *ai) @@ -758,43 +752,40 @@ static TCHAR *parseMirSrvExists(ARGUMENTSINFO *ai) return mir_tstrdup(_T("")); } -int registerMirandaTokens() +void registerMirandaTokens() { - if (ServiceExists(MS_UTILS_REPLACEVARS)) { - // global vars - registerIntToken(_T("miranda_path"), parseMirandaCoreVar, TRF_FIELD, LPGEN("Miranda Core Global")"\t"LPGEN("path to Miranda root folder")); - registerIntToken(_T("miranda_profile"), parseMirandaCoreVar, TRF_FIELD, LPGEN("Miranda Core Global")"\t"LPGEN("path to current Miranda profile")); - registerIntToken(_T("miranda_profilename"), parseMirandaCoreVar, TRF_FIELD, LPGEN("Miranda Core Global")"\t"LPGEN("name of current Miranda profile (filename, without extension)")); - registerIntToken(_T("miranda_userdata"), parseMirandaCoreVar, TRF_FIELD, LPGEN("Miranda Core Global")"\t"LPGEN("will return parsed string %miranda_profile%\\Profiles\\%miranda_profilename%")); - registerIntToken(_T("miranda_avatarcache"), parseMirandaCoreVar, TRF_FIELD, LPGEN("Miranda Core Global")"\t"LPGEN("will return parsed string %miranda_profile%\\Profiles\\%miranda_profilename%\\AvatarCache")); - registerIntToken(_T("miranda_logpath"), parseMirandaCoreVar, TRF_FIELD, LPGEN("Miranda Core Global")"\t"LPGEN("will return parsed string %miranda_profile%\\Profiles\\%miranda_profilename%\\Logs")); - - // OS vars - registerIntToken(_T("appdata"), parseMirandaCoreVar, TRF_FIELD, LPGEN("Miranda Core OS")"\t"LPGEN("same as environment variable %APPDATA% for currently logged-on Windows user")); - registerIntToken(_T("username"), parseMirandaCoreVar, TRF_FIELD, LPGEN("Miranda Core OS")"\t"LPGEN("username for currently logged-on Windows user")); - registerIntToken(_T("mydocuments"), parseMirandaCoreVar, TRF_FIELD, LPGEN("Miranda Core OS")"\t"LPGEN("\"My Documents\" folder for currently logged-on Windows user")); - registerIntToken(_T("desktop"), parseMirandaCoreVar, TRF_FIELD, LPGEN("Miranda Core OS")"\t"LPGEN("\"Desktop\" folder for currently logged-on Windows user")); - } - registerIntToken(_T(CODETOSTATUS), parseCodeToStatus, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x)\t"LPGEN("translates status code x into a status description")); - registerIntToken(_T(CONTACT), parseContact, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y,z)\t"LPGEN("zth contact with property y described by x, example: (unregistered,nick) (z is optional)")); - registerIntToken(_T(CONTACTCOUNT), parseContactCount, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y)\t"LPGEN("number of contacts with property y described by x, example: (unregistered,nick)")); - registerIntToken(_T(MIR_CONTACTINFO), parseContactInfo, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y)\t"LPGEN("info property y of contact x")); - registerIntToken(_T(DBPROFILENAME), parseDBProfileName, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("db profile name")); - registerIntToken(_T(DBPROFILEPATH), parseDBProfilePath, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("db profile path")); - registerIntToken(_T(DBSETTING), parseDBSetting, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y,z,w)\t"LPGEN("db setting z of module y of contact x and return w if z isn't exist (w is optional)")); - registerIntToken(_T(DBEVENT), parseDbEvent, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y,z,w)\t"LPGEN("get event for contact x (optional), according to y,z,w, see documentation")); - registerIntToken(_T(LSTIME), parseLastSeenTime, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y)\t"LPGEN("get last seen time of contact x in format y (y is optional)")); - registerIntToken(_T(LSDATE), parseLastSeenDate, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y)\t"LPGEN("get last seen date of contact x in format y (y is optional)")); - registerIntToken(_T(LSSTATUS), parseLastSeenStatus, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x)\t"LPGEN("get last seen status of contact x")); - registerIntToken(_T(MIRANDAPATH), parseMirandaPath, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("path to the Miranda NG executable")); - registerIntToken(_T(MYSTATUS), parseMyStatus, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x)\t"LPGEN("current status description of protocol x (without x, the global status is retrieved)")); - registerIntToken(_T(PROTOINFO), parseProtoInfo, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y)\t"LPGEN("info property y of protocol ID x")); - registerIntToken(_T(SUBJECT), parseSpecialContact, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("retrieves the subject, depending on situation")); - registerIntToken(_T(TRANSLATE), parseTranslate, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x)\t"LPGEN("translates x")); - registerIntToken(_T(VERSIONSTRING), parseVersionString, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("get the version of Miranda")); - registerIntToken(_T(CONTACT_NAME), parseContactNameString, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("get the contact display name")); - registerIntToken(_T(MIR_DATE), parseMirDateString, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("get the date and time (using Miranda format)")); - registerIntToken(_T(SRVEXISTS), parseMirSrvExists, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x)\t"LPGEN("TRUE if service function exists")); - - return 0; + // global vars + registerIntToken(_T("miranda_path"), parseMirandaCoreVar, TRF_FIELD, LPGEN("Miranda Core Global")"\t"LPGEN("path to Miranda root folder")); + registerIntToken(_T("miranda_profile"), parseMirandaCoreVar, TRF_FIELD, LPGEN("Miranda Core Global")"\t"LPGEN("path to current Miranda profile")); + registerIntToken(_T("miranda_profilename"), parseMirandaCoreVar, TRF_FIELD, LPGEN("Miranda Core Global")"\t"LPGEN("name of current Miranda profile (filename, without extension)")); + registerIntToken(_T("miranda_userdata"), parseMirandaCoreVar, TRF_FIELD, LPGEN("Miranda Core Global")"\t"LPGEN("will return parsed string %miranda_profile%\\Profiles\\%miranda_profilename%")); + registerIntToken(_T("miranda_avatarcache"), parseMirandaCoreVar, TRF_FIELD, LPGEN("Miranda Core Global")"\t"LPGEN("will return parsed string %miranda_profile%\\Profiles\\%miranda_profilename%\\AvatarCache")); + registerIntToken(_T("miranda_logpath"), parseMirandaCoreVar, TRF_FIELD, LPGEN("Miranda Core Global")"\t"LPGEN("will return parsed string %miranda_profile%\\Profiles\\%miranda_profilename%\\Logs")); + + // OS vars + registerIntToken(_T("appdata"), parseMirandaCoreVar, TRF_FIELD, LPGEN("Miranda Core OS")"\t"LPGEN("same as environment variable %APPDATA% for currently logged-on Windows user")); + registerIntToken(_T("username"), parseMirandaCoreVar, TRF_FIELD, LPGEN("Miranda Core OS")"\t"LPGEN("username for currently logged-on Windows user")); + registerIntToken(_T("mydocuments"), parseMirandaCoreVar, TRF_FIELD, LPGEN("Miranda Core OS")"\t"LPGEN("\"My Documents\" folder for currently logged-on Windows user")); + registerIntToken(_T("desktop"), parseMirandaCoreVar, TRF_FIELD, LPGEN("Miranda Core OS")"\t"LPGEN("\"Desktop\" folder for currently logged-on Windows user")); + + registerIntToken(CODETOSTATUS, parseCodeToStatus, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x)\t"LPGEN("translates status code x into a status description")); + registerIntToken(CONTACT, parseContact, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y,z)\t"LPGEN("zth contact with property y described by x, example: (unregistered,nick) (z is optional)")); + registerIntToken(CONTACTCOUNT, parseContactCount, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y)\t"LPGEN("number of contacts with property y described by x, example: (unregistered,nick)")); + registerIntToken(MIR_CONTACTINFO, parseContactInfo, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y)\t"LPGEN("info property y of contact x")); + registerIntToken(DBPROFILENAME, parseDBProfileName, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("db profile name")); + registerIntToken(DBPROFILEPATH, parseDBProfilePath, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("db profile path")); + registerIntToken(DBSETTING, parseDBSetting, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y,z,w)\t"LPGEN("db setting z of module y of contact x and return w if z isn't exist (w is optional)")); + registerIntToken(DBEVENT, parseDbEvent, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y,z,w)\t"LPGEN("get event for contact x (optional), according to y,z,w, see documentation")); + registerIntToken(LSTIME, parseLastSeenTime, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y)\t"LPGEN("get last seen time of contact x in format y (y is optional)")); + registerIntToken(LSDATE, parseLastSeenDate, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y)\t"LPGEN("get last seen date of contact x in format y (y is optional)")); + registerIntToken(LSSTATUS, parseLastSeenStatus, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x)\t"LPGEN("get last seen status of contact x")); + registerIntToken(MIRANDAPATH, parseMirandaPath, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("path to the Miranda NG executable")); + registerIntToken(MYSTATUS, parseMyStatus, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x)\t"LPGEN("current status description of protocol x (without x, the global status is retrieved)")); + registerIntToken(PROTOINFO, parseProtoInfo, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x,y)\t"LPGEN("info property y of protocol ID x")); + registerIntToken(SUBJECT, parseSpecialContact, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("retrieves the subject, depending on situation")); + registerIntToken(TRANSLATE, parseTranslate, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x)\t"LPGEN("translates x")); + registerIntToken(VERSIONSTRING, parseVersionString, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("get the version of Miranda")); + registerIntToken(CONTACT_NAME, parseContactNameString, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("get the contact display name")); + registerIntToken(MIR_DATE, parseMirDateString, TRF_FIELD, LPGEN("Miranda Related")"\t"LPGEN("get the date and time (using Miranda format)")); + registerIntToken(SRVEXISTS, parseMirSrvExists, TRF_FUNCTION, LPGEN("Miranda Related")"\t(x)\t"LPGEN("TRUE if service function exists")); } diff --git a/plugins/Variables/src/parse_miranda.h b/plugins/Variables/src/parse_miranda.h index 6e4485d8cc..5dbb9368c2 100644 --- a/plugins/Variables/src/parse_miranda.h +++ b/plugins/Variables/src/parse_miranda.h @@ -17,27 +17,27 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define VERSIONSTRING "mirandaversion" -#define CODETOSTATUS "code2status" -#define CONTACT "contact" -#define CONTACTCOUNT "ccount" -#define MIR_CONTACTINFO "cinfo" -#define DBPROFILENAME "dbprofile" -#define DBPROFILEPATH "dbprofilepath" -#define DBSETTING "dbsetting" -#define LSDATE "lsdate" -#define LSTIME "lstime" -#define LSSTATUS "lsstatus" +#define VERSIONSTRING _T("mirandaversion") +#define CODETOSTATUS _T("code2status") +#define CONTACT _T("contact") +#define CONTACTCOUNT _T("ccount") +#define MIR_CONTACTINFO _T("cinfo") +#define DBPROFILENAME _T("dbprofile") +#define DBPROFILEPATH _T("dbprofilepath") +#define DBSETTING _T("dbsetting") +#define LSDATE _T("lsdate") +#define LSTIME _T("lstime") +#define LSSTATUS _T("lsstatus") //#define SUBJECT "subject" // defined in variables.h -#define MIRANDAPATH "mirandapath" -#define MYSTATUS "mstatus" -#define DBEVENT "message" // may be extended later +#define MIRANDAPATH _T("mirandapath") +#define MYSTATUS _T("mstatus") +#define DBEVENT _T("message") // may be extended later //#define PROTONAME "protoname" // depreciated -#define PROTOINFO "pinfo" -#define TRANSLATE "translate" -#define CONTACT_NAME "contactname" -#define MIR_DATE "date" -#define SRVEXISTS "srvexists" +#define PROTOINFO _T("pinfo") +#define TRANSLATE _T("translate") +#define CONTACT_NAME _T("contactname") +#define MIR_DATE _T("date") +#define SRVEXISTS _T("srvexists") #define STR_PINAME "name" #define STR_PIUIDTEXT "uidtext" @@ -45,13 +45,13 @@ #define SEEN_MODULE "SeenModule" -#define STR_PROTOID "protoid" -#define STR_FIRST "first" -#define STR_LAST "last" -#define STR_SENT "sent" -#define STR_RCVD "recv" -#define STR_READ "read" -#define STR_UNREAD "unread" +#define STR_PROTOID _T("protoid") +#define STR_FIRST _T("first") +#define STR_LAST _T("last") +#define STR_SENT _T("sent") +#define STR_RCVD _T("recv") +#define STR_READ _T("read") +#define STR_UNREAD _T("unread") /* dbevent flags */ /* these flags must contain: diff --git a/plugins/Variables/src/parse_regexp.cpp b/plugins/Variables/src/parse_regexp.cpp index 7f5bff1925..ee191f95fa 100644 --- a/plugins/Variables/src/parse_regexp.cpp +++ b/plugins/Variables/src/parse_regexp.cpp @@ -93,9 +93,8 @@ static TCHAR *parseRegExpSubstr(ARGUMENTSINFO *ai) return mir_tstrdup(_T("")); } -int registerRegExpTokens() +void registerRegExpTokens() { - registerIntToken(_T(REGEXPCHECK), parseRegExpCheck, TRF_FUNCTION, LPGEN("Regular Expressions")"\t(x,y)\t"LPGEN("(ANSI input only) the number of substring matches found in y with pattern x")); - registerIntToken(_T(REGEXPSUBSTR), parseRegExpSubstr, TRF_FUNCTION, LPGEN("Regular Expressions")"\t(x,y,z)\t"LPGEN("(ANSI input only) substring match number z found in subject y with pattern x")); - return 0; + registerIntToken(REGEXPCHECK, parseRegExpCheck, TRF_FUNCTION, LPGEN("Regular Expressions")"\t(x,y)\t"LPGEN("(ANSI input only) the number of substring matches found in y with pattern x")); + registerIntToken(REGEXPSUBSTR, parseRegExpSubstr, TRF_FUNCTION, LPGEN("Regular Expressions")"\t(x,y,z)\t"LPGEN("(ANSI input only) substring match number z found in subject y with pattern x")); } \ No newline at end of file diff --git a/plugins/Variables/src/parse_regexp.h b/plugins/Variables/src/parse_regexp.h index 6844dd4036..f5eb289844 100644 --- a/plugins/Variables/src/parse_regexp.h +++ b/plugins/Variables/src/parse_regexp.h @@ -17,5 +17,5 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define REGEXPCHECK "regexp_check" -#define REGEXPSUBSTR "regexp_substr" +#define REGEXPCHECK _T("regexp_check") +#define REGEXPSUBSTR _T("regexp_substr") diff --git a/plugins/Variables/src/parse_str.cpp b/plugins/Variables/src/parse_str.cpp index a92e54a6cc..e4721c0fdf 100644 --- a/plugins/Variables/src/parse_str.cpp +++ b/plugins/Variables/src/parse_str.cpp @@ -777,45 +777,44 @@ static TCHAR *parseExtratext(ARGUMENTSINFO *ai) return NULL; } -int registerStrTokens() -{ - registerIntToken(_T(MIR_CAPS), parseCaps, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("converts each first letter of a word to uppercase, all others to lowercase")); - registerIntToken(_T(MIR_CAPS2), parseCaps2, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("converts each first letter of a word to uppercase")); - registerIntToken(_T(MIR_CRLF), parseCrlf, TRF_FUNCTION, LPGEN("String Functions")"\t()\t"LPGEN("inserts 'end of line' character")); - registerIntToken(_T(MIR_EXTRATEXT), parseExtratext, TRF_FIELD, LPGEN("String Functions")"\t"LPGEN("depends on calling plugin")); - registerIntToken(_T(MIR_EOL2CRLF), parseEolToCrlf, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("replace all occurrences of \\n (Unix) by \\r\\n (Windows)")); - registerIntToken(_T(MIR_FIXEOL), parseFixeol, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("cuts x after the first line and appends y (y is optional)")); - registerIntToken(_T(MIR_FIXEOL2), parseFixeol2, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("replaces all end of line characters by y (y is optional)")); - registerIntToken(_T(MIR_INSERT), parseInsert, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("inserts string y at position z in string x")); - registerIntToken(_T(MIR_LEFT), parseLeft, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("trims x to length y, keeping first y characters")); - registerIntToken(_T(MIR_LEN), parseLen, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("length of x")); - registerIntToken(_T(MIR_LINECOUNT), parseLineCount, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("the number of lines in string x")); - registerIntToken(_T(MIR_LONGEST), parseLongest, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,...)\t"LPGEN("the longest string of the arguments")); - registerIntToken(_T(MIR_LOWER), parseLower, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("converts x to lowercase")); - registerIntToken(_T(MIR_NOOP), parseNoOp, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("no operation, x as given")); - registerIntToken(_T(MIR_PAD), parsePad, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("pads x to length y prepending character z (z is optional)")); - registerIntToken(_T(MIR_PADRIGHT), parsePadright, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("pads x to length y appending character z (z is optional)")); - registerIntToken(_T(MIR_PADCUT), parsePadcut, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("pads x to length y prepending character z, or cut if x is longer (z is optional)")); - registerIntToken(_T(MIR_PADCUTRIGHT), parsePadcutright, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("pads x to length y appending character z, or cut if x is longer (z is optional)")); - registerIntToken(_T(MIR_REPEAT), parseRepeat, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("repeats x y times")); - registerIntToken(_T(MIR_REPLACE), parseReplace, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z,...)\t"LPGEN("replace all occurrences of y in x with z, multiple y and z arguments allowed")); - registerIntToken(_T(MIR_RIGHT), parseRight, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("trims x to length y, keeping last y characters")); - registerIntToken(_T(MIR_SCROLL), parseScroll, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("moves string x, z characters to the left and trims it to y characters")); - registerIntToken(_T(MIR_STRCMP), parseStrcmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("TRUE if x equals y")); - registerIntToken(_T(MIR_STRMCMP), parseStrmcmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,...)\t"LPGEN("TRUE if x equals any of the following arguments")); - registerIntToken(_T(MIR_STRNCMP), parseStrncmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("TRUE if the first z characters of x equal y")); - registerIntToken(_T(MIR_STRICMP), parseStricmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("TRUE if x equals y, ignoring case")); - registerIntToken(_T(MIR_STRNICMP), parseStrnicmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("TRUE if the first z characters of x equal y, ignoring case")); - registerIntToken(_T(MIR_SHORTEST), parseShortest, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,...)\t"LPGEN("the shortest string of the arguments")); - registerIntToken(_T(MIR_STRCHR), parseStrchr, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("location of first occurrence of character y in string x")); - registerIntToken(_T(MIR_STRRCHR), parseStrrchr, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("location of last occurrence of character y in string x")); - registerIntToken(_T(MIR_STRSTR), parseStrstr, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("location of first occurrence of string y in x")); - registerIntToken(_T(MIR_SUBSTR), parseSubstr, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("substring of x starting from position y to z")); - registerIntToken(_T(MIR_SELECT), parseSelect, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,...)\t"LPGEN("the xth string of the arguments")); - registerIntToken(_T(MIR_SWITCH), parseSwitch, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z,...)\t"LPGEN("z if y equals x, multiple y and z arguments allowed")); - registerIntToken(_T(MIR_TRIM), parseTrim, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("removes white spaces in before and after x")); - registerIntToken(_T(MIR_TAB), parseTab, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("inserts x tab characters (x is optional)")); - registerIntToken(_T(MIR_UPPER), parseUpper, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("converts x to upper case")); - registerIntToken(_T(MIR_WORD), parseWord, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("words (separated by white spaces) number y to z from string x (z is optional)")); - return 0; +void registerStrTokens() +{ + registerIntToken(MIR_CAPS, parseCaps, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("converts each first letter of a word to uppercase, all others to lowercase")); + registerIntToken(MIR_CAPS2, parseCaps2, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("converts each first letter of a word to uppercase")); + registerIntToken(MIR_CRLF, parseCrlf, TRF_FUNCTION, LPGEN("String Functions")"\t()\t"LPGEN("inserts 'end of line' character")); + registerIntToken(MIR_EXTRATEXT, parseExtratext, TRF_FIELD, LPGEN("String Functions")"\t"LPGEN("depends on calling plugin")); + registerIntToken(MIR_EOL2CRLF, parseEolToCrlf, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("replace all occurrences of \\n (Unix) by \\r\\n (Windows)")); + registerIntToken(MIR_FIXEOL, parseFixeol, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("cuts x after the first line and appends y (y is optional)")); + registerIntToken(MIR_FIXEOL2, parseFixeol2, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("replaces all end of line characters by y (y is optional)")); + registerIntToken(MIR_INSERT, parseInsert, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("inserts string y at position z in string x")); + registerIntToken(MIR_LEFT, parseLeft, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("trims x to length y, keeping first y characters")); + registerIntToken(MIR_LEN, parseLen, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("length of x")); + registerIntToken(MIR_LINECOUNT, parseLineCount, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("the number of lines in string x")); + registerIntToken(MIR_LONGEST, parseLongest, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,...)\t"LPGEN("the longest string of the arguments")); + registerIntToken(MIR_LOWER, parseLower, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("converts x to lowercase")); + registerIntToken(MIR_NOOP, parseNoOp, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("no operation, x as given")); + registerIntToken(MIR_PAD, parsePad, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("pads x to length y prepending character z (z is optional)")); + registerIntToken(MIR_PADRIGHT, parsePadright, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("pads x to length y appending character z (z is optional)")); + registerIntToken(MIR_PADCUT, parsePadcut, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("pads x to length y prepending character z, or cut if x is longer (z is optional)")); + registerIntToken(MIR_PADCUTRIGHT, parsePadcutright, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("pads x to length y appending character z, or cut if x is longer (z is optional)")); + registerIntToken(MIR_REPEAT, parseRepeat, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("repeats x y times")); + registerIntToken(MIR_REPLACE, parseReplace, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z,...)\t"LPGEN("replace all occurrences of y in x with z, multiple y and z arguments allowed")); + registerIntToken(MIR_RIGHT, parseRight, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("trims x to length y, keeping last y characters")); + registerIntToken(MIR_SCROLL, parseScroll, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("moves string x, z characters to the left and trims it to y characters")); + registerIntToken(MIR_STRCMP, parseStrcmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("TRUE if x equals y")); + registerIntToken(MIR_STRMCMP, parseStrmcmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,...)\t"LPGEN("TRUE if x equals any of the following arguments")); + registerIntToken(MIR_STRNCMP, parseStrncmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("TRUE if the first z characters of x equal y")); + registerIntToken(MIR_STRICMP, parseStricmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("TRUE if x equals y, ignoring case")); + registerIntToken(MIR_STRNICMP, parseStrnicmp, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("TRUE if the first z characters of x equal y, ignoring case")); + registerIntToken(MIR_SHORTEST, parseShortest, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,...)\t"LPGEN("the shortest string of the arguments")); + registerIntToken(MIR_STRCHR, parseStrchr, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("location of first occurrence of character y in string x")); + registerIntToken(MIR_STRRCHR, parseStrrchr, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("location of last occurrence of character y in string x")); + registerIntToken(MIR_STRSTR, parseStrstr, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y)\t"LPGEN("location of first occurrence of string y in x")); + registerIntToken(MIR_SUBSTR, parseSubstr, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("substring of x starting from position y to z")); + registerIntToken(MIR_SELECT, parseSelect, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,...)\t"LPGEN("the xth string of the arguments")); + registerIntToken(MIR_SWITCH, parseSwitch, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z,...)\t"LPGEN("z if y equals x, multiple y and z arguments allowed")); + registerIntToken(MIR_TRIM, parseTrim, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("removes white spaces in before and after x")); + registerIntToken(MIR_TAB, parseTab, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("inserts x tab characters (x is optional)")); + registerIntToken(MIR_UPPER, parseUpper, TRF_FUNCTION, LPGEN("String Functions")"\t(x)\t"LPGEN("converts x to upper case")); + registerIntToken(MIR_WORD, parseWord, TRF_FUNCTION, LPGEN("String Functions")"\t(x,y,z)\t"LPGEN("words (separated by white spaces) number y to z from string x (z is optional)")); } diff --git a/plugins/Variables/src/parse_str.h b/plugins/Variables/src/parse_str.h index 69a475fba3..cab3c017bc 100644 --- a/plugins/Variables/src/parse_str.h +++ b/plugins/Variables/src/parse_str.h @@ -17,41 +17,41 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define MIR_CAPS "caps" -#define MIR_CAPS2 "caps2" -#define MIR_CRLF "crlf" +#define MIR_CAPS _T("caps") +#define MIR_CAPS2 _T("caps2") +#define MIR_CRLF _T("crlf") //#define MIR_EXTRATEXT "extratext" // defined in variables.h -#define MIR_EOL2CRLF "eol2crlf" -#define MIR_FIXEOL "fix_eol" -#define MIR_FIXEOL2 "fix_eol2" -#define MIR_INSERT "insert" -#define MIR_LEFT "left" -#define MIR_LEN "len" -#define MIR_LINECOUNT "linecount" -#define MIR_LONGEST "longest" -#define MIR_LOWER "lower" -#define MIR_NOOP "noop" -#define MIR_PAD "pad" -#define MIR_PADRIGHT "pad_right" -#define MIR_PADCUT "padcut" -#define MIR_PADCUTRIGHT "padcut_right" -#define MIR_REPEAT "repeat" -#define MIR_REPLACE "replace" -#define MIR_RIGHT "right" -#define MIR_SCROLL "scroll" -#define MIR_SHORTEST "shortest" -#define MIR_STRCHR "strchr" -#define MIR_STRRCHR "strrchr" -#define MIR_STRSTR "strstr" -#define MIR_STRCMP "strcmp" -#define MIR_STRNCMP "strncmp" -#define MIR_STRMCMP "strmcmp" -#define MIR_STRICMP "stricmp" -#define MIR_STRNICMP "strnicmp" -#define MIR_SUBSTR "substr" -#define MIR_SELECT "select" -#define MIR_SWITCH "switch" -#define MIR_TRIM "trim" -#define MIR_TAB "tab" -#define MIR_UPPER "upper" -#define MIR_WORD "word" +#define MIR_EOL2CRLF _T("eol2crlf") +#define MIR_FIXEOL _T("fix_eol") +#define MIR_FIXEOL2 _T("fix_eol2") +#define MIR_INSERT _T("insert") +#define MIR_LEFT _T("left") +#define MIR_LEN _T("len") +#define MIR_LINECOUNT _T("linecount") +#define MIR_LONGEST _T("longest") +#define MIR_LOWER _T("lower") +#define MIR_NOOP _T("noop") +#define MIR_PAD _T("pad") +#define MIR_PADRIGHT _T("pad_right") +#define MIR_PADCUT _T("padcut") +#define MIR_PADCUTRIGHT _T("padcut_right") +#define MIR_REPEAT _T("repeat") +#define MIR_REPLACE _T("replace") +#define MIR_RIGHT _T("right") +#define MIR_SCROLL _T("scroll") +#define MIR_SHORTEST _T("shortest") +#define MIR_STRCHR _T("strchr") +#define MIR_STRRCHR _T("strrchr") +#define MIR_STRSTR _T("strstr") +#define MIR_STRCMP _T("strcmp") +#define MIR_STRNCMP _T("strncmp") +#define MIR_STRMCMP _T("strmcmp") +#define MIR_STRICMP _T("stricmp") +#define MIR_STRNICMP _T("strnicmp") +#define MIR_SUBSTR _T("substr") +#define MIR_SELECT _T("select") +#define MIR_SWITCH _T("switch") +#define MIR_TRIM _T("trim") +#define MIR_TAB _T("tab") +#define MIR_UPPER _T("upper") +#define MIR_WORD _T("word") diff --git a/plugins/Variables/src/parse_system.cpp b/plugins/Variables/src/parse_system.cpp index d8acc94430..5773e3441e 100644 --- a/plugins/Variables/src/parse_system.cpp +++ b/plugins/Variables/src/parse_system.cpp @@ -876,40 +876,39 @@ static TCHAR *parseClipboard(ARGUMENTSINFO *ai) return res; } -int registerSystemTokens() +void registerSystemTokens() { - registerIntToken(_T(COMPUTERNAME), parseComputerName, TRF_FIELD, LPGEN("System Functions")"\t"LPGEN("computer name")); + registerIntToken(COMPUTERNAME, parseComputerName, TRF_FIELD, LPGEN("System Functions")"\t"LPGEN("computer name")); #if _WIN32_WINNT>=0x0500 - registerIntToken(_T(CPULOAD), parseCpuLoad, TRF_FUNCTION, LPGEN("System Functions")"\t(x)\t"LPGEN("cpu load of process x (without extension) (x is optional)")); + registerIntToken(CPULOAD, parseCpuLoad, TRF_FUNCTION, LPGEN("System Functions")"\t(x)\t"LPGEN("cpu load of process x (without extension) (x is optional)")); #endif - registerIntToken(_T(CDATE), parseCurrentDate, TRF_FUNCTION, LPGEN("System Functions")"\t(y)\t"LPGEN("current date in format y (y is optional)")); - registerIntToken(_T(CTIME), parseCurrentTime, TRF_FUNCTION, LPGEN("System Functions")"\t(y)\t"LPGEN("current time in format y (y is optional)")); - registerIntToken(_T(DIRECTORY), parseDirectory, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("the directory y directories above x")); - registerIntToken(_T(DIRECTORY2), parseDirectory2, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("strips y directories from x")); - registerIntToken(_T(DIFFTIME), parseDiffTime, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("number of seconds between date x and y (x and y in format: M/d/yy H:m:s)")); - registerIntToken(_T(DIREXISTS), parseDirExists, TRF_FUNCTION, LPGEN("System Functions")"\t(x)\t"LPGEN("TRUE if directory x exists")); - registerIntToken(_T(FILEEXISTS), parseFileExists, TRF_FUNCTION, LPGEN("System Functions")"\t(x)\t"LPGEN("TRUE if file x exists")); - registerIntToken(_T(FINDWINDOW), parseFindWindow, TRF_FUNCTION, LPGEN("System Functions")"\t(x)\t"LPGEN("window title of first window of class x")); - registerIntToken(_T(LISTDIR), parseListDir, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y,z)\t"LPGEN("shows files and directories of directory z, with filter y, separated by z (y and z optional)")); + registerIntToken(CDATE, parseCurrentDate, TRF_FUNCTION, LPGEN("System Functions")"\t(y)\t"LPGEN("current date in format y (y is optional)")); + registerIntToken(CTIME, parseCurrentTime, TRF_FUNCTION, LPGEN("System Functions")"\t(y)\t"LPGEN("current time in format y (y is optional)")); + registerIntToken(DIRECTORY, parseDirectory, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("the directory y directories above x")); + registerIntToken(DIRECTORY2, parseDirectory2, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("strips y directories from x")); + registerIntToken(DIFFTIME, parseDiffTime, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("number of seconds between date x and y (x and y in format: M/d/yy H:m:s)")); + registerIntToken(DIREXISTS, parseDirExists, TRF_FUNCTION, LPGEN("System Functions")"\t(x)\t"LPGEN("TRUE if directory x exists")); + registerIntToken(FILEEXISTS, parseFileExists, TRF_FUNCTION, LPGEN("System Functions")"\t(x)\t"LPGEN("TRUE if file x exists")); + registerIntToken(FINDWINDOW, parseFindWindow, TRF_FUNCTION, LPGEN("System Functions")"\t(x)\t"LPGEN("window title of first window of class x")); + registerIntToken(LISTDIR, parseListDir, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y,z)\t"LPGEN("shows files and directories of directory z, with filter y, separated by z (y and z optional)")); #ifndef WINE - registerIntToken(_T(PROCESSRUNNING), parseProcessRunning, TRF_FUNCTION, LPGEN("System Functions")"\t(x)\t"LPGEN("TRUE if process x is running")); + registerIntToken(PROCESSRUNNING, parseProcessRunning, TRF_FUNCTION, LPGEN("System Functions")"\t(x)\t"LPGEN("TRUE if process x is running")); #endif - registerIntToken(_T(REGISTRYVALUE), parseRegistryValue, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("value y from registry key x (REG_SZ (string) values only)")); - registerIntToken(_T(TIMESTAMP2DATE), parseTimestamp2Date, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("formats timestamp x (seconds since 1/1/1970) in date format y")); - registerIntToken(_T(TIMESTAMP2TIME), parseTimestamp2Time, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("formats timestamp x (seconds since 1/1/1970) in time format y")); - registerIntToken(_T(TXTFILE), parseTextFile, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("y > 0: line number y from file x, y = 0: the whole file, y < 0: line y counted from the end, y = r: random line")); + registerIntToken(REGISTRYVALUE, parseRegistryValue, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("value y from registry key x (REG_SZ (string) values only)")); + registerIntToken(TIMESTAMP2DATE, parseTimestamp2Date, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("formats timestamp x (seconds since 1/1/1970) in date format y")); + registerIntToken(TIMESTAMP2TIME, parseTimestamp2Time, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("formats timestamp x (seconds since 1/1/1970) in time format y")); + registerIntToken(TXTFILE, parseTextFile, TRF_FUNCTION, LPGEN("System Functions")"\t(x,y)\t"LPGEN("y > 0: line number y from file x, y = 0: the whole file, y < 0: line y counted from the end, y = r: random line")); #if _WIN32_WINNT>=0x0500 - registerIntToken(_T(UPTIME), parseUpTime, TRF_FIELD, LPGEN("System Functions")"\t"LPGEN("uptime in seconds")); + registerIntToken(UPTIME, parseUpTime, TRF_FIELD, LPGEN("System Functions")"\t"LPGEN("uptime in seconds")); #endif if (!ServiceExists(MS_UTILS_REPLACEVARS)) - registerIntToken(_T(ENVIRONMENTVARIABLE), parseEnvironmentVariable, TRF_FUNCTION, LPGEN("Miranda Core OS")"\t(%xxxxxxx%)\t"LPGEN("any environment variable defined in current Windows session (like %systemroot%, %allusersprofile%, etc.)")); + registerIntToken(ENVIRONMENTVARIABLE, parseEnvironmentVariable, TRF_FUNCTION, LPGEN("Miranda Core OS")"\t(%xxxxxxx%)\t"LPGEN("any environment variable defined in current Windows session (like %systemroot%, %allusersprofile%, etc.)")); else { - registerIntToken(_T(ENVIRONMENTVARIABLE), parseEnvironmentVariable, TRF_FUNCTION, LPGEN("System Functions")"\t(x)\t"LPGEN("expand environment variable x")); - registerIntToken(_T(USERNAME), parseUserName, TRF_FIELD, LPGEN("System Functions")"\t"LPGEN("user name")); + registerIntToken(ENVIRONMENTVARIABLE, parseEnvironmentVariable, TRF_FUNCTION, LPGEN("System Functions")"\t(x)\t"LPGEN("expand environment variable x")); + registerIntToken(USERNAME, parseUserName, TRF_FIELD, LPGEN("System Functions")"\t"LPGEN("user name")); } srand((unsigned int)GetTickCount()); - registerIntToken(_T(CLIPBOARD), parseClipboard, TRF_FIELD, LPGEN("System Functions")"\t"LPGEN("text from clipboard")); - return 0; + registerIntToken(CLIPBOARD, parseClipboard, TRF_FIELD, LPGEN("System Functions")"\t"LPGEN("text from clipboard")); } diff --git a/plugins/Variables/src/parse_system.h b/plugins/Variables/src/parse_system.h index d7d069432f..974d8b8cf6 100644 --- a/plugins/Variables/src/parse_system.h +++ b/plugins/Variables/src/parse_system.h @@ -17,26 +17,26 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define COMPUTERNAME "computername" -#define CPULOAD "cpuload" -#define CDATE "cdate" -#define CTIME "ctime" -#define DIRECTORY "directory" -#define DIRECTORY2 "directory2" -#define DIFFTIME "difftime" -#define DIREXISTS "direxists" -#define ENVIRONMENTVARIABLE "env_var" -#define FILEEXISTS "fileexists" -#define FINDWINDOW "findwindow" -#define LISTDIR "ls" -#define PROCESSRUNNING "processrunning" -#define REGISTRYVALUE "regvalue" -#define TIMESTAMP2DATE "ts2date" -#define TIMESTAMP2TIME "ts2time" -#define TXTFILE "txtfile" -#define UPTIME "uptime" -#define USERNAME "username" -#define CLIPBOARD "clipboard" +#define COMPUTERNAME _T("computername") +#define CPULOAD _T("cpuload") +#define CDATE _T("cdate") +#define CTIME _T("ctime") +#define DIRECTORY _T("directory") +#define DIRECTORY2 _T("directory2") +#define DIFFTIME _T("difftime") +#define DIREXISTS _T("direxists") +#define ENVIRONMENTVARIABLE _T("env_var") +#define FILEEXISTS _T("fileexists") +#define FINDWINDOW _T("findwindow") +#define LISTDIR _T("ls") +#define PROCESSRUNNING _T("processrunning") +#define REGISTRYVALUE _T("regvalue") +#define TIMESTAMP2DATE _T("ts2date") +#define TIMESTAMP2TIME _T("ts2time") +#define TXTFILE _T("txtfile") +#define UPTIME _T("uptime") +#define USERNAME _T("username") +#define CLIPBOARD _T("clipboard") #define TXTFILEBUFSZ 4096 #define MAX_REGVALUE_LENGTH 1024 diff --git a/plugins/Variables/src/parse_variables.cpp b/plugins/Variables/src/parse_variables.cpp index 432d4eb0fd..d8e7b5814f 100644 --- a/plugins/Variables/src/parse_variables.cpp +++ b/plugins/Variables/src/parse_variables.cpp @@ -126,13 +126,12 @@ static TCHAR *parseGet(ARGUMENTSINFO *ai) return searchVariableRegister(ai->targv[1]); } -int registerVariablesTokens() +void registerVariablesTokens() { - registerIntToken(_T(GET), parseGet, TRF_FUNCTION, LPGEN("Variables")"\t(x)\t"LPGEN("variable set by put(s) with name x")); - registerIntToken(_T(PUT), parsePut, TRF_FUNCTION, LPGEN("Variables")"\t(x,y)\t"LPGEN("x, and stores y as variable named x"));//TRF_UNPARSEDARGS); - registerIntToken(_T(PUTS), parsePuts, TRF_FUNCTION, LPGEN("Variables")"\t(x,y)\t"LPGEN("only stores y as variables x"));//TRF_UNPARSEDARGS); + registerIntToken(GET, parseGet, TRF_FUNCTION, LPGEN("Variables")"\t(x)\t"LPGEN("variable set by put(s) with name x")); + registerIntToken(PUT, parsePut, TRF_FUNCTION, LPGEN("Variables")"\t(x,y)\t"LPGEN("x, and stores y as variable named x"));//TRF_UNPARSEDARGS); + registerIntToken(PUTS, parsePuts, TRF_FUNCTION, LPGEN("Variables")"\t(x,y)\t"LPGEN("only stores y as variables x"));//TRF_UNPARSEDARGS); InitializeCriticalSection(&csVarRegister); - return 0; } void unregisterVariablesTokens() diff --git a/plugins/Variables/src/parse_variables.h b/plugins/Variables/src/parse_variables.h index b21b35a987..ce22fd3618 100644 --- a/plugins/Variables/src/parse_variables.h +++ b/plugins/Variables/src/parse_variables.h @@ -23,7 +23,7 @@ typedef struct { DWORD dwOwnerThread; } VARIABLEREGISTER; -#define PUT "put" -#define PUTS "puts" -#define GET "get" +#define PUT _T("put") +#define PUTS _T("puts") +#define GET _T("get") diff --git a/plugins/Variables/src/variables.h b/plugins/Variables/src/variables.h index ea8b5057ae..68acb88ad8 100644 --- a/plugins/Variables/src/variables.h +++ b/plugins/Variables/src/variables.h @@ -29,6 +29,9 @@ #include #include +#include +#include + #include #include #include @@ -63,7 +66,6 @@ #include "parse_str.h" #include "parse_system.h" #include "parse_variables.h" -#include "parse_xml.h" #define MODULENAME "Variables" @@ -84,8 +86,30 @@ #define COMMENT_STRING "#" // special tokens -#define SUBJECT "subject" -#define MIR_EXTRATEXT "extratext" +#define SUBJECT _T("subject") +#define MIR_EXTRATEXT _T("extratext") + +#define VAR_HELP_TEXT LPGENT("--- Special characters ---\r\n\r\n\ +The following characters have a special meaning in a formatting string:\r\n\r\n\ +?()\r\n\ +This will parse the function given the arguments, the result will be parsed again. Example: Today is ?cdate(yyyy/MM/dd).\r\n\r\n\ +!()\r\n\ +This will parse the function given the arguments, the result will not be parsed again. Example: Message waiting: !message(,first,rcvd,unread).\r\n\r\n\ +%%\r\n\ +This will parse the given field. Example: I installed Miranda at: %mirandapath%.\r\n\r\n\ +``\r\n\ +This will not parse the given string, any function, field or special character in the string will shown in the result without being translated. Example: Use `%mirandapath%` to show the installation path.\r\n\r\n\ +#\r\n\ +This will add a comment in the formatting string. Everything from the # character to the end of the line will be removed. Example: %dbprofile% #this is a useless comment.\r\n\r\n\r\n\ +--- Contacts ---\r\n\r\n\ +Whenever a functions requires a contact as an argument, you can specify it in two ways:\r\n\r\n\ +(1) Using a unique id (UIN for ICQ, email for MSN) or, a protocol id followed by a unique id in the form , for example or .\r\n\r\n\ +(2) Using the contact function:\r\n\ +?contact(x,y)\r\n\ +A contact will be searched which will have value x for its property y, y can be one of the following:\r\n\ +first, last, nick, email, id or display\r\n\r\n\ +For example: ?contact(miranda@hotmail.com,email) or ?contact(Miranda,nick). The contact function will return either a unique contact according to the arguments or nothing if none or multiple contacts exists with the given property.\ +") // options #define IDT_PARSE 1 @@ -153,32 +177,32 @@ int getContactFromString( CONTACTSINFO* ); int initContactModule(); int deinitContactModule(); // alias -int registerAliasTokens(); +void registerAliasTokens(); void unregisterAliasTokens(); // system -int registerSystemTokens(); +void registerSystemTokens(); // external -int registerExternalTokens(); +void registerExternalTokens(); // miranda -int registerMirandaTokens(); +void registerMirandaTokens(); // str -int registerStrTokens(); +void registerStrTokens(); // variables -int registerVariablesTokens(); +void registerVariablesTokens(); void unregisterVariablesTokens(); int clearVariableRegister(bool bAll); // logic -int registerLogicTokens(); +void registerLogicTokens(); // math -int registerMathTokens(); +void registerMathTokens(); // metacontacts -int registerMetaContactsTokens(); +void registerMetaContactsTokens(); // options -int OptionsInit(WPARAM wParam, LPARAM lParam); +int OptionsInit(WPARAM wParam, LPARAM); // reg exp -int registerRegExpTokens(); +void registerRegExpTokens(); // inet -int registerInetTokens(); +void registerInetTokens(); // help INT_PTR showHelpService(WPARAM wParam, LPARAM lParam); INT_PTR showHelpExService(WPARAM wParam, LPARAM lParam); @@ -187,5 +211,3 @@ int iconsChanged(WPARAM wParam, LPARAM lParam); int ttoi(TCHAR *string); TCHAR *itot(int num); - -extern DWORD g_mirandaVersion; -- cgit v1.2.3