diff options
-rw-r--r-- | plugins/BuddyPounce/buddypounce_10.vcxproj | 8 | ||||
-rw-r--r-- | plugins/BuddyPounce/buddypounce_11.vcxproj | 8 | ||||
-rw-r--r-- | plugins/BuddyPounce/res/resource.rc | 30 | ||||
-rw-r--r-- | plugins/BuddyPounce/src/dialog.cpp | 218 | ||||
-rw-r--r-- | plugins/BuddyPounce/src/headers.h | 19 | ||||
-rw-r--r-- | plugins/BuddyPounce/src/main.cpp | 71 | ||||
-rw-r--r-- | plugins/BuddyPounce/src/resource.h | 4 |
7 files changed, 179 insertions, 179 deletions
diff --git a/plugins/BuddyPounce/buddypounce_10.vcxproj b/plugins/BuddyPounce/buddypounce_10.vcxproj index 33faebf38a..1332c7eb2d 100644 --- a/plugins/BuddyPounce/buddypounce_10.vcxproj +++ b/plugins/BuddyPounce/buddypounce_10.vcxproj @@ -25,21 +25,21 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
diff --git a/plugins/BuddyPounce/buddypounce_11.vcxproj b/plugins/BuddyPounce/buddypounce_11.vcxproj index c75a87e83b..26574efb47 100644 --- a/plugins/BuddyPounce/buddypounce_11.vcxproj +++ b/plugins/BuddyPounce/buddypounce_11.vcxproj @@ -26,24 +26,24 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v110_xp</PlatformToolset>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v110_xp</PlatformToolset>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v110_xp</PlatformToolset>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v110_xp</PlatformToolset>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
diff --git a/plugins/BuddyPounce/res/resource.rc b/plugins/BuddyPounce/res/resource.rc index a66d61a528..d5e184b06c 100644 --- a/plugins/BuddyPounce/res/resource.rc +++ b/plugins/BuddyPounce/res/resource.rc @@ -13,7 +13,7 @@ #undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// Английский (США) resources
+// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
@@ -92,24 +92,25 @@ BEGIN CONTROL "Check1",IDC_CHECK10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,93,66,81,10
END
-IDD_OPTIONS DIALOG 0, 0, 314, 240
+IDD_OPTIONS DIALOGEX 0, 0, 314, 240
STYLE DS_SETFONT | WS_CHILD
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
CONTROL "Use Advanced Dialog",IDC_USEADVANCED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,18,85,10
- EDITTEXT IDC_MESSAGE,15,73,157,60,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL
- GROUPBOX "The Message: (Characters: )",GRP_MSG,13,63,165,76
- GROUPBOX "Setting Value",IDC_STATIC,13,142,165,43,WS_DISABLED
- LTEXT "Setting text...........",IDC_SETTINGMSG,15,151,144,8,NOT WS_VISIBLE | WS_TABSTOP
+ EDITTEXT IDC_MESSAGE,15,81,157,60,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL
+ GROUPBOX "The Message: (Characters: )",GRP_MSG,13,71,165,76
+ GROUPBOX "Setting Value",IDC_STATIC,13,150,165,43,WS_DISABLED
+ LTEXT "Setting text...........",IDC_SETTINGMSG,15,159,144,8,NOT WS_VISIBLE | WS_TABSTOP
EDITTEXT IDC_SETTINGNUMBER,20,164,42,12,ES_NUMBER | NOT WS_VISIBLE
CONTROL "Spin2",IDC_SPIN,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | NOT WS_VISIBLE | WS_TABSTOP,51,164,11,12
- EDITTEXT IDC_SETTINGTEXT,20,164,152,12,ES_AUTOHSCROLL | NOT WS_VISIBLE
- PUSHBUTTON "...",IDC_BUTTON,159,148,14,12,NOT WS_VISIBLE
- GROUPBOX "Settings",IDC_STATIC,183,63,118,122
- LISTBOX IDC_SETTINGS,187,74,109,103,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
- LTEXT "",IDC_SETTINGMSG2,69,164,104,8,NOT WS_VISIBLE
- GROUPBOX "Default Settings These settings are also used when sending a ""Simple"" pounce",IDC_STATIC,7,51,300,142
+ EDITTEXT IDC_SETTINGTEXT,20,172,152,12,ES_AUTOHSCROLL | NOT WS_VISIBLE
+ PUSHBUTTON "...",IDC_BUTTON,159,156,14,12,NOT WS_VISIBLE
+ GROUPBOX "Settings",IDC_STATIC,183,71,118,122
+ LISTBOX IDC_SETTINGS,187,82,109,103,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
+ LTEXT "",IDC_SETTINGMSG2,69,172,104,8,NOT WS_VISIBLE
+ GROUPBOX "Default Settings",IDC_STATIC,7,45,300,155
CONTROL "Show Delivery Messages",IDC_SHOWDELIVERYMSGS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,30,95,10
+ LTEXT "These settings are also used when sending a ""Simple"" pounce",IDC_STATIC,13,56,198,8
END
@@ -227,10 +228,11 @@ END // Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_POUNCE ICON "icon1.ico"
-#endif // Английский (США) resources
+#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
+
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/plugins/BuddyPounce/src/dialog.cpp b/plugins/BuddyPounce/src/dialog.cpp index 76cb17a37c..332d46fe74 100644 --- a/plugins/BuddyPounce/src/dialog.cpp +++ b/plugins/BuddyPounce/src/dialog.cpp @@ -2,12 +2,12 @@ void populateSettingsList(HWND hwnd2List)
{
- SendMessage(hwnd2List, LB_ADDSTRING, 0, (LPARAM)Translate("Send If My Status Is..."));
- SendMessage(hwnd2List, LB_ADDSTRING, 0, (LPARAM)Translate("Send If They Change Status to..."));
- SendMessage(hwnd2List, LB_ADDSTRING, 0, (LPARAM)"----------------------------");
- SendMessage(hwnd2List, LB_ADDSTRING, 0, (LPARAM)Translate("Reuse Pounce"));
- SendMessage(hwnd2List, LB_ADDSTRING, 0, (LPARAM)Translate("Give Up delay"));
- SendMessage(hwnd2List, LB_ADDSTRING, 0, (LPARAM)Translate("Confirmation Window"));
+ SendMessage(hwnd2List, LB_ADDSTRING, 0, (LPARAM)TranslateT("Send If My Status Is..."));
+ SendMessage(hwnd2List, LB_ADDSTRING, 0, (LPARAM)TranslateT("Send If They Change Status to..."));
+ SendMessage(hwnd2List, LB_ADDSTRING, 0, (LPARAM)_T("----------------------------"));
+ SendMessage(hwnd2List, LB_ADDSTRING, 0, (LPARAM)TranslateT("Reuse Pounce"));
+ SendMessage(hwnd2List, LB_ADDSTRING, 0, (LPARAM)TranslateT("Give Up delay"));
+ SendMessage(hwnd2List, LB_ADDSTRING, 0, (LPARAM)TranslateT("Confirmation Window"));
// SendMessage(hwnd2List, LB_ADDSTRING, 0, (LPARAM)"----------------------------"));
// SendMessage(hwnd2List, LB_ADDSTRING, 0, (LPARAM)Translate("Send a File"));
}
@@ -34,7 +34,7 @@ void populateContacts(HANDLE BPhContact,HWND hwnd2CB) void saveLastSetting(HANDLE hContact, HWND hwnd)
{
- char number[8], string[1024];
+ TCHAR number[8], string[1024];
switch (DBGetContactSettingByte(hContact, modname, "LastSetting", 2)) // nothing to do
{
case 0: // Send If My Status Is...
@@ -46,24 +46,24 @@ void saveLastSetting(HANDLE hContact, HWND hwnd) break;
case 3: // Reuse Pounce
GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, 8);
- DBWriteContactSettingByte(hContact, modname, "Reuse", (BYTE)atoi(number));
+ DBWriteContactSettingByte(hContact, modname, "Reuse", (BYTE)_ttoi(number));
break;
case 4: // Give Up delay
GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, 8);
- DBWriteContactSettingByte(hContact, modname, "GiveUpDays", (BYTE)atoi(number));
+ DBWriteContactSettingByte(hContact, modname, "GiveUpDays", (BYTE)_ttoi(number));
{
time_t today = time(NULL);
- DBWriteContactSettingDword(hContact, modname, "GiveUpDate", (DWORD)(atoi(number)*SECONDSINADAY));
+ DBWriteContactSettingDword(hContact, modname, "GiveUpDate", (DWORD)(_ttoi(number)*SECONDSINADAY));
}
break;
case 5: // confirm window
GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, 8);
- DBWriteContactSettingByte(hContact, modname, "ConfirmTimeout", (BYTE)atoi(number));
+ DBWriteContactSettingByte(hContact, modname, "ConfirmTimeout", (BYTE)_ttoi(number));
break;
case 7: // send a file
GetDlgItemText(hwnd, IDC_SETTINGTEXT, string, 1024);
- DBWriteContactSettingString(hContact, modname, "FileToSend", string);
+ DBWriteContactSettingTString(hContact, modname, "FileToSend", string);
break;
}
}
@@ -81,10 +81,10 @@ void hideAll(HWND hwnd) void getDefaultMessage(HWND hwnd, UINT control, HANDLE hContact)
{
DBVARIANT dbv;
- if (!DBGetContactSetting(hContact,modname, "PounceMsg", &dbv))
- SetDlgItemText(hwnd, control, dbv.pszVal);
- else if (!DBGetContactSetting(NULL,modname, "PounceMsg", &dbv))
- SetDlgItemText(hwnd, control, dbv.pszVal);
+ if (!DBGetContactSettingTString(hContact, modname, "PounceMsg", &dbv))
+ SetDlgItemText(hwnd, control, dbv.ptszVal);
+ else if (!DBGetContactSettingTString(NULL, modname, "PounceMsg", &dbv))
+ SetDlgItemText(hwnd, control, dbv.ptszVal);
DBFreeVariant(&dbv);
}
INT_PTR CALLBACK StatusModesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -106,7 +106,7 @@ INT_PTR CALLBACK StatusModesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case IDCANCEL:
{
struct windowInfo *wi = (struct windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- char type[32];
+ TCHAR type[32];
int flag = 0;
GetDlgItemText(hwnd, IDC_CHECK1, type, 32);
flag = (IsDlgButtonChecked(hwnd, IDC_CHECK1))
@@ -119,7 +119,7 @@ INT_PTR CALLBACK StatusModesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l |(IsDlgButtonChecked(hwnd, IDC_CHECK8)<<7)
|(IsDlgButtonChecked(hwnd, IDC_CHECK9)<<8)
|(IsDlgButtonChecked(hwnd, IDC_CHECK10)<<9);
- if (!strcmp(type, "Any"))
+ if (!_tcscmp(type, _T("Any")))
{
if (LOWORD(wParam) == IDOK)
DBWriteContactSettingWord(wi->hContact, modname, "SendIfMyStatusIsFLAG", (WORD)flag);
@@ -151,17 +151,17 @@ void statusModes(struct windowInfo *wi, int myStatusMode) // myStatusMode=1 send {
hwnd = wi->SendIfMy = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_STATUSMODES), 0, StatusModesDlgProc, (LPARAM)wi);
statusFlag = DBGetContactSettingWord(wi->hContact, modname, "SendIfMyStatusIsFLAG", 0);
- SetWindowText(hwnd, Translate("Send If My Status Is"));
- SetDlgItemText(hwnd, IDC_CHECK1, Translate("Any"));
- SetDlgItemText(hwnd, IDC_CHECK2, Translate("Online"));
- SetDlgItemText(hwnd, IDC_CHECK3, Translate("Away"));
- SetDlgItemText(hwnd, IDC_CHECK4, Translate("NA"));
- SetDlgItemText(hwnd, IDC_CHECK5, Translate("Occupied"));
- SetDlgItemText(hwnd, IDC_CHECK6, Translate("DND"));
- SetDlgItemText(hwnd, IDC_CHECK7, Translate("Free For Chat"));
- SetDlgItemText(hwnd, IDC_CHECK8, Translate("Invisible"));
- SetDlgItemText(hwnd, IDC_CHECK9, Translate("On The Phone"));
- SetDlgItemText(hwnd, IDC_CHECK10, Translate("Out To Lunch"));
+ SetWindowText(hwnd, TranslateT("Send If My Status Is"));
+ SetDlgItemText(hwnd, IDC_CHECK1, TranslateT("Any"));
+ SetDlgItemText(hwnd, IDC_CHECK2, TranslateT("Online"));
+ SetDlgItemText(hwnd, IDC_CHECK3, TranslateT("Away"));
+ SetDlgItemText(hwnd, IDC_CHECK4, TranslateT("NA"));
+ SetDlgItemText(hwnd, IDC_CHECK5, TranslateT("Occupied"));
+ SetDlgItemText(hwnd, IDC_CHECK6, TranslateT("DND"));
+ SetDlgItemText(hwnd, IDC_CHECK7, TranslateT("Free For Chat"));
+ SetDlgItemText(hwnd, IDC_CHECK8, TranslateT("Invisible"));
+ SetDlgItemText(hwnd, IDC_CHECK9, TranslateT("On The Phone"));
+ SetDlgItemText(hwnd, IDC_CHECK10, TranslateT("Out To Lunch"));
}
}
else
@@ -171,17 +171,17 @@ void statusModes(struct windowInfo *wi, int myStatusMode) // myStatusMode=1 send {
hwnd = wi->SendWhenThey = CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_STATUSMODES),0,StatusModesDlgProc, (LPARAM)wi);
statusFlag = DBGetContactSettingWord(wi->hContact, modname, "SendIfTheirStatusIsFLAG", 0);
- SetWindowText(hwnd, Translate("Send If Their Status changes"));
- SetDlgItemText(hwnd, IDC_CHECK1, Translate("From Offline"));
- SetDlgItemText(hwnd, IDC_CHECK2, Translate("To Online"));
- SetDlgItemText(hwnd, IDC_CHECK3, Translate("To Away"));
- SetDlgItemText(hwnd, IDC_CHECK4, Translate("To NA"));
- SetDlgItemText(hwnd, IDC_CHECK5, Translate("To Occupied"));
- SetDlgItemText(hwnd, IDC_CHECK6, Translate("To DND"));
- SetDlgItemText(hwnd, IDC_CHECK7, Translate("To Free For Chat"));
- SetDlgItemText(hwnd, IDC_CHECK8, Translate("To Invisible"));
- SetDlgItemText(hwnd, IDC_CHECK9, Translate("To On The Phone"));
- SetDlgItemText(hwnd, IDC_CHECK10, Translate("To Out To Lunch"));
+ SetWindowText(hwnd, TranslateT("Send If Their Status changes"));
+ SetDlgItemText(hwnd, IDC_CHECK1, TranslateT("From Offline"));
+ SetDlgItemText(hwnd, IDC_CHECK2, TranslateT("To Online"));
+ SetDlgItemText(hwnd, IDC_CHECK3, TranslateT("To Away"));
+ SetDlgItemText(hwnd, IDC_CHECK4, TranslateT("To NA"));
+ SetDlgItemText(hwnd, IDC_CHECK5, TranslateT("To Occupied"));
+ SetDlgItemText(hwnd, IDC_CHECK6, TranslateT("To DND"));
+ SetDlgItemText(hwnd, IDC_CHECK7, TranslateT("To Free For Chat"));
+ SetDlgItemText(hwnd, IDC_CHECK8, TranslateT("To Invisible"));
+ SetDlgItemText(hwnd, IDC_CHECK9, TranslateT("To On The Phone"));
+ SetDlgItemText(hwnd, IDC_CHECK10, TranslateT("To Out To Lunch"));
}
}
CheckDlgButton(hwnd, IDC_CHECK1, statusFlag&ANY);
@@ -215,12 +215,12 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LP case WM_INITDIALOG:
{
HANDLE hContact = (HANDLE)lParam;
- char msg[1024];
+ TCHAR msg[1024];
TranslateDialogDefault(hwnd);
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LPARAM)lParam);
getDefaultMessage(hwnd, IDC_MESSAGE, hContact);
- _snprintf(msg, 1024, Translate("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
+ mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
SetDlgItemText(hwnd, GRP_MSG, msg);
}
@@ -233,9 +233,9 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LP if (HIWORD(wParam) == EN_CHANGE)
{
int length;
- char msg[1024];
+ TCHAR msg[1024];
length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
- _snprintf(msg, 1024, Translate("The Message (%d Characters)"), length);
+ mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), length);
SetDlgItemText(hwnd, GRP_MSG, msg);
}
}
@@ -244,13 +244,13 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LP // fall through
case IDOK:
{
- char *text;
+ TCHAR *text;
HANDLE hContact = (HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE))+1;
+ int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)) + 1;
if (length>1)
{
- text = (char*)malloc(length);
- if (!text) { msg("Couldnt Allocate enough memory",""); break; }
+ text = (TCHAR*)malloc(length*sizeof(TCHAR));
+ if (!text) { msg(TranslateT("Couldnt Allocate enough memory"), _T("")); break; }
GetDlgItemText(hwnd, IDC_MESSAGE, text, length);
}
@@ -275,15 +275,15 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case WM_INITDIALOG:
{
struct windowInfo *wi = (struct windowInfo *)malloc(sizeof(struct windowInfo));
- char msg[1024];
- if (!wi) { msg("error......","Buddy Pounce"); DestroyWindow(hwnd); }
+ TCHAR msg[1024];
+ if (!wi) { msg(TranslateT("error......"), TranslateT("Buddy Pounce")); DestroyWindow(hwnd); }
TranslateDialogDefault(hwnd);
wi->hContact = (HANDLE)lParam;
wi->SendIfMy = 0;
wi->SendWhenThey = 0;
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LPARAM)wi);
getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact);
- _snprintf(msg, 1024, Translate("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
+ 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));
@@ -299,9 +299,9 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (HIWORD(wParam) == EN_CHANGE)
{
int length;
- char msg[1024];
+ TCHAR msg[1024];
length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
- _snprintf(msg, 1024, Translate("The Message (%d Characters)"), length);
+ mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), length);
SetDlgItemText(hwnd, GRP_MSG, msg);
}
}
@@ -309,15 +309,15 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case IDC_SIMPLE:
case IDOK:
{
- char *text;
+ TCHAR *text;
HANDLE hContact = (HANDLE)SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_GETITEMDATA, SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_GETCURSEL,0,0),0);
int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE))+1;
if (length>1)
{
- text = (char*)malloc(length);
- if (!text) { msg("Couldnt Allocate enough memory",""); break; }
+ text = (TCHAR*)malloc(length*sizeof(TCHAR));
+ if (!text) { msg(TranslateT("Couldnt Allocate enough memory"), _T("")); break; }
GetDlgItemText(hwnd, IDC_MESSAGE, text, length);
- DBWriteContactSettingString(hContact, modname, "PounceMsg", text);
+ DBWriteContactSettingTString(hContact, modname, "PounceMsg", text);
free(text);
}
else DBDeleteContactSetting(hContact, modname, "PounceMsg");
@@ -339,20 +339,20 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l {
HANDLE hContact = ((struct windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact;
deletePounce(hContact);
- SetDlgItemText(hwnd, IDC_MESSAGE, "");
- SetDlgItemText(hwnd, GRP_MSG, "The Message (0 Characters)");
+ SetDlgItemText(hwnd, IDC_MESSAGE, _T(""));
+ SetDlgItemText(hwnd, GRP_MSG, TranslateT("The Message (0 Characters)"));
}
break;
case IDC_DEFAULT:
{
HANDLE hContact = ((struct windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact;
- char msg[1024];
+ TCHAR msg[1024];
getDefaultMessage(hwnd, IDC_MESSAGE, hContact);
- _snprintf(msg, 1024, Translate("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
+ mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
SetDlgItemText(hwnd, GRP_MSG, msg);
- DBWriteContactSettingWord(hContact,modname, "SendIfMyStatusIsFLAG", (WORD)DBGetContactSettingWord(NULL, modname, "SendIfMyStatusIsFLAG",0));
- DBWriteContactSettingWord(hContact,modname, "SendIfTheirStatusIsFLAG", (WORD)DBGetContactSettingWord(NULL, modname, "SendIfTheirStatusIsFLAG",0));
- DBWriteContactSettingByte(hContact,modname, "Reuse",(BYTE)DBGetContactSettingByte(NULL, modname, "Reuse",0));
+ DBWriteContactSettingWord(hContact, modname, "SendIfMyStatusIsFLAG", (WORD)DBGetContactSettingWord(NULL, modname, "SendIfMyStatusIsFLAG",0));
+ DBWriteContactSettingWord(hContact, modname, "SendIfTheirStatusIsFLAG", (WORD)DBGetContactSettingWord(NULL, modname, "SendIfTheirStatusIsFLAG",0));
+ DBWriteContactSettingByte(hContact, modname, "Reuse",(BYTE)DBGetContactSettingByte(NULL, modname, "Reuse",0));
DBWriteContactSettingByte(hContact, modname, "GiveUpDays", (BYTE)DBGetContactSettingByte(NULL, modname, "GiveUpDays",0));
DBWriteContactSettingDword(hContact, modname, "GiveUpDate", (DWORD)DBGetContactSettingDword(NULL, modname, "GiveUpDate",0));
DBWriteContactSettingByte(hContact, modname, "ConfirmTimeout", (BYTE)DBGetContactSettingByte(NULL, modname, "ConfirmTimeout",0));
@@ -363,7 +363,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l {
struct windowInfo *wi = (struct windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
int item = SendMessage(GetDlgItem(hwnd, IDC_SETTINGS), LB_GETCURSEL, 0, 0);
- char temp[5];
+ TCHAR temp[5];
saveLastSetting(wi->hContact, hwnd);
hideAll(hwnd);
switch (item)
@@ -376,27 +376,27 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l break;
case 3: // Reuse Pounce
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
- SetDlgItemText(hwnd, IDC_SETTINGMSG, "Reuse this message? (0 to use it once)");
+ SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Reuse this message? (0 to use it once)"));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG2), SW_SHOW);
- SetDlgItemText(hwnd, IDC_SETTINGMSG2, "Times");
+ SetDlgItemText(hwnd, IDC_SETTINGMSG2, TranslateT("Times"));
SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(DBGetContactSettingByte(wi->hContact, modname, "Reuse", 0), temp, 10));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW);
break;
case 4: // Give Up delay
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
- SetDlgItemText(hwnd, IDC_SETTINGMSG, "Giveup after.. (0 to not giveup)");
+ SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Giveup after.. (0 to not giveup)"));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG2), SW_SHOW);
- SetDlgItemText(hwnd, IDC_SETTINGMSG2, "Days");
+ SetDlgItemText(hwnd, IDC_SETTINGMSG2, TranslateT("Days"));
SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(DBGetContactSettingByte(wi->hContact, modname, "GiveUpDays", 0), temp, 10));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW);
break;
case 5: // confirm window
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
- SetDlgItemText(hwnd, IDC_SETTINGMSG, "Show confirmation window? (0 to not Show)");
+ SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Show confirmation window? (0 to not Show)"));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG2), SW_SHOW);
- SetDlgItemText(hwnd, IDC_SETTINGMSG2, "Seconds to wait before sending");
+ SetDlgItemText(hwnd, IDC_SETTINGMSG2, TranslateT("Seconds to wait before sending"));
SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(DBGetContactSettingByte(wi->hContact, modname, "ConfirmTimeout", 0), temp, 10));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW);
@@ -404,7 +404,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case 7: // send a file
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
- SetDlgItemText(hwnd, IDC_SETTINGMSG, "Send a file");
+ SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Send a file"));
ShowWindow(GetDlgItem(hwnd, IDC_BUTTON), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGTEXT), SW_SHOW);
break;
@@ -425,7 +425,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L case WM_INITDIALOG:
{
struct windowInfo *wi = (struct windowInfo *)malloc(sizeof(struct windowInfo));
- char msg[1024];
+ TCHAR msg[1024];
TranslateDialogDefault(hwnd);
wi->hContact = 0;
wi->SendIfMy = 0;
@@ -433,7 +433,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L SetWindowLongPtr(hwnd, GWLP_USERDATA, (LPARAM)wi);
getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact);
- _snprintf(msg, 1024, Translate("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
+ 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));
SendMessage(GetDlgItem(hwnd,IDC_SPIN), UDM_SETRANGE, 0, (LPARAM) MAKELONG ((short) 1024, (short) 0));
@@ -449,16 +449,16 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L {
case PSN_APPLY:
{
- char *text;
+ TCHAR *text;
struct windowInfo *wi = (struct windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
HANDLE hContact = ((struct windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact;
int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE))+1;
- if (length>1)
+ if (length > 1)
{
- text = (char*)malloc(length);
- if (!text) { msg("Couldnt Allocate enough memory",""); break; }
+ text = (TCHAR*)malloc(length*sizeof(TCHAR));
+ if (!text) { msg(TranslateT("Couldnt Allocate enough memory"), _T("")); break; }
GetDlgItemText(hwnd, IDC_MESSAGE, text, length);
- DBWriteContactSettingString(hContact, modname, "PounceMsg", text);
+ DBWriteContactSettingTString(hContact, modname, "PounceMsg", text);
free(text);
}
else DBDeleteContactSetting(hContact, modname, "PounceMsg");
@@ -481,9 +481,9 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L if (HIWORD(wParam) == EN_CHANGE)
{
int length;
- char msg[1024];
+ TCHAR msg[1024];
length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
- _snprintf(msg, 1024, Translate("The Message (%d Characters)"), length);
+ mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), length);
SetDlgItemText(hwnd, GRP_MSG, msg);
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
}
@@ -498,7 +498,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L {
struct windowInfo *wi = (struct windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
int item = SendMessage(GetDlgItem(hwnd, IDC_SETTINGS), LB_GETCURSEL, 0, 0);
- char temp[5];
+ TCHAR temp[5];
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
saveLastSetting(wi->hContact, hwnd);
hideAll(hwnd);
@@ -512,27 +512,27 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L break;
case 3: // Reuse Pounce
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
- SetDlgItemText(hwnd, IDC_SETTINGMSG, "Reuse this message? (0 to use it once)");
+ SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Reuse this message? (0 to use it once)"));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG2), SW_SHOW);
- SetDlgItemText(hwnd, IDC_SETTINGMSG2, "Times");
+ SetDlgItemText(hwnd, IDC_SETTINGMSG2, TranslateT("Times"));
SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(DBGetContactSettingByte(wi->hContact, modname, "Reuse", 0), temp, 10));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW);
break;
case 4: // Give Up delay
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
- SetDlgItemText(hwnd, IDC_SETTINGMSG, "Giveup after.. (0 to not giveup)");
+ SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Giveup after.. (0 to not giveup)"));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG2), SW_SHOW);
- SetDlgItemText(hwnd, IDC_SETTINGMSG2, "Days");
+ SetDlgItemText(hwnd, IDC_SETTINGMSG2, TranslateT("Days"));
SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(DBGetContactSettingByte(wi->hContact, modname, "GiveUpDays", 0), temp, 10));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW);
break;
case 5: // confirm window
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
- SetDlgItemText(hwnd, IDC_SETTINGMSG, "Show confirmation window? (0 to not Show)");
+ SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Show confirmation window? (0 to not Show)"));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG2), SW_SHOW);
- SetDlgItemText(hwnd, IDC_SETTINGMSG2, "Seconds to wait before sending");
+ SetDlgItemText(hwnd, IDC_SETTINGMSG2, TranslateT("Seconds to wait before sending"));
SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(DBGetContactSettingByte(wi->hContact, modname, "ConfirmTimeout", 0), temp, 10));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW);
@@ -540,7 +540,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L case 7: // send a file
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
- SetDlgItemText(hwnd, IDC_SETTINGMSG, "Send a file");
+ SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Send a file"));
ShowWindow(GetDlgItem(hwnd, IDC_BUTTON), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGTEXT), SW_SHOW);
break;
@@ -567,8 +567,8 @@ INT_PTR CALLBACK SendPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP TranslateDialogDefault(hwnd);
spdps->timer = DBGetContactSettingByte(spdps->hContact, modname, "ConfirmTimeout", 0);
SetWindowLongPtr(hwnd, GWLP_USERDATA, (WPARAM)spdps);
- if (DBGetContactSetting(spdps->hContact,modname,"PounceMsg",&dbv)) DestroyWindow(hwnd);
- SetDlgItemText(hwnd,IDC_MESSAGE,dbv.pszVal);
+ if (DBGetContactSettingTString(spdps->hContact, modname, "PounceMsg", &dbv)) DestroyWindow(hwnd);
+ SetDlgItemText(hwnd,IDC_MESSAGE, dbv.ptszVal);
DBFreeVariant(&dbv);
SetTimer(hwnd,1,1000,NULL);
SendMessage(hwnd,WM_TIMER,0,0);
@@ -577,9 +577,9 @@ INT_PTR CALLBACK SendPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP case WM_TIMER:
{
struct SendPounceDlgProcStruct *spdps = (struct SendPounceDlgProcStruct *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- char message[1024];
- _snprintf(message,sizeof(message),Translate("Pounce being sent to %s in %d seconds"),CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)spdps->hContact, 0),spdps->timer);
- SetDlgItemText(hwnd,LBL_CONTACT ,message);
+ TCHAR message[1024];
+ mir_sntprintf(message, SIZEOF(message), TranslateT("Pounce being sent to %s in %d seconds"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)spdps->hContact, GCDNF_TCHAR), spdps->timer);
+ SetDlgItemText(hwnd, LBL_CONTACT, message);
spdps->timer--;
if (spdps->timer == -1)
@@ -620,8 +620,8 @@ INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP SetWindowLongPtr(hwnd, GWLP_USERDATA, (WPARAM)lParam);
TranslateDialogDefault(hwnd);
hContact = (HANDLE)lParam;
- if (DBGetContactSetting(hContact,modname,"PounceMsg",&dbv)) DestroyWindow(hwnd);
- SetDlgItemText(hwnd,IDC_MESSAGE,dbv.pszVal);
+ if (DBGetContactSettingTString(hContact, modname, "PounceMsg", &dbv)) DestroyWindow(hwnd);
+ SetDlgItemText(hwnd, IDC_MESSAGE, dbv.ptszVal);
DBFreeVariant(&dbv);
}
break;
@@ -629,12 +629,12 @@ INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP switch(LOWORD(wParam)) {
case IDOK:
{
- char text[2048];
- GetWindowText(GetDlgItem(hwnd,IDOK),text,16);
- if (!strcmp(text,Translate("Retry")))
+ TCHAR text[2048];
+ GetWindowText(GetDlgItem(hwnd, IDOK), text, 16);
+ if (!_tcscmp(text, TranslateT("Retry")))
{
- GetWindowText(GetDlgItem(hwnd,IDC_MESSAGE),text,2048);
- SendPounce(text,hContact);
+ GetWindowText(GetDlgItem(hwnd,IDC_MESSAGE), text, 2048);
+ SendPounce(text, hContact);
}
}
// fall through
@@ -649,18 +649,18 @@ INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP void CreateMessageAcknowlegedWindow(HANDLE hContact, int SentSuccess)
{
HWND hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMSEND), 0, PounceSentDlgProc, (LPARAM)hContact);
- char msg[256];
+ TCHAR msg[256];
if (SentSuccess)
{
- _snprintf(msg,256,Translate("Message successfully sent to %s"),CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0) );
- SetWindowText(GetDlgItem(hwnd,IDOK),"OK");
- ShowWindow(GetDlgItem(hwnd,IDCANCEL),0);
+ mir_sntprintf(msg, SIZEOF(msg), TranslateT("Message successfully sent to %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR));
+ SetWindowText(GetDlgItem(hwnd, IDOK), TranslateT("OK"));
+ ShowWindow(GetDlgItem(hwnd, IDCANCEL), 0);
}
else
{
- _snprintf(msg,256,Translate("Message failed to send to %s"),CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0));
- SetWindowText(GetDlgItem(hwnd,IDOK),"Retry");
+ mir_sntprintf(msg, SIZEOF(msg), TranslateT("Message failed to send to %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR));
+ SetWindowText(GetDlgItem(hwnd, IDOK), TranslateT("Retry"));
}
- SetWindowText(GetDlgItem(hwnd,LBL_CONTACT),msg);
- SetWindowText(hwnd,modFullname);
+ SetWindowText(GetDlgItem(hwnd, LBL_CONTACT), msg);
+ SetWindowText(hwnd, TranslateT(modFullname));
}
\ No newline at end of file diff --git a/plugins/BuddyPounce/src/headers.h b/plugins/BuddyPounce/src/headers.h index a2c3399063..de87db585b 100644 --- a/plugins/BuddyPounce/src/headers.h +++ b/plugins/BuddyPounce/src/headers.h @@ -8,13 +8,14 @@ #include <commctrl.h>
#include <time.h>
-#include "newpluginapi.h"
-#include "m_clist.h"
-#include "m_langpack.h"
-#include "m_database.h"
-#include "m_protocols.h"
-#include "m_options.h"
-#include "m_protosvc.h"
+#include <newpluginapi.h>
+#include <m_clist.h>
+#include <m_langpack.h>
+#include <m_database.h>
+#include <m_protocols.h>
+#include <m_options.h>
+#include <m_protosvc.h>
+#include <win2k.h>
#include "resource.h"
#include "Version.h"
@@ -53,7 +54,7 @@ struct windowInfo { struct SendPounceDlgProcStruct {
HANDLE hContact;
int timer;
- char *message;
+ TCHAR *message;
};
extern HINSTANCE hInst;
@@ -63,7 +64,7 @@ extern HINSTANCE hInst; //=======================================================
// main.c
-void SendPounce(char* text, HANDLE hContact);
+void SendPounce(TCHAR* text, HANDLE hContact);
//dialog.c
INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp index 712bcd8a8e..693bfd1106 100644 --- a/plugins/BuddyPounce/src/main.cpp +++ b/plugins/BuddyPounce/src/main.cpp @@ -72,25 +72,26 @@ int MsgAck(WPARAM wParam, LPARAM lParam) DBEVENTINFO dbei = { 0 };
DBVARIANT dbv;
int reuse = DBGetContactSettingByte(ack->hContact,modname, "Reuse", 0);
- if (!DBGetContactSetting(ack->hContact, modname, "PounceMsg", &dbv) && (dbv.pszVal[0] != '\0'))
+ if (!DBGetContactSettingTString(ack->hContact, modname, "PounceMsg", &dbv) && (dbv.ptszVal[0] != '\0'))
{
-
+ char* pszUtf = mir_utf8encodeT(dbv.ptszVal);
dbei.cbSize = sizeof(dbei);
dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.flags = DBEF_SENT;
+ dbei.flags = DBEF_UTF | DBEF_SENT;
dbei.szModule = (char*)ack->szModule;
dbei.timestamp = time(NULL);
- dbei.cbBlob = lstrlenA(dbv.pszVal) + 1;
- dbei.pBlob = (PBYTE) dbv.pszVal;
- CallService(MS_DB_EVENT_ADD, (WPARAM) ack->hContact, (LPARAM) & dbei);
+ dbei.cbBlob = lstrlenA(pszUtf) + 1;
+ dbei.pBlob = (PBYTE)pszUtf;
+ CallService(MS_DB_EVENT_ADD, (WPARAM)ack->hContact, (LPARAM)&dbei);
+ mir_free(pszUtf);
}
// check to reuse
- if (reuse >1)
- DBWriteContactSettingByte(ack->hContact,modname, "Reuse", (BYTE)(reuse-1));
+ if (reuse > 1)
+ DBWriteContactSettingByte(ack->hContact, modname, "Reuse", (BYTE)(reuse-1));
else
{
DBWriteContactSettingByte(ack->hContact,modname, "Reuse", 0);
- DBWriteContactSettingString(ack->hContact,modname, "PounceMsg","");
+ DBWriteContactSettingTString(ack->hContact, modname, "PounceMsg", _T(""));
}
}
WindowList_Remove(hWindowList,(HWND)ack->hProcess);
@@ -104,7 +105,7 @@ int BuddyPounceOptInit(WPARAM wParam, LPARAM lParam) odp.cbSize = sizeof(odp);
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.hInstance = hInst;
- odp.pszTemplate = MAKEINTRESOURCE(IDD_OPTIONS);
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.ptszGroup = LPGENT("Plugins");
odp.ptszTitle = LPGENT("Buddy Pounce");
odp.pfnDlgProc = BuddyPounceOptionsDlgProc;
@@ -151,11 +152,12 @@ int CheckDate(HANDLE hContact) return 0;
}
-void SendPounce(char* text, HANDLE hContact)
+void SendPounce(TCHAR *text, HANDLE hContact)
{
- HANDLE hSendId;
- if (hSendId = (HANDLE)CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)text))
- WindowList_Add(hWindowList,(HWND)hSendId,hContact);
+ char* pszUtf = mir_utf8encodeT(text);
+ if (HANDLE hSendId = (HANDLE)CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)text))
+ WindowList_Add(hWindowList, (HWND)hSendId, hContact);
+
}
int UserOnlineSettingChanged(WPARAM wParam,LPARAM lParam)
@@ -164,18 +166,18 @@ int UserOnlineSettingChanged(WPARAM wParam,LPARAM lParam) int newStatus,oldStatus;
DBVARIANT dbv;
HANDLE hContact;
- char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)wParam,0);
- char* message;
- if((HANDLE)wParam==NULL || strcmp(cws->szSetting,"Status")) return 0;
+ 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);
+ newStatus = cws->value.wVal;
+ oldStatus = DBGetContactSettingWord((HANDLE)wParam,"UserOnline","OldStatus",ID_STATUS_OFFLINE);
if ( ( newStatus != oldStatus ) && ( (HANDLE)wParam != NULL) && ( newStatus != ID_STATUS_OFFLINE) )
{
- hContact=(HANDLE)wParam;
- if (!DBGetContactSetting(hContact, modname, "PounceMsg", &dbv) && (dbv.pszVal[0] != '\0'))
+ hContact = (HANDLE)wParam;
+ if (!DBGetContactSettingTString(hContact, modname, "PounceMsg", &dbv) && (dbv.ptszVal[0] != '\0'))
{
// check my status
if (statusCheck(DBGetContactSettingWord(hContact, modname, "SendIfMyStatusIsFLAG", 0), CallProtoService(szProto, PS_GETSTATUS,0,0))
@@ -189,14 +191,15 @@ 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.pszVal); // will get free()ed in the send confirm window proc
+ 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);
// set the confirmation window to send the msg when the timeout is done
mir_free(message);
}
- else SendPounce(dbv.pszVal, hContact);
+ else
+ SendPounce(dbv.ptszVal, hContact);
}
}
}
@@ -218,9 +221,9 @@ INT_PTR BuddyPounceMenuCommand(WPARAM wParam, LPARAM lParam) INT_PTR AddSimpleMessage(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact = (HANDLE)wParam;
- char* message = (char*)lParam;
+ TCHAR* message = (TCHAR*)lParam;
time_t today = time(NULL);
- DBWriteContactSettingString(hContact, modname, "PounceMsg", message);
+ DBWriteContactSettingTString(hContact, modname, "PounceMsg", message);
DBWriteContactSettingWord(hContact, modname, "SendIfMyStatusIsFLAG", (WORD)DBGetContactSettingWord(NULL, modname, "SendIfMyStatusIsFLAG",1));
DBWriteContactSettingWord(hContact, modname, "SendIfTheirStatusIsFLAG", (WORD)DBGetContactSettingWord(NULL, modname, "SendIfTheirStatusIsFLAG",1));
DBWriteContactSettingByte(hContact, modname, "Reuse", (BYTE)DBGetContactSettingByte(NULL, modname, "Reuse",0));
@@ -232,15 +235,15 @@ INT_PTR AddSimpleMessage(WPARAM wParam, LPARAM lParam) INT_PTR AddToPounce(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact = (HANDLE)wParam;
- char* message = (char*)lParam;
+ TCHAR* message = (TCHAR*)lParam;
DBVARIANT dbv;
- if (!DBGetContactSetting(hContact, modname, "PounceMsg",&dbv))
+ if (!DBGetContactSettingTString(hContact, modname, "PounceMsg",&dbv))
{
- char* newPounce = (char*)malloc(strlen(dbv.pszVal) + strlen(message) + 1);
+ TCHAR* newPounce = (TCHAR*)malloc(lstrlen(dbv.ptszVal) + lstrlen(message) + 1);
if (!newPounce) return 1;
- strcpy(newPounce, dbv.pszVal);
- strcat(newPounce, message);
- DBWriteContactSettingString(hContact, modname, "PounceMsg", newPounce);
+ _tcscpy(newPounce, dbv.ptszVal);
+ _tcscat(newPounce, message);
+ DBWriteContactSettingTString(hContact, modname, "PounceMsg", newPounce);
free(newPounce);
DBFreeVariant(&dbv);
}
@@ -266,12 +269,6 @@ extern "C" __declspec(dllexport) int Load(void) CreateServiceFunction("BuddyPounce/AddToPounce", AddToPounce); // add to the exsisitng pounce, if there isnt 1 then add a new simple pounce.
/* ******************************************************** */
- { // known modules list
- DBVARIANT dbv;
- if (DBGetContactSetting(NULL,"KnownModules","Buddy Pounce", &dbv))
- DBWriteContactSettingString(NULL,"KnownModules","Buddy Pounce",modname);
- DBFreeVariant(&dbv);
- }
return 0;
}
diff --git a/plugins/BuddyPounce/src/resource.h b/plugins/BuddyPounce/src/resource.h index 6ff38b88cc..6d9de9b857 100644 --- a/plugins/BuddyPounce/src/resource.h +++ b/plugins/BuddyPounce/src/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}}
-// Включаемый файл, созданный в Microsoft Visual C++.
-// Используется D:\MNG_orig\plugins\BuddyPounce\res\resource.rc
+// Microsoft Visual C++ generated include file.
+// Used by C:\Temp\Myranda\plugins\BuddyPounce\res\resource.rc
//
#define IDC_DELETE 5
#define IDC_DEFAULT 6
|