diff options
-rw-r--r-- | SimpleAR/Src/Main.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/SimpleAR/Src/Main.cpp b/SimpleAR/Src/Main.cpp index 4afdab7..1705ce2 100644 --- a/SimpleAR/Src/Main.cpp +++ b/SimpleAR/Src/Main.cpp @@ -268,7 +268,17 @@ INT addEvent(WPARAM wParam, LPARAM lParam) }
ptszTemp2 = (TCHAR*)mir_alloc(sizeof(TCHAR) * (msgLen+5));
mir_sntprintf(ptszTemp2, msgLen+5, _T("%s\r\n\r\n%s"), ptszTemp, dbv.ptszVal);
- ptszTemp = Utils_ReplaceVarsT(ptszTemp2);
+ if (ServiceExists(MS_VARS_FORMATSTRING))
+ {
+ FORMATINFO fi;
+
+ ZeroMemory(&fi, sizeof(fi));
+ fi.cbSize = sizeof(fi);
+ fi.flags = FIF_TCHAR;
+ fi.tszFormat = ptszTemp2;
+ ptszTemp = (TCHAR*)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
+ }else
+ ptszTemp = Utils_ReplaceVarsT(ptszTemp2);
char* pszUtf = mir_utf8encodeT(ptszTemp);
CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)pszUtf);
@@ -281,7 +291,10 @@ INT addEvent(WPARAM wParam, LPARAM lParam) dbei.pBlob = (PBYTE)pszUtf;
CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei);
- mir_free(ptszTemp);
+ if (ServiceExists(MS_VARS_FORMATSTRING))
+ CallService(MS_VARS_FREEMEMORY, (WPARAM)ptszTemp, 0);
+ else
+ mir_free(ptszTemp);
mir_free(ptszTemp2);
mir_free(pszUtf);
if (dbvNick.ptszVal)
|