diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-13 19:24:27 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-13 19:24:27 +0000 |
commit | 9f1350bd4fb0df56a4115e80343285eef8acb954 (patch) | |
tree | 1ba6a93fbf45e23ecf5574e4bf27274553ff0d93 /plugins/NewXstatusNotify/xstatus.cpp | |
parent | 3b7c325eda9d15675755888f604767fab93170ca (diff) |
fix for rare crash
git-svn-id: http://svn.miranda-ng.org/main/trunk@955 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NewXstatusNotify/xstatus.cpp')
-rw-r--r-- | plugins/NewXstatusNotify/xstatus.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/plugins/NewXstatusNotify/xstatus.cpp b/plugins/NewXstatusNotify/xstatus.cpp index c427a8d427..94415dbb21 100644 --- a/plugins/NewXstatusNotify/xstatus.cpp +++ b/plugins/NewXstatusNotify/xstatus.cpp @@ -193,19 +193,20 @@ void ShowPopup(XSTATUSCHANGE *xsc) break;
}
-
- _tcscpy(ppd.lptzContactName, (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)xsc->hContact, GSMDF_TCHAR));
- if (opt.ShowGroup) //add group name to popup title
- {
- if (!DBGetContactSettingTString(xsc->hContact, "CList", "Group", &dbv))
- {
- _tcscat(ppd.lptzContactName, _T(" ("));
- _tcscat(ppd.lptzContactName, dbv.ptszVal);
- _tcscat(ppd.lptzContactName, _T(")"));
+ TCHAR *ptszGroup = NULL,
+ *ptszNick = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)xsc->hContact, GSMDF_TCHAR);
+ if (opt.ShowGroup) { //add group name to popup title
+ if (!DBGetContactSettingTString(xsc->hContact, "CList", "Group", &dbv)) {
+ ptszGroup = NEWTSTR_ALLOCA(dbv.ptszVal);
DBFreeVariant(&dbv);
}
}
+ if (ptszGroup)
+ mir_sntprintf(ppd.lptzContactName, SIZEOF(ppd.lptzContactName),_T("%s (%s)"), ptszNick, ptszGroup);
+ else
+ _tcsncpy(ppd.lptzContactName, ptszNick, SIZEOF(ppd.lptzContactName));
+
// cut message if needed
if (opt.PTruncateMsg && (opt.PMsgLen > 0) && xsc->stzText && (_tcslen(xsc->stzText) > opt.PMsgLen))
{
|