summaryrefslogtreecommitdiff
path: root/plugins/TipperYM/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-10-03 12:39:25 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-10-03 12:39:25 +0300
commitaad7cea75cbd6394cd9c61d33997b77e3e4e6424 (patch)
tree22521ffd4aa21e871cd9cf3f05bb40b5ba10b423 /plugins/TipperYM/src
parent4cd0aa5643498a9be9a2fc3ed6e1a88807d4dc8f (diff)
fixes #3698 (Tipper: Не показывает текст в подсказках контактного листа)
Diffstat (limited to 'plugins/TipperYM/src')
-rw-r--r--plugins/TipperYM/src/options.cpp249
-rw-r--r--plugins/TipperYM/src/popwin.cpp5
-rw-r--r--plugins/TipperYM/src/preset_items.cpp123
-rw-r--r--plugins/TipperYM/src/preset_items.h58
-rw-r--r--plugins/TipperYM/src/stdafx.h1
-rw-r--r--plugins/TipperYM/src/version.h2
6 files changed, 193 insertions, 245 deletions
diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp
index afcd85ba5d..5cb38b172a 100644
--- a/plugins/TipperYM/src/options.cpp
+++ b/plugins/TipperYM/src/options.cpp
@@ -23,18 +23,6 @@ Boston, MA 02111-1307, USA.
OPTIONS opt;
ICONSTATE exIcons[EXICONS_COUNT];
-// display item types
-static struct
-{
- DisplayItemType type;
- wchar_t *title;
-}
-displayItemTypes[] = {
- { DIT_ALL, LPGENW("Show for all contact types") },
- { DIT_CONTACTS, LPGENW("Show only for contacts") },
- { DIT_CHATS, LPGENW("Show only for chatrooms") }
-};
-
// tray tooltip items
static wchar_t *trayTipItems[] =
{
@@ -62,6 +50,114 @@ static wchar_t *extraIconName[] =
LPGENW("Client")
};
+// preset items
+
+#define MAX_PRESET_SUBST_COUNT 3
+
+struct PRESETITEM
+{
+ const char *szID;
+ const wchar_t *swzName;
+ const wchar_t *swzLabel;
+ const wchar_t *swzValue;
+ const char *szNeededSubst[MAX_PRESET_SUBST_COUNT];
+};
+
+static PRESETITEM presetItems[] =
+{
+ { "account", LPGENW("Account"), LPGENW("Account:"), L"%sys:account%" },
+ { "birth", LPGENW("Birthday"), LPGENW("Birthday:"), L"%birthday_date% (%birthday_age%) @ Next: %birthday_next%", "birthdate", "birthage", "birthnext" },
+ { "client", LPGENW("Client"), LPGENW("Client:"), L"%raw:/MirVer%" },
+ { "email", LPGENW("Email"), LPGENW("Email:"), L"%raw:/e-mail%" },
+ { "gender", LPGENW("Gender"), LPGENW("Gender:"), L"%gender%" },
+ { "homepage", LPGENW("Homepage"), LPGENW("Homepage:"), L"%raw:/Homepage%" },
+ { "id", LPGENW("Identifier"), L"%sys:uidname|UID^!MetaContacts%:", L"%sys:uid%" },
+ { "idle", LPGENW("Idle"), LPGENW("Idle:"), L"%idle% (%idle_diff% ago)", "idle", "idlediff" },
+ { "ip", L"IP", L"IP:", L"%ip%", "ip" },
+ { "ipint", LPGENW("IP internal"), LPGENW("IP internal:"), L"%ip_internal%", "ipint" },
+ { "lastmsg", LPGENW("Last message"), LPGENW("Last message: (%sys:last_msg_reltime% ago)"), L"%sys:last_msg%" },
+ { "listening", LPGENW("Listening to"), LPGENW("Listening to:"), L"%raw:/ListeningTo%" },
+ { "name", LPGENW("Name"), LPGENW("Name:"), L"%raw:/FirstName|% %raw:/LastName%" },
+ { "received", LPGENW("Number of received messages"), LPGENW("Number of msg [IN]:"), L"%sys:msg_count_in%" },
+ { "sended", LPGENW("Number of sent messages"), LPGENW("Number of msg [OUT]:"), L"%sys:msg_count_out%" },
+ { "status", LPGENW("Status"), LPGENW("Status:"), L"%Status%", "status" },
+ { "statusmsg", LPGENW("Status message"), LPGENW("Status message:"), L"%sys:status_msg%" },
+ { "time", LPGENW("Contact time"), LPGENW("Time:"), L"%sys:time%" },
+ { "xtitle", LPGENW("xStatus title"), LPGENW("xStatus title:"), L"%xsname%", "xname" },
+ { "xtext", LPGENW("xStatus text"), LPGENW("xStatus text:"), L"%raw:/XStatusMsg%" },
+ { "acttitle", LPGENW("[jabber.dll] Activity title"), LPGENW("Activity title:"), L"%raw:AdvStatus/?dbsetting(%subject%,Protocol,p)/activity/title%" },
+ { "acttext", LPGENW("[jabber.dll] Activity text"), LPGENW("Activity text:"), L"%raw:AdvStatus/?dbsetting(%subject%,Protocol,p)/activity/text%" },
+ { "lastseentime", LPGENW("[seenplugin.dll] Last seen time"), LPGENW("Last seen time:"), L"%lastseen_date% @ %lastseen_time%", "lsdate", "lstime" },
+ { "lastseenstatus", LPGENW("[seenplugin.dll] Last seen status"), LPGENW("Last seen status:"), L"%lastseen_status% (%lastseen_ago% ago)", "lsstatus", "lsago" },
+ { "cond", LPGENW("[weather.dll] Condition"), LPGENW("Condition:"), L"%raw:Current/Condition%" },
+ { "humidity", LPGENW("[weather.dll] Humidity"), LPGENW("Humidity:"), L"%raw:Current/Humidity%" },
+ { "minmaxtemp", LPGENW("[weather.dll] Max/Min temperature"), LPGENW("Max/Min:"), L"%raw:Current/High%/%raw:Current/Low%" },
+ { "moon", LPGENW("[weather.dll] Moon"), LPGENW("Moon:"), L"%raw:Current/Moon%" },
+ { "pressure", LPGENW("[weather.dll] Pressure"), LPGENW("Pressure:"), L"%raw:Current/Pressure% (%raw:Current/Pressure Tendency%)" },
+ { "sunrise", LPGENW("[weather.dll] Sunrise"), LPGENW("Sunrise:"), L"%raw:Current/Sunrise%" },
+ { "sunset", LPGENW("[weather.dll] Sunset"), LPGENW("Sunset:"), L"%raw:Current/Sunset%" },
+ { "temp", LPGENW("[weather.dll] Temperature"), LPGENW("Temperature:"), L"%raw:Current/Temperature%" },
+ { "uptime", LPGENW("[weather.dll] Update time"), LPGENW("Update time:"), L"%raw:Current/Update%" },
+ { "uvindex", LPGENW("[weather.dll] UV Index"), LPGENW("UV Index:"), L"%raw:Current/UV% - %raw:Current/UVI%" },
+ { "vis", LPGENW("[weather.dll] Visibility"), LPGENW("Visibility:"), L"%raw:Current/Visibility%" },
+ { "wind", LPGENW("[weather.dll] Wind"), LPGENW("Wind:"), L"%raw:Current/Wind Direction% (%raw:Current/Wind Direction DEG%)/%raw:Current/Wind Speed%" }
+};
+
+PRESETITEM* GetPresetItemByName(const char *szName)
+{
+ for (auto &it : presetItems)
+ if (mir_strcmp(it.szID, szName) == 0)
+ return &it;
+
+ return nullptr;
+}
+
+// preset substitutions
+
+struct PRESETSUBST
+{
+ const char *szID;
+ const wchar_t *swzName;
+ const char *szModuleName;
+ const char *szSettingName;
+ int iTranslateFuncId;
+};
+
+PRESETSUBST presetSubsts[] =
+{
+ { "gender", L"gender", nullptr, "Gender", 5 },
+ { "status", L"Status", nullptr, "Status", 1 },
+ { "ip", L"ip", nullptr, "IP", 7 },
+ { "ipint", L"ip_internal", nullptr, "RealIP", 7 },
+ { "idle", L"idle", nullptr, "IdleTS", 2 },
+ { "idlediff", L"idle_diff", nullptr, "IdleTS", 3 },
+ { "xname", L"xsname", nullptr, "XStatusName", 17 },
+ { "lsdate", L"lastseen_date", "SeenModule", nullptr, 8 },
+ { "lstime", L"lastseen_time", "SeenModule", nullptr, 10 },
+ { "lsstatus", L"lastseen_status", "SeenModule", "OldStatus", 1 },
+ { "lsago", L"lastseen_ago", "SeenModule", "seenTS", 3 },
+ { "birthdate", L"birthday_date", nullptr, "Birth", 8 },
+ { "birthage", L"birthday_age", nullptr, "Birth", 9 },
+ { "birthnext", L"birthday_next", nullptr, "Birth", 12 },
+ { "logondate", L"logon_date", nullptr, "LogonTS", 15 },
+ { "logontime", L"logon_time", nullptr, "LogonTS", 13 },
+ { "logonago", L"logon_ago", nullptr, "LogonTS", 3 },
+};
+
+PRESETSUBST* GetPresetSubstByName(const char *szName)
+{
+ if (!szName)
+ return nullptr;
+
+ for (auto &it : presetSubsts)
+ if (mir_strcmp(it.szID, szName) == 0)
+ return &it;
+
+ return nullptr;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern int IsTrayProto(const wchar_t *swzProto, BOOL bExtendedTip)
{
if (swzProto == nullptr)
@@ -83,11 +179,36 @@ extern int IsTrayProto(const wchar_t *swzProto, BOOL bExtendedTip)
return result;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// default items
+
+struct
+{
+ char *szName;
+ bool bValueNewline;
+}
+static defaultItemList[] =
+{
+ "statusmsg", true,
+ "-", false,
+ "lastmsg", true,
+ "-", false,
+ "client", false,
+ "homepage", false,
+ "email", false,
+ "birth", false,
+ "name", false,
+ "-", false,
+ "time", false,
+ "id", false,
+ "status", false,
+};
+
void CreateDefaultItems()
{
- for (int i = 0; defaultItemList[i].szName; i++) {
- if (defaultItemList[i].szName[0] == '-') {
- DIListNode *di_node = (DIListNode *)mir_alloc(sizeof(DIListNode));
+ for (auto &it : defaultItemList) {
+ if (it.szName[0] == '-') {
+ auto *di_node = (DIListNode *)mir_calloc(sizeof(DIListNode));
wcsncpy(di_node->di.swzLabel, L"", LABEL_LEN);
wcsncpy(di_node->di.swzValue, L"", VALUE_LEN);
di_node->di.bLineAbove = true;
@@ -98,28 +219,28 @@ void CreateDefaultItems()
opt.iDiCount++;
}
else {
- PRESETITEM *item = GetPresetItemByName(defaultItemList[i].szName);
- if (item == nullptr) continue;
+ auto *item = GetPresetItemByName(it.szName);
+ if (item == nullptr)
+ continue;
for (int j = 0; j < MAX_PRESET_SUBST_COUNT; j++) {
- PRESETSUBST *subst = GetPresetSubstByName(item->szNeededSubst[j]);
- if (subst == nullptr) continue;
-
- DSListNode *ds_node = (DSListNode *)mir_alloc(sizeof(DSListNode));
- wcsncpy(ds_node->ds.swzName, subst->swzName, LABEL_LEN);
- ds_node->ds.type = subst->type;
- strncpy(ds_node->ds.szSettingName, subst->szSettingName, SETTING_NAME_LEN);
- ds_node->ds.iTranslateFuncId = subst->iTranslateFuncId;
- ds_node->next = opt.dsList;
- opt.dsList = ds_node;
- opt.iDsCount++;
+ if (auto *subst = GetPresetSubstByName(item->szNeededSubst[j])) {
+ auto *ds_node = (DSListNode *)mir_calloc(sizeof(DSListNode));
+ wcsncpy(ds_node->ds.swzName, subst->swzName, LABEL_LEN);
+ ds_node->ds.type = subst->szModuleName == nullptr ? DVT_PROTODB : DVT_DB;
+ strncpy(ds_node->ds.szSettingName, subst->szSettingName, SETTING_NAME_LEN);
+ ds_node->ds.iTranslateFuncId = subst->iTranslateFuncId;
+ ds_node->next = opt.dsList;
+ opt.dsList = ds_node;
+ opt.iDsCount++;
+ }
}
- DIListNode *di_node = (DIListNode *)mir_alloc(sizeof(DIListNode));
+ auto *di_node = (DIListNode *)mir_calloc(sizeof(DIListNode));
wcsncpy(di_node->di.swzLabel, TranslateW(item->swzLabel), LABEL_LEN);
wcsncpy(di_node->di.swzValue, item->swzValue, VALUE_LEN);
di_node->di.bLineAbove = false;
- di_node->di.bValueNewline = defaultItemList[i].bValueNewline;
+ di_node->di.bValueNewline = it.bValueNewline;
di_node->di.bIsVisible = true;
di_node->di.bParseTipperVarsFirst = false;
di_node->next = opt.diList;
@@ -388,7 +509,7 @@ void LoadOptions()
opt.iDsCount = db_get_w(0, MODULE_ITEMS, "DSNumValues", 0);
for (i = opt.iDsCount - 1; i >= 0; i--) {
- ds_node = (DSListNode *)mir_alloc(sizeof(DSListNode));
+ ds_node = (DSListNode *)mir_calloc(sizeof(DSListNode));
if (LoadDS(&ds_node->ds, i)) {
ds_node->next = opt.dsList;
opt.dsList = ds_node;
@@ -405,7 +526,7 @@ void LoadOptions()
opt.bWaitForStatusMsg = false;
opt.iDiCount = db_get_w(0, MODULE_ITEMS, "DINumValues", 0);
for (i = opt.iDiCount - 1; i >= 0; i--) {
- di_node = (DIListNode *)mir_alloc(sizeof(DIListNode));
+ di_node = (DIListNode *)mir_calloc(sizeof(DIListNode));
if (LoadDI(&di_node->di, i)) {
di_node->next = opt.diList;
opt.diList = di_node;
@@ -440,11 +561,11 @@ void LoadOptions()
// last message item
if (di_node) {
- di_node->next = (DIListNode *)mir_alloc(sizeof(DIListNode));
+ di_node->next = (DIListNode *)mir_calloc(sizeof(DIListNode));
di_node = di_node->next;
}
else {
- opt.diList = (DIListNode *)mir_alloc(sizeof(DIListNode));
+ opt.diList = (DIListNode *)mir_calloc(sizeof(DIListNode));
di_node = opt.diList;
}
@@ -465,11 +586,11 @@ void LoadOptions()
// status message item
if (di_node) {
- di_node->next = (DIListNode *)mir_alloc(sizeof(DIListNode));
+ di_node->next = (DIListNode *)mir_calloc(sizeof(DIListNode));
di_node = di_node->next;
}
else {
- opt.diList = (DIListNode *)mir_alloc(sizeof(DIListNode));
+ opt.diList = (DIListNode *)mir_calloc(sizeof(DIListNode));
di_node = opt.diList;
}
@@ -566,6 +687,20 @@ void LoadOptions()
}
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// Item editor dialog
+
+struct
+{
+ DisplayItemType type;
+ wchar_t *title;
+}
+static displayItemTypes[] = {
+ { DIT_ALL, LPGENW("Show for all contact types") },
+ { DIT_CONTACTS, LPGENW("Show only for contacts") },
+ { DIT_CHATS, LPGENW("Show only for chatrooms") },
+};
+
INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
DISPLAYITEM *di = (DISPLAYITEM *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -590,8 +725,8 @@ INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
CheckDlgButton(hwndDlg, IDC_CHK_VALNEWLINE, di->bValueNewline ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CHK_PARSETIPPERFIRST, di->bParseTipperVarsFirst ? BST_CHECKED : BST_UNCHECKED);
- for (int i = 0; presetItems[i].szID; i++)
- SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_ADDSTRING, 0, (LPARAM)TranslateW(presetItems[i].swzName));
+ for (auto &it : presetItems)
+ SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_ADDSTRING, 0, (LPARAM)TranslateW(it.swzName));
variables_skin_helpbutton(hwndDlg, IDC_BTN_VARIABLE);
@@ -619,15 +754,14 @@ INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (sel != CB_ERR) {
wchar_t buff[256];
SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_GETLBTEXT, sel, (LPARAM)buff);
- for (int i = 0; presetItems[i].szID; i++) {
- if (mir_wstrcmp(buff, TranslateW(presetItems[i].swzName)) == 0) {
- if (presetItems[i].szNeededSubst[0])
- EndDialog(hwndDlg, IDPRESETITEM + i);
+ for (auto &it : presetItems)
+ if (mir_wstrcmp(buff, TranslateW(it.swzName)) == 0) {
+ if (it.szNeededSubst[0])
+ EndDialog(hwndDlg, IDPRESETITEM + int(&it - presetItems));
else
EndDialog(hwndDlg, IDOK);
break;
}
- }
}
else EndDialog(hwndDlg, IDOK);
}
@@ -651,13 +785,12 @@ INT_PTR CALLBACK DlgProcAddItem(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (sel != CB_ERR) {
wchar_t buff[256];
SendDlgItemMessage(hwndDlg, IDC_CMB_PRESETITEMS, CB_GETLBTEXT, sel, (LPARAM)buff);
- for (int i = 0; presetItems[i].szID; i++) {
- if (mir_wstrcmp(buff, TranslateW(presetItems[i].swzName)) == 0) {
- SetDlgItemText(hwndDlg, IDC_ED_LABEL, TranslateW(presetItems[i].swzLabel));
- SetDlgItemText(hwndDlg, IDC_ED_VALUE, presetItems[i].swzValue);
+ for (auto &it : presetItems)
+ if (mir_wstrcmp(buff, TranslateW(it.swzName)) == 0) {
+ SetDlgItemText(hwndDlg, IDC_ED_LABEL, TranslateW(it.swzLabel));
+ SetDlgItemText(hwndDlg, IDC_ED_VALUE, it.swzValue);
break;
}
- }
}
}
}
@@ -821,7 +954,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
DIListNode *di_node = opt.diList, *di_value;
while (di_node) {
- di_value = (DIListNode *)mir_alloc(sizeof(DIListNode));
+ di_value = (DIListNode *)mir_calloc(sizeof(DIListNode));
*di_value = *di_node;
tvi.item.lParam = (LPARAM)di_value;
tvi.item.state = INDEXTOSTATEIMAGEMASK(di_value->di.bIsVisible ? 2 : 1);
@@ -832,7 +965,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
DSListNode *ds_node = opt.dsList, *ds_value;
while (ds_node) {
- ds_value = (DSListNode *)mir_alloc(sizeof(DSListNode));
+ ds_value = (DSListNode *)mir_calloc(sizeof(DSListNode));
*ds_value = *ds_node;
int index = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_ADDSTRING, 0, (LPARAM)ds_value->ds.swzName);
SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_SETITEMDATA, index, (LPARAM)ds_value);
@@ -902,7 +1035,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
switch (LOWORD(wParam)) {
case IDC_BTN_ADD:
{
- DIListNode *di_value = (DIListNode *)mir_alloc(sizeof(DIListNode));
+ DIListNode *di_value = (DIListNode *)mir_calloc(sizeof(DIListNode));
memset(di_value, 0, sizeof(DIListNode));
di_value->di.bIsVisible = true;
@@ -935,10 +1068,10 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
if (subst == nullptr)
break;
if (SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_FINDSTRING, -1, (LPARAM)subst->swzName) == LB_ERR) {
- DSListNode *ds_value = (DSListNode *)mir_alloc(sizeof(DSListNode));
+ DSListNode *ds_value = (DSListNode *)mir_calloc(sizeof(DSListNode));
memset(ds_value, 0, sizeof(DSListNode));
ds_value->next = nullptr;
- ds_value->ds.type = subst->type;
+ ds_value->ds.type = subst->szModuleName == nullptr ? DVT_PROTODB : DVT_DB;
wcsncpy(ds_value->ds.swzName, subst->swzName, LABEL_LEN - 1);
if (ds_value->ds.type == DVT_DB && subst->szModuleName)
@@ -966,7 +1099,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
}
case IDC_BTN_SEPARATOR:
{
- DIListNode *di_value = (DIListNode *)mir_alloc(sizeof(DIListNode));
+ DIListNode *di_value = (DIListNode *)mir_calloc(sizeof(DIListNode));
memset(di_value, 0, sizeof(DIListNode));
di_value->di.bIsVisible = true;
di_value->di.bLineAbove = true;
@@ -1073,7 +1206,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
}
case IDC_BTN_ADD2:
{
- DSListNode *ds_value = (DSListNode *)mir_alloc(sizeof(DSListNode));
+ DSListNode *ds_value = (DSListNode *)mir_calloc(sizeof(DSListNode));
memset(ds_value, 0, sizeof(DSListNode));
if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SUBST), hwndDlg, DlgProcAddSubst, (LPARAM)&ds_value->ds) == IDOK) {
int index = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_ADDSTRING, 0, (LPARAM)ds_value->ds.swzName);
@@ -1147,7 +1280,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
while (item.hItem != nullptr) {
if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item)) {
di_node = (DIListNode *)item.lParam;
- di_value = (DIListNode *)mir_alloc(sizeof(DIListNode));
+ di_value = (DIListNode *)mir_calloc(sizeof(DIListNode));
*di_value = *di_node;
di_value->next = opt.diList;
opt.diList = di_value;
@@ -1166,7 +1299,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
opt.iDsCount = SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETCOUNT, 0, 0);
for (int i = opt.iDsCount - 1; i >= 0; i--) {
ds_node = (DSListNode *)SendDlgItemMessage(hwndDlg, IDC_LST_SUBST, LB_GETITEMDATA, i, 0);
- ds_value = (DSListNode *)mir_alloc(sizeof(DSListNode));
+ ds_value = (DSListNode *)mir_calloc(sizeof(DSListNode));
*ds_value = *ds_node;
ds_value->next = opt.dsList;
opt.dsList = ds_value;
@@ -1479,7 +1612,7 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
exIcons[i].vis = opt.exIconsVis[i];
}
- dat = (EXTRAICONDATA *)mir_alloc(sizeof(EXTRAICONDATA));
+ dat = (EXTRAICONDATA *)mir_calloc(sizeof(EXTRAICONDATA));
dat->bDragging = false;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp
index 799dc9bee7..3feb8c30ef 100644
--- a/plugins/TipperYM/src/popwin.cpp
+++ b/plugins/TipperYM/src/popwin.cpp
@@ -285,11 +285,8 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
if (pwd->iRowCount == 0) {
// single item
pwd->iRowCount = 1;
- pwd->rows = (RowData *)mir_alloc(sizeof(RowData));
- pwd->rows[0].bLineAbove = pwd->rows[0].bValueNewline = false;
- pwd->rows[0].swzLabel = nullptr;
+ pwd->rows = (RowData *)mir_calloc(sizeof(RowData));
pwd->rows[0].swzValue = swzText;
- pwd->rows[0].spi = nullptr;
}
}
}
diff --git a/plugins/TipperYM/src/preset_items.cpp b/plugins/TipperYM/src/preset_items.cpp
deleted file mode 100644
index f06322276a..0000000000
--- a/plugins/TipperYM/src/preset_items.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
-Copyright (C) 2006-2007 Scott Ellis
-Copyright (C) 2007-2011 Jan Holub
-
-This is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-This 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with this file; see the file license.txt. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-*/
-
-#include "stdafx.h"
-
-PRESETITEM presetItems[] =
-{
- "account", LPGENW("Account"), LPGENW("Account:"), L"%sys:account%", nullptr, nullptr, nullptr,
- "birth", LPGENW("Birthday"), LPGENW("Birthday:"), L"%birthday_date% (%birthday_age%) @ Next: %birthday_next%", "birthdate", "birthage", "birthnext",
- "client", LPGENW("Client"), LPGENW("Client:"), L"%raw:/MirVer%", nullptr, nullptr, nullptr,
- "email", LPGENW("Email"), LPGENW("Email:"), L"%raw:/e-mail%", nullptr, nullptr, nullptr,
- "gender", LPGENW("Gender"), LPGENW("Gender:"), L"%gender%", nullptr, nullptr, nullptr,
- "homepage", LPGENW("Homepage"), LPGENW("Homepage:"), L"%raw:/Homepage%", nullptr, nullptr, nullptr,
- "id", LPGENW("Identifier"), L"%sys:uidname|UID^!MetaContacts%:", L"%sys:uid%", nullptr, nullptr, nullptr,
- "idle", LPGENW("Idle"), LPGENW("Idle:"), L"%idle% (%idle_diff% ago)", "idle", "idlediff", nullptr,
- "ip", L"IP", L"IP:", L"%ip%", "ip", nullptr, nullptr,
- "ipint", LPGENW("IP internal"), LPGENW("IP internal:"), L"%ip_internal%", "ipint", nullptr, nullptr,
- "lastmsg", LPGENW("Last message"), LPGENW("Last message: (%sys:last_msg_reltime% ago)"), L"%sys:last_msg%", nullptr, nullptr, nullptr,
- "listening", LPGENW("Listening to"), LPGENW("Listening to:"), L"%raw:/ListeningTo%", nullptr, nullptr, nullptr,
- "name", LPGENW("Name"), LPGENW("Name:"), L"%raw:/FirstName|% %raw:/LastName%", nullptr, nullptr, nullptr,
- "received", LPGENW("Number of received messages"), LPGENW("Number of msg [IN]:"), L"%sys:msg_count_in%", nullptr, nullptr, nullptr,
- "sended", LPGENW("Number of sent messages"), LPGENW("Number of msg [OUT]:"), L"%sys:msg_count_out%", nullptr, nullptr, nullptr,
- "status", LPGENW("Status"), LPGENW("Status:"), L"%Status%", "status", nullptr, nullptr,
- "statusmsg", LPGENW("Status message"), LPGENW("Status message:"), L"%sys:status_msg%", nullptr, nullptr, nullptr,
- "time", LPGENW("Contact time"), LPGENW("Time:"), L"%sys:time%", nullptr, nullptr, nullptr,
- "xtitle", LPGENW("xStatus title"), LPGENW("xStatus title:"), L"%xsname%", "xname", nullptr, nullptr,
- "xtext", LPGENW("xStatus text"), LPGENW("xStatus text:"), L"%raw:/XStatusMsg%", nullptr, nullptr, nullptr,
- "acttitle", LPGENW("[jabber.dll] Activity title"), LPGENW("Activity title:"), L"%raw:AdvStatus/?dbsetting(%subject%,Protocol,p)/activity/title%", nullptr, nullptr, nullptr,
- "acttext", LPGENW("[jabber.dll] Activity text"), LPGENW("Activity text:"), L"%raw:AdvStatus/?dbsetting(%subject%,Protocol,p)/activity/text%", nullptr, nullptr, nullptr,
- "lastseentime", LPGENW("[seenplugin.dll] Last seen time"), LPGENW("Last seen time:"), L"%lastseen_date% @ %lastseen_time%", "lsdate", "lstime", nullptr,
- "lastseenstatus", LPGENW("[seenplugin.dll] Last seen status"), LPGENW("Last seen status:"), L"%lastseen_status% (%lastseen_ago% ago)", "lsstatus", "lsago", nullptr,
- "cond", LPGENW("[weather.dll] Condition"), LPGENW("Condition:"), L"%raw:Current/Condition%", nullptr, nullptr, nullptr,
- "humidity", LPGENW("[weather.dll] Humidity"), LPGENW("Humidity:"), L"%raw:Current/Humidity%", nullptr, nullptr, nullptr,
- "minmaxtemp", LPGENW("[weather.dll] Max/Min temperature"), LPGENW("Max/Min:"), L"%raw:Current/High%/%raw:Current/Low%", nullptr, nullptr, nullptr,
- "moon", LPGENW("[weather.dll] Moon"), LPGENW("Moon:"), L"%raw:Current/Moon%", nullptr, nullptr, nullptr,
- "pressure", LPGENW("[weather.dll] Pressure"), LPGENW("Pressure:"), L"%raw:Current/Pressure% (%raw:Current/Pressure Tendency%)", nullptr, nullptr, nullptr,
- "sunrise", LPGENW("[weather.dll] Sunrise"), LPGENW("Sunrise:"), L"%raw:Current/Sunrise%", nullptr, nullptr, nullptr,
- "sunset", LPGENW("[weather.dll] Sunset"), LPGENW("Sunset:"), L"%raw:Current/Sunset%", nullptr, nullptr, nullptr,
- "temp", LPGENW("[weather.dll] Temperature"), LPGENW("Temperature:"), L"%raw:Current/Temperature%", nullptr, nullptr, nullptr,
- "uptime", LPGENW("[weather.dll] Update time"), LPGENW("Update time:"), L"%raw:Current/Update%", nullptr, nullptr, nullptr,
- "uvindex", LPGENW("[weather.dll] UV Index"), LPGENW("UV Index:"), L"%raw:Current/UV% - %raw:Current/UVI%", nullptr, nullptr, nullptr,
- "vis", LPGENW("[weather.dll] Visibility"), LPGENW("Visibility:"), L"%raw:Current/Visibility%", nullptr, nullptr, nullptr,
- "wind", LPGENW("[weather.dll] Wind"), LPGENW("Wind:"), L"%raw:Current/Wind Direction% (%raw:Current/Wind Direction DEG%)/%raw:Current/Wind Speed%", nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr
-};
-
-PRESETSUBST presetSubsts[] =
-{
- "gender", L"gender", DVT_PROTODB, nullptr, "Gender", 5,
- "status", L"Status", DVT_PROTODB, nullptr, "Status", 1,
- "ip", L"ip", DVT_PROTODB, nullptr, "IP", 7,
- "ipint", L"ip_internal", DVT_PROTODB, nullptr, "RealIP", 7,
- "idle", L"idle", DVT_PROTODB, nullptr, "IdleTS", 2,
- "idlediff", L"idle_diff", DVT_PROTODB, nullptr, "IdleTS", 3,
- "xname", L"xsname", DVT_PROTODB, nullptr, "XStatusName", 17,
- "lsdate", L"lastseen_date", DVT_DB, "SeenModule", nullptr, 8,
- "lstime", L"lastseen_time", DVT_DB, "SeenModule", nullptr, 10,
- "lsstatus", L"lastseen_status", DVT_DB, "SeenModule", "OldStatus", 1,
- "lsago", L"lastseen_ago", DVT_DB, "SeenModule", "seenTS", 3,
- "birthdate", L"birthday_date", DVT_PROTODB, nullptr, "Birth", 8,
- "birthage", L"birthday_age", DVT_PROTODB, nullptr, "Birth", 9,
- "birthnext", L"birthday_next", DVT_PROTODB, nullptr, "Birth", 12,
- "logondate", L"logon_date", DVT_PROTODB, nullptr, "LogonTS", 15,
- "logontime", L"logon_time", DVT_PROTODB, nullptr, "LogonTS", 13,
- "logonago", L"logon_ago", DVT_PROTODB, nullptr, "LogonTS", 3,
- nullptr, nullptr, DVT_DB, nullptr, nullptr, 0
-};
-
-DEFAULTITEM defaultItemList[] =
-{
- "statusmsg", true,
- "-", false,
- "lastmsg", true ,
- "-", false,
- "client", false,
- "homepage", false,
- "email", false,
- "birth", false,
- "name", false,
- "-", false,
- "time", false,
- "id", false,
- "status", false,
- nullptr,0
-};
-
-PRESETITEM* GetPresetItemByName(char *szName)
-{
- for (int i = 0; presetItems[i].szID; i++) {
- if (mir_strcmp(presetItems[i].szID, szName) == 0)
- return &presetItems[i];
- }
-
- return nullptr;
-}
-
-PRESETSUBST* GetPresetSubstByName(char *szName)
-{
- if (!szName) return nullptr;
- for (int i = 0; presetSubsts[i].szID; i++) {
- if (mir_strcmp(presetSubsts[i].szID, szName) == 0)
- return &presetSubsts[i];
- }
-
- return nullptr;
-}
diff --git a/plugins/TipperYM/src/preset_items.h b/plugins/TipperYM/src/preset_items.h
deleted file mode 100644
index 83e73283fc..0000000000
--- a/plugins/TipperYM/src/preset_items.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-Copyright (C) 2006-2007 Scott Ellis
-Copyright (C) 2007-2011 Jan Holub
-
-This is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-This 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with this file; see the file license.txt. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-*/
-
-#ifndef _PRESETITEMS_INC
-#define _PRESETITEMS_INC
-
-#define MAX_PRESET_SUBST_COUNT 3
-
-struct PRESETITEM
-{
- char *szID;
- wchar_t *swzName;
- wchar_t *swzLabel;
- wchar_t *swzValue;
- char *szNeededSubst[MAX_PRESET_SUBST_COUNT];
-};
-
-struct PRESETSUBST
-{
- char *szID;
- wchar_t *swzName;
- DisplaySubstType type;
- char *szModuleName;
- char *szSettingName;
- int iTranslateFuncId;
-};
-
-struct DEFAULTITEM
-{
- char *szName;
- bool bValueNewline;
-};
-
-extern PRESETITEM presetItems[];
-extern PRESETSUBST presetSubsts[];
-extern DEFAULTITEM defaultItemList[];
-
-PRESETITEM *GetPresetItemByName(char *szName);
-PRESETSUBST *GetPresetSubstByName(char *szName);
-
-#endif \ No newline at end of file
diff --git a/plugins/TipperYM/src/stdafx.h b/plugins/TipperYM/src/stdafx.h
index 0d20d28662..9e0a280fa9 100644
--- a/plugins/TipperYM/src/stdafx.h
+++ b/plugins/TipperYM/src/stdafx.h
@@ -65,7 +65,6 @@ Boston, MA 02111-1307, USA.
#include "options.h"
#include "str_utils.h"
#include "subst.h"
-#include "preset_items.h"
#include "translations.h"
#define MODULENAME "Tipper"
diff --git a/plugins/TipperYM/src/version.h b/plugins/TipperYM/src/version.h
index fb0505e091..8c6eea520d 100644
--- a/plugins/TipperYM/src/version.h
+++ b/plugins/TipperYM/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 2
#define __MINOR_VERSION 1
#define __RELEASE_NUM 0
-#define __BUILD_NUM 7
+#define __BUILD_NUM 8
#include <stdver.h>