summaryrefslogtreecommitdiff
path: root/plugins/BuddyPounce/src/main.cpp
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2013-03-21 10:06:43 +0000
committerKirill Volinsky <mataes2007@gmail.com>2013-03-21 10:06:43 +0000
commit0ec8d29f1dd1c40f355718d632ef6884318d0d9b (patch)
tree2d88d3bdd1eb8eda4b29a83b824652101280ed01 /plugins/BuddyPounce/src/main.cpp
parent8d8b5001f7ce0a0623752815a4e8ab5f136c7df3 (diff)
fixed message sending
git-svn-id: http://svn.miranda-ng.org/main/trunk@4138 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/BuddyPounce/src/main.cpp')
-rw-r--r--plugins/BuddyPounce/src/main.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp
index 693bfd1106..f12bb526a0 100644
--- a/plugins/BuddyPounce/src/main.cpp
+++ b/plugins/BuddyPounce/src/main.cpp
@@ -155,7 +155,7 @@ int CheckDate(HANDLE hContact)
void SendPounce(TCHAR *text, HANDLE hContact)
{
char* pszUtf = mir_utf8encodeT(text);
- if (HANDLE hSendId = (HANDLE)CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)text))
+ if (HANDLE hSendId = (HANDLE)CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)pszUtf))
WindowList_Add(hWindowList, (HWND)hSendId, hContact);
}
@@ -163,20 +163,17 @@ void SendPounce(TCHAR *text, HANDLE hContact)
int UserOnlineSettingChanged(WPARAM wParam,LPARAM lParam)
{
DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam;
- int newStatus,oldStatus;
- DBVARIANT dbv;
- HANDLE hContact;
char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)wParam, 0);
- TCHAR* message;
if((HANDLE)wParam == NULL || strcmp(cws->szSetting,"Status")) return 0;
if (szProto && (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM))
{
- newStatus = cws->value.wVal;
- oldStatus = DBGetContactSettingWord((HANDLE)wParam,"UserOnline","OldStatus",ID_STATUS_OFFLINE);
+ int newStatus = cws->value.wVal;
+ int oldStatus = DBGetContactSettingWord((HANDLE)wParam,"UserOnline","OldStatus",ID_STATUS_OFFLINE);
if ( ( newStatus != oldStatus ) && ( (HANDLE)wParam != NULL) && ( newStatus != ID_STATUS_OFFLINE) )
{
- hContact = (HANDLE)wParam;
+ HANDLE hContact = (HANDLE)wParam;
+ DBVARIANT dbv;
if (!DBGetContactSettingTString(hContact, modname, "PounceMsg", &dbv) && (dbv.ptszVal[0] != '\0'))
{
// check my status
@@ -191,7 +188,7 @@ int UserOnlineSettingChanged(WPARAM wParam,LPARAM lParam)
if (DBGetContactSettingByte(hContact, modname, "ConfirmTimeout", 0))
{
struct SendPounceDlgProcStruct *spdps = (struct SendPounceDlgProcStruct *)malloc(sizeof(struct SendPounceDlgProcStruct));
- message = mir_tstrdup(dbv.ptszVal); // will get free()ed in the send confirm window proc
+ TCHAR *message = mir_tstrdup(dbv.ptszVal); // will get free()ed in the send confirm window proc
spdps->hContact = hContact;
spdps->message = message;
CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMSEND), 0, SendPounceDlgProc, (LPARAM)spdps);
@@ -202,11 +199,10 @@ int UserOnlineSettingChanged(WPARAM wParam,LPARAM lParam)
SendPounce(dbv.ptszVal, hContact);
}
}
+ DBFreeVariant(&dbv);
}
-
}
}
- DBFreeVariant(&dbv);
return 0;
}