diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-03-21 10:06:43 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-03-21 10:06:43 +0000 |
commit | 0ec8d29f1dd1c40f355718d632ef6884318d0d9b (patch) | |
tree | 2d88d3bdd1eb8eda4b29a83b824652101280ed01 /plugins | |
parent | 8d8b5001f7ce0a0623752815a4e8ab5f136c7df3 (diff) |
fixed message sending
git-svn-id: http://svn.miranda-ng.org/main/trunk@4138 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/BuddyPounce/src/dialog.cpp | 4 | ||||
-rw-r--r-- | plugins/BuddyPounce/src/main.cpp | 18 |
2 files changed, 9 insertions, 13 deletions
diff --git a/plugins/BuddyPounce/src/dialog.cpp b/plugins/BuddyPounce/src/dialog.cpp index bdc08ecd5b..c8ae1c575e 100644 --- a/plugins/BuddyPounce/src/dialog.cpp +++ b/plugins/BuddyPounce/src/dialog.cpp @@ -285,7 +285,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
SetDlgItemText(hwnd, GRP_MSG, msg);
populateSettingsList(GetDlgItem(hwnd, IDC_SETTINGS));
- populateContacts(wi->hContact, GetDlgItem(hwnd,IDC_CONTACTS));
+ populateContacts(wi->hContact, GetDlgItem(hwnd, IDC_CONTACTS));
SendMessage(GetDlgItem(hwnd,IDC_SPIN), UDM_SETRANGE, 0, (LPARAM) MAKELONG ((short) 1024, (short) 0));
DBWriteContactSettingByte(wi->hContact, modname, "LastSetting", 0);
}
@@ -585,7 +585,7 @@ INT_PTR CALLBACK SendPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP {
KillTimer(hwnd,1);
SendPounce(spdps->message, ((struct SendPounceDlgProcStruct *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact);
- free((char*)((struct SendPounceDlgProcStruct *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->message);
+ free((TCHAR*)((struct SendPounceDlgProcStruct *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->message);
free((struct SendPounceDlgProcStruct *)GetWindowLongPtr(hwnd, GWLP_USERDATA));
DestroyWindow(hwnd);
}
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;
}
|