diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2015-05-17 17:25:51 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2015-05-17 17:25:51 +0000 |
commit | 6cd9de08e7748f894d14ce1947fcd8086ad0c175 (patch) | |
tree | bfea4a74a08bc05a9a377cbd06e75b9f07066c52 /plugins/PasteIt/src | |
parent | fef36df7c49e5cbfade4ff83a1115cac7ef2b82a (diff) |
cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@13665 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PasteIt/src')
-rw-r--r-- | plugins/PasteIt/src/Options.cpp | 890 | ||||
-rw-r--r-- | plugins/PasteIt/src/PasteIt.cpp | 138 | ||||
-rw-r--r-- | plugins/PasteIt/src/PasteToWeb.cpp | 436 | ||||
-rw-r--r-- | plugins/PasteIt/src/PasteToWeb1.cpp | 478 | ||||
-rw-r--r-- | plugins/PasteIt/src/PasteToWeb2.cpp | 102 | ||||
-rw-r--r-- | plugins/PasteIt/src/version.h | 2 |
6 files changed, 1022 insertions, 1024 deletions
diff --git a/plugins/PasteIt/src/Options.cpp b/plugins/PasteIt/src/Options.cpp index f64d148b51..ed4b314446 100644 --- a/plugins/PasteIt/src/Options.cpp +++ b/plugins/PasteIt/src/Options.cpp @@ -25,27 +25,27 @@ struct TCpTable { TCHAR *cpName;
}
cpTable[] = {
- { CP_ACP, LPGENT("Use default codepage") },
- { CP_UTF8, LPGENT("UTF-8") },
- { 874, LPGENT("Thai") },
- { 932, LPGENT("Japanese") },
- { 936, LPGENT("Simplified Chinese") },
- { 949, LPGENT("Korean") },
- { 950, LPGENT("Traditional Chinese") },
- { 1250, LPGENT("Central European") },
- { 1251, LPGENT("Cyrillic") },
- { 20866, LPGENT("Cyrillic KOI8-R") },
- { 1252, LPGENT("Latin I") },
- { 1253, LPGENT("Greek") },
- { 1254, LPGENT("Turkish") },
- { 1255, LPGENT("Hebrew") },
- { 1256, LPGENT("Arabic") },
- { 1257, LPGENT("Baltic") },
- { 1258, LPGENT("Vietnamese") },
- { 1361, LPGENT("Korean (Johab)") },
- { CP_UTF7, LPGENT("UTF-7") },
- { 1200, LPGENT("UTF-16") },
- { 1201, LPGENT("UTF-16BE") }
+ { CP_ACP, LPGENT("Use default codepage") },
+ { CP_UTF8, LPGENT("UTF-8") },
+ { 874, LPGENT("Thai") },
+ { 932, LPGENT("Japanese") },
+ { 936, LPGENT("Simplified Chinese") },
+ { 949, LPGENT("Korean") },
+ { 950, LPGENT("Traditional Chinese") },
+ { 1250, LPGENT("Central European") },
+ { 1251, LPGENT("Cyrillic") },
+ { 20866, LPGENT("Cyrillic KOI8-R") },
+ { 1252, LPGENT("Latin I") },
+ { 1253, LPGENT("Greek") },
+ { 1254, LPGENT("Turkish") },
+ { 1255, LPGENT("Hebrew") },
+ { 1256, LPGENT("Arabic") },
+ { 1257, LPGENT("Baltic") },
+ { 1258, LPGENT("Vietnamese") },
+ { 1361, LPGENT("Korean (Johab)") },
+ { CP_UTF7, LPGENT("UTF-7") },
+ { 1200, LPGENT("UTF-16") },
+ { 1201, LPGENT("UTF-16BE") }
};
Options::Options()
@@ -55,7 +55,7 @@ Options::Options() autoUTF = true;
confDlg = true;
autoSend = false;
- for(int i = 0 ; i < PasteToWeb::pages; ++i)
+ for (int i = 0; i < PasteToWeb::pages; ++i)
{
webOptions[i] = new WebOptions(i);
}
@@ -64,7 +64,7 @@ Options::Options() Options::~Options()
{
- for(int i = 0 ; i < PasteToWeb::pages; ++i)
+ for (int i = 0; i < PasteToWeb::pages; ++i)
{
delete webOptions[i];
webOptions[i] = NULL;
@@ -75,55 +75,55 @@ void DefWebPageChanged(); INT_PTR CALLBACK Options::DlgProcOptsMain(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
+ switch (msg)
{
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_AUTOUTF, instance->autoUTF ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CONFDLG, instance->confDlg ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOSEND, instance->autoSend ? BST_CHECKED : BST_UNCHECKED);
+ case WM_INITDIALOG:
+ {
+ TranslateDialogDefault(hwndDlg);
+ CheckDlgButton(hwndDlg, IDC_AUTOUTF, instance->autoUTF ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CONFDLG, instance->confDlg ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTOSEND, instance->autoSend ? BST_CHECKED : BST_UNCHECKED);
- for(int i = 0; i < PasteToWeb::pages; ++i)
- {
- ComboBox_AddString(GetDlgItem(hwndDlg, IDC_WEBLIST), pasteToWebs[i]->GetName());
- }
+ for (int i = 0; i < PasteToWeb::pages; ++i)
+ {
+ ComboBox_AddString(GetDlgItem(hwndDlg, IDC_WEBLIST), pasteToWebs[i]->GetName());
+ }
- ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_WEBLIST), instance->defWeb);
+ ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_WEBLIST), instance->defWeb);
- InitCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), instance->codepage);
- return TRUE;
- }
- case WM_COMMAND:
+ InitCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), instance->codepage);
+ return TRUE;
+ }
+ case WM_COMMAND:
+ {
+ if (LOWORD(wParam) == IDC_CODEPAGE)
{
- if(LOWORD(wParam) == IDC_CODEPAGE)
+ if (HIWORD(wParam) == CBN_KILLFOCUS)
{
- if(HIWORD(wParam) == CBN_KILLFOCUS)
- {
- GetCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), true, instance->codepage);
- }
+ GetCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), true, instance->codepage);
}
-
- if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam)==CBN_SELCHANGE || HIWORD(wParam)==CBN_EDITCHANGE)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- return TRUE;
}
- case WM_NOTIFY:
+
+ if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ return TRUE;
+ }
+ case WM_NOTIFY:
+ {
+ if (((LPNMHDR)lParam)->code == PSN_APPLY)
{
- if(((LPNMHDR)lParam)->code == PSN_APPLY)
- {
- instance->codepage = GetCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), false, instance->codepage);
- instance->autoUTF = IsDlgButtonChecked(hwndDlg, IDC_AUTOUTF) ? true : false;
- instance->confDlg = IsDlgButtonChecked(hwndDlg, IDC_CONFDLG) ? true : false;
- instance->autoSend = IsDlgButtonChecked(hwndDlg, IDC_AUTOSEND) ? true : false;
- instance->defWeb = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_WEBLIST));
+ instance->codepage = GetCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), false, instance->codepage);
+ instance->autoUTF = IsDlgButtonChecked(hwndDlg, IDC_AUTOUTF) ? true : false;
+ instance->confDlg = IsDlgButtonChecked(hwndDlg, IDC_CONFDLG) ? true : false;
+ instance->autoSend = IsDlgButtonChecked(hwndDlg, IDC_AUTOSEND) ? true : false;
+ instance->defWeb = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_WEBLIST));
- DefWebPageChanged();
+ DefWebPageChanged();
- Options::instance->Save();
- }
- return TRUE;
+ Options::instance->Save();
}
+ return TRUE;
+ }
}
return FALSE;
@@ -136,7 +136,7 @@ public: : lastPage(0)
{
init = false;
- for(int i = 0 ; i < PasteToWeb::pages; ++i)
+ for (int i = 0; i < PasteToWeb::pages; ++i)
{
webOptions[i] = Options::instance->webOptions[i]->Copy();
}
@@ -144,7 +144,7 @@ public: ~OptsPagesData()
{
- for(int i = 0 ; i < PasteToWeb::pages; ++i)
+ for (int i = 0; i < PasteToWeb::pages; ++i)
{
delete webOptions[i];
webOptions[i] = NULL;
@@ -170,17 +170,17 @@ struct OptsLoginData void ReloadFormatsCombo(HWND hWnd, WebOptions* wo)
{
- while(ComboBox_DeleteString(hWnd, 0) > 0);
+ while (ComboBox_DeleteString(hWnd, 0) > 0);
int sel = 0;
int i = 0;
- for(std::list<PasteFormat>::iterator it = wo->formats.begin(); it != wo->formats.end(); ++it)
+ for (std::list<PasteFormat>::iterator it = wo->formats.begin(); it != wo->formats.end(); ++it)
{
ComboBox_AddString(hWnd, it->name.c_str());
- if(it->id == wo->defFormatId)
+ if (it->id == wo->defFormatId)
sel = i;
++i;
}
- if(!wo->formats.empty())
+ if (!wo->formats.empty())
{
ComboBox_SetCurSel(hWnd, sel);
}
@@ -190,30 +190,30 @@ void GetPagesSettings(HWND hwndDlg, OptsPagesData* optsPagesData) {
int selected = optsPagesData->lastPage;
int format = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_DEFFORMAT));
- if(format >= 0 && format < (int)optsPagesData->webOptions[selected]->formats.size())
+ if (format >= 0 && format < (int)optsPagesData->webOptions[selected]->formats.size())
{
- for(std::list<PasteFormat>::iterator it = optsPagesData->webOptions[selected]->formats.begin(); it != optsPagesData->webOptions[selected]->formats.end(); ++it)
+ for (std::list<PasteFormat>::iterator it = optsPagesData->webOptions[selected]->formats.begin(); it != optsPagesData->webOptions[selected]->formats.end(); ++it)
{
- if(format-- <= 0)
+ if (format-- <= 0)
{
optsPagesData->webOptions[selected]->defFormatId = it->id;
break;
}
}
}
-
- if(optsPagesData->webOptions[selected]->isSendFileName)
+
+ if (optsPagesData->webOptions[selected]->isSendFileName)
optsPagesData->webOptions[selected]->sendFileName = IsDlgButtonChecked(hwndDlg, IDC_AUTOFORMAT) ? true : false;
- if(optsPagesData->webOptions[selected]->isPublicPaste)
+ if (optsPagesData->webOptions[selected]->isPublicPaste)
optsPagesData->webOptions[selected]->publicPaste = IsDlgButtonChecked(hwndDlg, IDC_PUBLICPASTE) ? true : false;
- if(optsPagesData->webOptions[selected]->isCombo1)
+ if (optsPagesData->webOptions[selected]->isCombo1)
{
- int sel = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_COMBO1));
- if(sel >= 0 && sel < (int)optsPagesData->webOptions[selected]->combo1Values.size())
+ int sel = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_COMBO1));
+ if (sel >= 0 && sel < (int)optsPagesData->webOptions[selected]->combo1Values.size())
{
- for(std::list<PasteFormat>::iterator it = optsPagesData->webOptions[selected]->combo1Values.begin(); it != optsPagesData->webOptions[selected]->combo1Values.end(); ++it)
+ for (std::list<PasteFormat>::iterator it = optsPagesData->webOptions[selected]->combo1Values.begin(); it != optsPagesData->webOptions[selected]->combo1Values.end(); ++it)
{
- if(sel-- <= 0)
+ if (sel-- <= 0)
{
optsPagesData->webOptions[selected]->combo1 = it->id;
break;
@@ -221,9 +221,9 @@ void GetPagesSettings(HWND hwndDlg, OptsPagesData* optsPagesData) }
}
}
- if(optsPagesData->webOptions[selected]->isPublicPaste)
+ if (optsPagesData->webOptions[selected]->isPublicPaste)
{
- if(IsDlgButtonChecked(hwndDlg, IDC_GUEST))
+ if (IsDlgButtonChecked(hwndDlg, IDC_GUEST))
{
optsPagesData->webOptions[selected]->pastebinUserKey = _T("");
}
@@ -238,65 +238,176 @@ void GetPagesSettings(HWND hwndDlg, OptsPagesData* optsPagesData) INT_PTR CALLBACK Options::DlgProcOptsPages(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
+ switch (msg)
{
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
+ {
+ TranslateDialogDefault(hwndDlg);
+ OptsPagesData* optsPagesData = new OptsPagesData();
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)optsPagesData);
+
+ HWND btnhwnd = GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN);
+ int btSize = Button_GetTextLength(btnhwnd);
+ if (btSize > 20)
{
- TranslateDialogDefault(hwndDlg);
- OptsPagesData* optsPagesData = new OptsPagesData();
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)optsPagesData);
-
- HWND btnhwnd = GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN);
- int btSize = Button_GetTextLength(btnhwnd);
- if(btSize > 20)
+ SetWindowPos(btnhwnd, NULL, 0, 0, 115, 34, SWP_NOZORDER | SWP_NOMOVE | SWP_NOREPOSITION | SWP_NOACTIVATE | SWP_NOREDRAW);
+ }
+
+ for (int i = 0; i < PasteToWeb::pages; ++i)
+ {
+ ComboBox_AddString(GetDlgItem(hwndDlg, IDC_WEBPAGE), pasteToWebs[i]->GetName());
+ }
+
+ ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_WEBPAGE), 0);
+ ReloadFormatsCombo(GetDlgItem(hwndDlg, IDC_DEFFORMAT), optsPagesData->webOptions[0]);
+ if (optsPagesData->webOptions[0]->isSendFileName)
+ CheckDlgButton(hwndDlg, IDC_AUTOFORMAT, optsPagesData->webOptions[0]->sendFileName ? BST_CHECKED : BST_UNCHECKED);
+ else
+ ShowWindow(GetDlgItem(hwndDlg, IDC_AUTOFORMAT), SW_HIDE);
+
+ if (Options::instance->webOptions[0]->isPublicPaste)
+ CheckDlgButton(hwndDlg, IDC_PUBLICPASTE, Options::instance->webOptions[0]->publicPaste ? BST_CHECKED : BST_UNCHECKED);
+ else
+ ShowWindow(GetDlgItem(hwndDlg, IDC_PUBLICPASTE), SW_HIDE);
+
+ if (Options::instance->webOptions[0]->isCombo1)
+ {
+ int sel = 0;
+ int i = 0;
+ std::wstring &val = Options::instance->webOptions[0]->combo1;
+ HWND cb = GetDlgItem(hwndDlg, IDC_COMBO1);
+ for (std::list<PasteFormat>::iterator it = Options::instance->webOptions[0]->combo1Values.begin(); it != Options::instance->webOptions[0]->combo1Values.end(); ++it)
{
- SetWindowPos(btnhwnd, NULL, 0, 0, 115, 34, SWP_NOZORDER | SWP_NOMOVE | SWP_NOREPOSITION | SWP_NOACTIVATE | SWP_NOREDRAW);
+ ComboBox_AddString(cb, it->name.c_str());
+ if (val == it->id)
+ sel = i;
+ ++i;
}
+ ComboBox_SetCurSel(cb, sel);
+ Static_SetText(GetDlgItem(hwndDlg, IDC_COMBO1_DESC), Options::instance->webOptions[0]->combo1Desc.c_str());
+ }
+ else
+ {
+ ShowWindow(GetDlgItem(hwndDlg, IDC_COMBO1), SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_COMBO1_DESC), SW_HIDE);
+ }
- for(int i = 0; i < PasteToWeb::pages; ++i)
+ Edit_LimitText(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), 99);
+ if (Options::instance->webOptions[0]->isPastebin)
+ {
+ std::wstring pastebinUserKey = Options::instance->webOptions[0]->pastebinUserKey;
+ if (pastebinUserKey.empty())
{
- ComboBox_AddString(GetDlgItem(hwndDlg, IDC_WEBPAGE), pasteToWebs[i]->GetName());
+ CheckDlgButton(hwndDlg, IDC_GUEST, BST_CHECKED);
+ Edit_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), FALSE);
+ Static_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), FALSE);
+ Button_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), FALSE);
}
+ else
+ {
+ Edit_SetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), pastebinUserKey.c_str());
+ }
+ }
+ else
+ {
+ ShowWindow(GetDlgItem(hwndDlg, IDC_GUEST), SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), SW_HIDE);
+ }
- ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_WEBPAGE), 0);
- ReloadFormatsCombo(GetDlgItem(hwndDlg, IDC_DEFFORMAT), optsPagesData->webOptions[0]);
- if(optsPagesData->webOptions[0]->isSendFileName)
- CheckDlgButton(hwndDlg, IDC_AUTOFORMAT, optsPagesData->webOptions[0]->sendFileName ? BST_CHECKED : BST_UNCHECKED);
+ optsPagesData->init = true;
+ return TRUE;
+ }
+ case WM_COMMAND:
+ {
+ OptsPagesData* optsPagesData = (OptsPagesData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_CONFIGURE)
+ {
+ GetPagesSettings(hwndDlg, optsPagesData);
+ OptsConfigureData d;
+ d.page = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_WEBPAGE));
+ WebOptions* wo = optsPagesData->webOptions[d.page];
+ d.tempFormats = wo->formats;
+ if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_CONFIGURE), hwndDlg, DlgProcOptsConfigure, (LPARAM)&d) == IDOK)
+ {
+ wo->formats = d.tempFormats;
+ ReloadFormatsCombo(GetDlgItem(hwndDlg, IDC_DEFFORMAT), wo);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ }
+ else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_PASTEBIN_LOGIN)
+ {
+ OptsLoginData d;
+ if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_PASTEBIN_LOGIN), hwndDlg, DlgProcOptsLogin, (LPARAM)&d) == IDOK)
+ {
+ PasteToWeb1 *web = (PasteToWeb1*)pasteToWebs[optsPagesData->lastPage];
+ Edit_SetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), web->GetUserKey(d.user, d.password).c_str());
+ }
+ }
+ else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_GUEST)
+ {
+ BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_GUEST) ? FALSE : TRUE;
+ Edit_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), enabled);
+ Static_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), enabled);
+ Button_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), enabled);
+ }
+ else if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_WEBPAGE)
+ {
+ GetPagesSettings(hwndDlg, optsPagesData);
+ optsPagesData->init = false;
+ optsPagesData->lastPage = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_WEBPAGE));
+ ReloadFormatsCombo(GetDlgItem(hwndDlg, IDC_DEFFORMAT), optsPagesData->webOptions[optsPagesData->lastPage]);
+ if (optsPagesData->webOptions[optsPagesData->lastPage]->isSendFileName)
+ {
+ ShowWindow(GetDlgItem(hwndDlg, IDC_AUTOFORMAT), SW_SHOW);
+ CheckDlgButton(hwndDlg, IDC_AUTOFORMAT, optsPagesData->webOptions[optsPagesData->lastPage]->sendFileName ? BST_CHECKED : BST_UNCHECKED);
+ }
else
- ShowWindow(GetDlgItem(hwndDlg,IDC_AUTOFORMAT),SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_AUTOFORMAT), SW_HIDE);
- if(Options::instance->webOptions[0]->isPublicPaste)
- CheckDlgButton(hwndDlg, IDC_PUBLICPASTE, Options::instance->webOptions[0]->publicPaste ? BST_CHECKED : BST_UNCHECKED);
+ if (optsPagesData->webOptions[optsPagesData->lastPage]->isPublicPaste)
+ {
+ ShowWindow(GetDlgItem(hwndDlg, IDC_PUBLICPASTE), SW_SHOW);
+ CheckDlgButton(hwndDlg, IDC_PUBLICPASTE, optsPagesData->webOptions[optsPagesData->lastPage]->publicPaste ? BST_CHECKED : BST_UNCHECKED);
+ }
else
- ShowWindow(GetDlgItem(hwndDlg,IDC_PUBLICPASTE),SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_PUBLICPASTE), SW_HIDE);
- if(Options::instance->webOptions[0]->isCombo1)
+ if (optsPagesData->webOptions[optsPagesData->lastPage]->isCombo1)
{
+ ShowWindow(GetDlgItem(hwndDlg, IDC_COMBO1), SW_SHOW);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_COMBO1_DESC), SW_SHOW);
int sel = 0;
int i = 0;
- std::wstring &val = Options::instance->webOptions[0]->combo1;
+ std::wstring &val = optsPagesData->webOptions[optsPagesData->lastPage]->combo1;
HWND cb = GetDlgItem(hwndDlg, IDC_COMBO1);
- for(std::list<PasteFormat>::iterator it = Options::instance->webOptions[0]->combo1Values.begin(); it != Options::instance->webOptions[0]->combo1Values.end(); ++it)
+ while (ComboBox_DeleteString(cb, 0) > 0);
+ for (std::list<PasteFormat>::iterator it = optsPagesData->webOptions[optsPagesData->lastPage]->combo1Values.begin(); it != optsPagesData->webOptions[optsPagesData->lastPage]->combo1Values.end(); ++it)
{
ComboBox_AddString(cb, it->name.c_str());
- if(val == it->id)
+ if (val == it->id)
sel = i;
++i;
}
- ComboBox_SetCurSel(cb, sel);
- Static_SetText(GetDlgItem(hwndDlg,IDC_COMBO1_DESC), Options::instance->webOptions[0]->combo1Desc.c_str());
+ ComboBox_SetCurSel(cb, sel);
+ SetDlgItemText(hwndDlg, IDC_COMBO1_DESC, optsPagesData->webOptions[optsPagesData->lastPage]->combo1Desc.c_str());
}
else
{
- ShowWindow(GetDlgItem(hwndDlg,IDC_COMBO1),SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg,IDC_COMBO1_DESC),SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_COMBO1), SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_COMBO1_DESC), SW_HIDE);
}
- Edit_LimitText(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), 99);
- if(Options::instance->webOptions[0]->isPastebin)
+
+ if (optsPagesData->webOptions[optsPagesData->lastPage]->isPastebin)
{
- std::wstring pastebinUserKey = Options::instance->webOptions[0]->pastebinUserKey;
- if(pastebinUserKey.empty())
+ ShowWindow(GetDlgItem(hwndDlg, IDC_GUEST), SW_SHOW);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), SW_SHOW);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), SW_SHOW);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), SW_SHOW);
+ std::wstring pastebinUserKey = optsPagesData->webOptions[optsPagesData->lastPage]->pastebinUserKey;
+ if (pastebinUserKey.empty())
{
CheckDlgButton(hwndDlg, IDC_GUEST, BST_CHECKED);
Edit_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), FALSE);
@@ -305,8 +416,13 @@ INT_PTR CALLBACK Options::DlgProcOptsPages(HWND hwndDlg, UINT msg, WPARAM wParam }
else
{
- Edit_SetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), pastebinUserKey.c_str());
+ CheckDlgButton(hwndDlg, IDC_GUEST, BST_UNCHECKED);
+ Edit_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), TRUE);
+ Static_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), TRUE);
+ Button_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), TRUE);
}
+
+ Edit_SetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), pastebinUserKey.c_str());
}
else
{
@@ -317,150 +433,34 @@ INT_PTR CALLBACK Options::DlgProcOptsPages(HWND hwndDlg, UINT msg, WPARAM wParam }
optsPagesData->init = true;
- return TRUE;
}
- case WM_COMMAND:
+
+ if (optsPagesData->init && ((HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) != IDC_CONFIGURE && LOWORD(wParam) != IDC_PASTEBIN_LOGIN) || (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) != IDC_WEBPAGE) || HIWORD(wParam) == EN_CHANGE))
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ return TRUE;
+ }
+ case WM_NOTIFY:
+ {
+ if (((LPNMHDR)lParam)->code == PSN_APPLY)
{
OptsPagesData* optsPagesData = (OptsPagesData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_CONFIGURE)
+ GetPagesSettings(hwndDlg, optsPagesData);
+ for (int i = 0; i < PasteToWeb::pages; ++i)
{
- GetPagesSettings(hwndDlg, optsPagesData);
- OptsConfigureData d;
- d.page = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_WEBPAGE));
- WebOptions* wo = optsPagesData->webOptions[d.page];
- d.tempFormats = wo->formats;
- if(DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_CONFIGURE), hwndDlg, DlgProcOptsConfigure, (LPARAM)&d) == IDOK)
- {
- wo->formats = d.tempFormats;
- ReloadFormatsCombo(GetDlgItem(hwndDlg, IDC_DEFFORMAT), wo);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
- else if(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_PASTEBIN_LOGIN)
- {
- OptsLoginData d;
- if(DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_PASTEBIN_LOGIN), hwndDlg, DlgProcOptsLogin, (LPARAM)&d) == IDOK)
- {
- PasteToWeb1 *web = (PasteToWeb1*)pasteToWebs[optsPagesData->lastPage];
- Edit_SetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), web->GetUserKey(d.user, d.password).c_str());
- }
- }
- else if(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_GUEST)
- {
- BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_GUEST) ? FALSE : TRUE;
- Edit_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), enabled);
- Static_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), enabled);
- Button_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), enabled);
- }
- else if(HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_WEBPAGE)
- {
- GetPagesSettings(hwndDlg, optsPagesData);
- optsPagesData->init = false;
- optsPagesData->lastPage = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_WEBPAGE));
- ReloadFormatsCombo(GetDlgItem(hwndDlg, IDC_DEFFORMAT), optsPagesData->webOptions[optsPagesData->lastPage]);
- if(optsPagesData->webOptions[optsPagesData->lastPage]->isSendFileName)
- {
- ShowWindow(GetDlgItem(hwndDlg,IDC_AUTOFORMAT),SW_SHOW);
- CheckDlgButton(hwndDlg, IDC_AUTOFORMAT, optsPagesData->webOptions[optsPagesData->lastPage]->sendFileName ? BST_CHECKED : BST_UNCHECKED);
- }
- else
- ShowWindow(GetDlgItem(hwndDlg,IDC_AUTOFORMAT),SW_HIDE);
-
- if(optsPagesData->webOptions[optsPagesData->lastPage]->isPublicPaste)
- {
- ShowWindow(GetDlgItem(hwndDlg,IDC_PUBLICPASTE),SW_SHOW);
- CheckDlgButton(hwndDlg, IDC_PUBLICPASTE, optsPagesData->webOptions[optsPagesData->lastPage]->publicPaste ? BST_CHECKED : BST_UNCHECKED);
- }
- else
- ShowWindow(GetDlgItem(hwndDlg,IDC_PUBLICPASTE),SW_HIDE);
-
- if(optsPagesData->webOptions[optsPagesData->lastPage]->isCombo1)
- {
- ShowWindow(GetDlgItem(hwndDlg,IDC_COMBO1),SW_SHOW);
- ShowWindow(GetDlgItem(hwndDlg,IDC_COMBO1_DESC),SW_SHOW);
- int sel = 0;
- int i = 0;
- std::wstring &val = optsPagesData->webOptions[optsPagesData->lastPage]->combo1;
- HWND cb = GetDlgItem(hwndDlg, IDC_COMBO1);
- while(ComboBox_DeleteString(cb, 0) > 0);
- for(std::list<PasteFormat>::iterator it = optsPagesData->webOptions[optsPagesData->lastPage]->combo1Values.begin(); it != optsPagesData->webOptions[optsPagesData->lastPage]->combo1Values.end(); ++it)
- {
- ComboBox_AddString(cb, it->name.c_str());
- if(val == it->id)
- sel = i;
- ++i;
- }
- ComboBox_SetCurSel(cb, sel);
- SetDlgItemText(hwndDlg, IDC_COMBO1_DESC, optsPagesData->webOptions[optsPagesData->lastPage]->combo1Desc.c_str());
- }
- else
- {
- ShowWindow(GetDlgItem(hwndDlg,IDC_COMBO1),SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg,IDC_COMBO1_DESC),SW_HIDE);
- }
-
-
- if(optsPagesData->webOptions[optsPagesData->lastPage]->isPastebin)
- {
- ShowWindow(GetDlgItem(hwndDlg, IDC_GUEST), SW_SHOW);
- ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), SW_SHOW);
- ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), SW_SHOW);
- ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), SW_SHOW);
- std::wstring pastebinUserKey = optsPagesData->webOptions[optsPagesData->lastPage]->pastebinUserKey;
- if(pastebinUserKey.empty())
- {
- CheckDlgButton(hwndDlg, IDC_GUEST, BST_CHECKED);
- Edit_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), FALSE);
- Static_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), FALSE);
- Button_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), FALSE);
- }
- else
- {
- CheckDlgButton(hwndDlg, IDC_GUEST, BST_UNCHECKED);
- Edit_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), TRUE);
- Static_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), TRUE);
- Button_Enable(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), TRUE);
- }
-
- Edit_SetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), pastebinUserKey.c_str());
- }
- else
- {
- ShowWindow(GetDlgItem(hwndDlg, IDC_GUEST), SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY), SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_KEY_DESC), SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_PASTEBIN_LOGIN), SW_HIDE);
- }
-
- optsPagesData->init = true;
+ *Options::instance->webOptions[i] = *optsPagesData->webOptions[i];
}
-
- if (optsPagesData->init && ((HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) != IDC_CONFIGURE && LOWORD(wParam) != IDC_PASTEBIN_LOGIN) || (HIWORD(wParam)==CBN_SELCHANGE && LOWORD(wParam) != IDC_WEBPAGE) || HIWORD(wParam) == EN_CHANGE))
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- return TRUE;
- }
- case WM_NOTIFY:
- {
- if(((LPNMHDR)lParam)->code == PSN_APPLY)
- {
- OptsPagesData* optsPagesData = (OptsPagesData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetPagesSettings(hwndDlg, optsPagesData);
- for(int i = 0 ; i < PasteToWeb::pages; ++i)
- {
- *Options::instance->webOptions[i] = *optsPagesData->webOptions[i];
- }
- Options::instance->Save();
- }
- return TRUE;
- }
- case WM_CLOSE:
- {
- OptsPagesData* optsPagesData = (OptsPagesData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- delete optsPagesData;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
- break;
+ Options::instance->Save();
}
+ return TRUE;
+ }
+ case WM_CLOSE:
+ {
+ OptsPagesData* optsPagesData = (OptsPagesData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ delete optsPagesData;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
+ break;
+ }
}
return FALSE;
@@ -468,14 +468,14 @@ INT_PTR CALLBACK Options::DlgProcOptsPages(HWND hwndDlg, UINT msg, WPARAM wParam void SelectLbConfigure(HWND hwndDlg, int sel, OptsConfigureData* optsConfigureData)
{
- if(sel >= 0 && sel < (int)optsConfigureData->tempFormats.size())
+ if (sel >= 0 && sel < (int)optsConfigureData->tempFormats.size())
{
Button_Enable(GetDlgItem(hwndDlg, IDC_DELETE), TRUE);
- if(sel == 0)
+ if (sel == 0)
Button_Enable(GetDlgItem(hwndDlg, IDC_UP), FALSE);
else
Button_Enable(GetDlgItem(hwndDlg, IDC_UP), TRUE);
- if(sel + 1 == optsConfigureData->tempFormats.size())
+ if (sel + 1 == optsConfigureData->tempFormats.size())
Button_Enable(GetDlgItem(hwndDlg, IDC_DOWN), FALSE);
else
Button_Enable(GetDlgItem(hwndDlg, IDC_DOWN), TRUE);
@@ -490,152 +490,152 @@ void SelectLbConfigure(HWND hwndDlg, int sel, OptsConfigureData* optsConfigureDa INT_PTR CALLBACK Options::DlgProcOptsConfigure(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
+ switch (msg)
{
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- OptsConfigureData* optsConfigureData = (OptsConfigureData*)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
-
- HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING);
- for(std::list<PasteFormat>::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it)
- {
- ListBox_AddString(lb, it->name.c_str());
- }
+ case WM_INITDIALOG:
+ {
+ TranslateDialogDefault(hwndDlg);
+ OptsConfigureData* optsConfigureData = (OptsConfigureData*)lParam;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- SelectLbConfigure(hwndDlg, -1, optsConfigureData);
- return TRUE;
+ HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING);
+ for (std::list<PasteFormat>::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it)
+ {
+ ListBox_AddString(lb, it->name.c_str());
}
- case WM_COMMAND:
+
+ SelectLbConfigure(hwndDlg, -1, optsConfigureData);
+ return TRUE;
+ }
+ case WM_COMMAND:
+ {
+ if (HIWORD(wParam) == BN_CLICKED)
{
- if (HIWORD(wParam) == BN_CLICKED)
+ if (LOWORD(wParam) == IDOK)
{
- if (LOWORD(wParam) == IDOK)
- {
- EndDialog(hwndDlg, IDOK);
- }
- else if (LOWORD(wParam) == IDCANCEL)
- {
- EndDialog(hwndDlg, IDCANCEL);
- }
- else if (LOWORD(wParam) == IDC_DELETE)
+ EndDialog(hwndDlg, IDOK);
+ }
+ else if (LOWORD(wParam) == IDCANCEL)
+ {
+ EndDialog(hwndDlg, IDCANCEL);
+ }
+ else if (LOWORD(wParam) == IDC_DELETE)
+ {
+ HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING);
+ OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ int sel = ListBox_GetCurSel(lb);
+ if (sel >= 0)
{
- HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING);
- OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- int sel = ListBox_GetCurSel(lb);
- if(sel >= 0)
+ ListBox_DeleteString(lb, sel);
+ int i = sel;
+ for (std::list<PasteFormat>::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it)
{
- ListBox_DeleteString(lb, sel);
- int i = sel;
- for(std::list<PasteFormat>::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it)
+ if (i-- <= 0)
{
- if(i-- <= 0)
- {
- optsConfigureData->tempFormats.erase(it);
- ListBox_SetCurSel(lb, sel);
- SelectLbConfigure(hwndDlg, sel, optsConfigureData);
- break;
- }
+ optsConfigureData->tempFormats.erase(it);
+ ListBox_SetCurSel(lb, sel);
+ SelectLbConfigure(hwndDlg, sel, optsConfigureData);
+ break;
}
}
}
- else if (LOWORD(wParam) == IDC_UP)
+ }
+ else if (LOWORD(wParam) == IDC_UP)
+ {
+ HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING);
+ OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ int sel = ListBox_GetCurSel(lb);
+ if (sel > 0)
{
- HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING);
- OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- int sel = ListBox_GetCurSel(lb);
- if(sel > 0)
+ int i = sel;
+ for (std::list<PasteFormat>::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it)
{
- int i = sel;
- for(std::list<PasteFormat>::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it)
+ if (i-- <= 0)
{
- if(i-- <= 0)
- {
- PasteFormat pf = *it;
- std::list<PasteFormat>::iterator prevIt = it;
- --prevIt;
- optsConfigureData->tempFormats.erase(it);
- optsConfigureData->tempFormats.insert(prevIt, pf);
- ListBox_DeleteString(lb, sel--);
- ListBox_InsertString(lb, sel, pf.name.c_str());
- ListBox_SetCurSel(lb, sel);
- SelectLbConfigure(hwndDlg, sel, optsConfigureData);
- break;
- }
+ PasteFormat pf = *it;
+ std::list<PasteFormat>::iterator prevIt = it;
+ --prevIt;
+ optsConfigureData->tempFormats.erase(it);
+ optsConfigureData->tempFormats.insert(prevIt, pf);
+ ListBox_DeleteString(lb, sel--);
+ ListBox_InsertString(lb, sel, pf.name.c_str());
+ ListBox_SetCurSel(lb, sel);
+ SelectLbConfigure(hwndDlg, sel, optsConfigureData);
+ break;
}
}
}
- else if (LOWORD(wParam) == IDC_DOWN)
+ }
+ else if (LOWORD(wParam) == IDC_DOWN)
+ {
+ HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING);
+ OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ int sel = ListBox_GetCurSel(lb);
+ if (sel >= 0 && sel + 1 < (int)optsConfigureData->tempFormats.size())
{
- HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING);
- OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- int sel = ListBox_GetCurSel(lb);
- if(sel >= 0 && sel + 1 < (int)optsConfigureData->tempFormats.size())
+ int i = sel;
+ for (std::list<PasteFormat>::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it)
{
- int i = sel;
- for(std::list<PasteFormat>::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it)
+ if (i-- <= 0)
{
- if(i-- <= 0)
- {
- PasteFormat pf = *it;
- std::list<PasteFormat>::iterator nextIt = it;
- ++(++nextIt);
- optsConfigureData->tempFormats.erase(it);
- optsConfigureData->tempFormats.insert(nextIt, pf);
- ListBox_DeleteString(lb, sel++);
- ListBox_InsertString(lb, sel, pf.name.c_str());
- ListBox_SetCurSel(lb, sel);
- SelectLbConfigure(hwndDlg, sel, optsConfigureData);
- break;
- }
+ PasteFormat pf = *it;
+ std::list<PasteFormat>::iterator nextIt = it;
+ ++(++nextIt);
+ optsConfigureData->tempFormats.erase(it);
+ optsConfigureData->tempFormats.insert(nextIt, pf);
+ ListBox_DeleteString(lb, sel++);
+ ListBox_InsertString(lb, sel, pf.name.c_str());
+ ListBox_SetCurSel(lb, sel);
+ SelectLbConfigure(hwndDlg, sel, optsConfigureData);
+ break;
}
}
}
- else if(LOWORD(wParam) == IDC_DOWNLOAD)
- {
- OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING);
- while(ListBox_DeleteString(lb, 0) > 0);
- SelectLbConfigure(hwndDlg, -1, optsConfigureData);
- optsConfigureData->tempFormats = pasteToWebs[optsConfigureData->page]->GetFormats();
- for(std::list<PasteFormat>::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it)
- {
- ListBox_AddString(lb, it->name.c_str());
- }
- }
- else if(LOWORD(wParam) == IDC_RESTORE)
+ }
+ else if (LOWORD(wParam) == IDC_DOWNLOAD)
+ {
+ OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING);
+ while (ListBox_DeleteString(lb, 0) > 0);
+ SelectLbConfigure(hwndDlg, -1, optsConfigureData);
+ optsConfigureData->tempFormats = pasteToWebs[optsConfigureData->page]->GetFormats();
+ for (std::list<PasteFormat>::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it)
{
- OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING);
- while(ListBox_DeleteString(lb, 0) > 0);
- SelectLbConfigure(hwndDlg, -1, optsConfigureData);
- optsConfigureData->tempFormats = pasteToWebs[optsConfigureData->page]->GetDefFormats();
- for(std::list<PasteFormat>::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it)
- {
- ListBox_AddString(lb, it->name.c_str());
- }
+ ListBox_AddString(lb, it->name.c_str());
}
}
- else if(HIWORD(wParam) == LBN_SELCHANGE && LOWORD(wParam) == IDC_FORMATTING)
+ else if (LOWORD(wParam) == IDC_RESTORE)
{
OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- int sel = ListBox_GetCurSel(GetDlgItem(hwndDlg, IDC_FORMATTING));
- SelectLbConfigure(hwndDlg, sel, optsConfigureData);
+ HWND lb = GetDlgItem(hwndDlg, IDC_FORMATTING);
+ while (ListBox_DeleteString(lb, 0) > 0);
+ SelectLbConfigure(hwndDlg, -1, optsConfigureData);
+ optsConfigureData->tempFormats = pasteToWebs[optsConfigureData->page]->GetDefFormats();
+ for (std::list<PasteFormat>::iterator it = optsConfigureData->tempFormats.begin(); it != optsConfigureData->tempFormats.end(); ++it)
+ {
+ ListBox_AddString(lb, it->name.c_str());
+ }
}
- return TRUE;
}
- case WM_VKEYTOITEM:
- if(LOWORD(wParam) == VK_DELETE && (HWND)lParam == GetDlgItem(hwndDlg, IDC_FORMATTING))
- {
- DlgProcOptsConfigure(hwndDlg, WM_COMMAND, MAKELONG(IDC_DELETE, BN_CLICKED), NULL);
- return -2;
- }
- return -1;
- case WM_NOTIFY:
+ else if (HIWORD(wParam) == LBN_SELCHANGE && LOWORD(wParam) == IDC_FORMATTING)
{
- return TRUE;
+ OptsConfigureData* optsConfigureData = (OptsConfigureData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ int sel = ListBox_GetCurSel(GetDlgItem(hwndDlg, IDC_FORMATTING));
+ SelectLbConfigure(hwndDlg, sel, optsConfigureData);
}
+ return TRUE;
+ }
+ case WM_VKEYTOITEM:
+ if (LOWORD(wParam) == VK_DELETE && (HWND)lParam == GetDlgItem(hwndDlg, IDC_FORMATTING))
+ {
+ DlgProcOptsConfigure(hwndDlg, WM_COMMAND, MAKELONG(IDC_DELETE, BN_CLICKED), NULL);
+ return -2;
+ }
+ return -1;
+ case WM_NOTIFY:
+ {
+ return TRUE;
+ }
}
return FALSE;
@@ -643,41 +643,41 @@ INT_PTR CALLBACK Options::DlgProcOptsConfigure(HWND hwndDlg, UINT msg, WPARAM wP INT_PTR CALLBACK Options::DlgProcOptsLogin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
+ switch (msg)
{
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- Edit_LimitText(GetDlgItem(hwndDlg, IDC_PASTEBIN_USER), 99);
- Edit_LimitText(GetDlgItem(hwndDlg, IDC_PASTEBIN_PASSWORD), 99);
- return TRUE;
- }
- case WM_COMMAND:
+ case WM_INITDIALOG:
+ {
+ TranslateDialogDefault(hwndDlg);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+ Edit_LimitText(GetDlgItem(hwndDlg, IDC_PASTEBIN_USER), 99);
+ Edit_LimitText(GetDlgItem(hwndDlg, IDC_PASTEBIN_PASSWORD), 99);
+ return TRUE;
+ }
+ case WM_COMMAND:
+ {
+ if (HIWORD(wParam) == BN_CLICKED)
{
- if (HIWORD(wParam) == BN_CLICKED)
+ if (LOWORD(wParam) == IDOK)
{
- if (LOWORD(wParam) == IDOK)
- {
- TCHAR buf[100];
- OptsLoginData* optsLoginData = (OptsLoginData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- Edit_GetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_USER), buf, 100);
- optsLoginData->user = buf;
- Edit_GetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_PASSWORD), buf, 100);
- optsLoginData->password = buf;
- EndDialog(hwndDlg, IDOK);
- }
- else if (LOWORD(wParam) == IDCANCEL)
- {
- EndDialog(hwndDlg, IDCANCEL);
- }
+ TCHAR buf[100];
+ OptsLoginData* optsLoginData = (OptsLoginData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ Edit_GetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_USER), buf, 100);
+ optsLoginData->user = buf;
+ Edit_GetText(GetDlgItem(hwndDlg, IDC_PASTEBIN_PASSWORD), buf, 100);
+ optsLoginData->password = buf;
+ EndDialog(hwndDlg, IDOK);
+ }
+ else if (LOWORD(wParam) == IDCANCEL)
+ {
+ EndDialog(hwndDlg, IDCANCEL);
}
- return TRUE;
- }
- case WM_NOTIFY:
- {
- return TRUE;
}
+ return TRUE;
+ }
+ case WM_NOTIFY:
+ {
+ return TRUE;
+ }
}
return FALSE;
@@ -686,13 +686,13 @@ INT_PTR CALLBACK Options::DlgProcOptsLogin(HWND hwndDlg, UINT msg, WPARAM wParam unsigned int Options::GetCodepageCB(HWND hwndCB, bool errorReport, unsigned int defCp)
{
int selCpIdx = ComboBox_GetCurSel(hwndCB);
- if(selCpIdx < 0)
+ if (selCpIdx < 0)
{
TCHAR text[128];
ComboBox_GetText(hwndCB, text, 128);
TCHAR * stopOn = NULL;
long cp = _tcstol(text, &stopOn, 10);
- if(errorReport && (stopOn == text || *stopOn != '\0' || cp < 0 || cp > 0xffff))
+ if (errorReport && (stopOn == text || *stopOn != '\0' || cp < 0 || cp > 0xffff))
{
MessageBox(GetParent(hwndCB), TranslateT("You've entered invalid codepage. Select codepage from combo box or enter correct number."), TranslateT("Invalid codepage"), MB_OK | MB_ICONERROR);
SetFocus(hwndCB);
@@ -716,22 +716,22 @@ void Options::InitCodepageCB(HWND hwndCB, unsigned int codepage) {
int cpCount = sizeof(cpTable) / sizeof(cpTable[0]);
int selCpIdx = -1;
- for(int i = 0; i < cpCount; ++i)
+ for (int i = 0; i < cpCount; ++i)
{
ComboBox_AddString(hwndCB, TranslateTS(cpTable[i].cpName));
- if(cpTable[i].cpId == codepage)
+ if (cpTable[i].cpId == codepage)
selCpIdx = i;
}
- if(selCpIdx == -1)
+ if (selCpIdx == -1)
{
TCHAR buf[10];
mir_sntprintf(buf, SIZEOF(buf), _T("%d"), codepage);
- ComboBox_SetText(hwndCB, buf);
+ ComboBox_SetText(hwndCB, buf);
}
else
{
- ComboBox_SetCurSel(hwndCB, selCpIdx);
+ ComboBox_SetCurSel(hwndCB, selCpIdx);
}
ComboBox_LimitText(hwndCB, 127);
@@ -741,21 +741,21 @@ void Options::SetCodepageCB(HWND hwndCB, unsigned int codepage) {
int cpCount = sizeof(cpTable) / sizeof(cpTable[0]);
int selCpIdx = -1;
- for(int i = 0; i < cpCount; ++i)
+ for (int i = 0; i < cpCount; ++i)
{
- if(cpTable[i].cpId == codepage)
+ if (cpTable[i].cpId == codepage)
selCpIdx = i;
}
- if(selCpIdx == -1)
+ if (selCpIdx == -1)
{
TCHAR buf[10];
mir_sntprintf(buf, SIZEOF(buf), _T("%d"), codepage);
- ComboBox_SetText(hwndCB, buf);
+ ComboBox_SetText(hwndCB, buf);
}
else
{
- ComboBox_SetCurSel(hwndCB, selCpIdx);
+ ComboBox_SetCurSel(hwndCB, selCpIdx);
}
}
@@ -787,51 +787,51 @@ void Options::Save() db_set_b(0, MODULE, "autoUTF", autoUTF ? 1 : 0);
db_set_b(0, MODULE, "confDlg", confDlg ? 1 : 0);
db_set_b(0, MODULE, "autoSend", autoSend ? 1 : 0);
- for(int i = 0 ; i < PasteToWeb::pages; ++i)
+ for (int i = 0; i < PasteToWeb::pages; ++i)
{
char buf[256];
TCHAR* name = pasteToWebs[i]->GetName();
int j = 0;
- while(name[j])
+ while (name[j])
{
buf[j] = (char)name[j];
++j;
}
buf[j++] = '_';
- strcpy_s(buf + j, 256 - j, "formats");
+ mir_strncpy(buf + j, "formats", SIZEOF(buf) - j);
std::wstring forms;
- for(std::list<PasteFormat>::iterator it = webOptions[i]->formats.begin(); it != webOptions[i]->formats.end(); ++it)
+ for (std::list<PasteFormat>::iterator it = webOptions[i]->formats.begin(); it != webOptions[i]->formats.end(); ++it)
{
forms += it->id + L'=' + it->name + L';';
}
db_set_ws(0, MODULE, buf, forms.c_str());
- strcpy_s(buf + j, 256 - j, "defFormatId");
+ mir_strncpy(buf + j, "defFormatId", SIZEOF(buf) - j);
db_set_ws(0, MODULE, buf, webOptions[i]->defFormatId.c_str());
- if(webOptions[i]->isSendFileName)
+ if (webOptions[i]->isSendFileName)
{
- strcpy_s(buf + j, 256 - j, "sendFileName");
+ mir_strncpy(buf + j, "sendFileName", SIZEOF(buf) - j);
db_set_b(0, MODULE, buf, webOptions[i]->sendFileName ? 1 : 0);
}
-
- if(webOptions[i]->isPublicPaste)
+
+ if (webOptions[i]->isPublicPaste)
{
- strcpy_s(buf + j, 256 - j, "publicPaste");
+ mir_strncpy(buf + j, "publicPaste", SIZEOF(buf) - j);
db_set_b(0, MODULE, buf, webOptions[i]->publicPaste ? 1 : 0);
}
- if(webOptions[i]->isCombo1)
+ if (webOptions[i]->isCombo1)
{
- strcpy_s(buf + j, 256 - j, "combo1");
+ mir_strncpy(buf + j, "combo1", SIZEOF(buf) - j);
db_set_ws(0, MODULE, buf, webOptions[i]->combo1.c_str());
}
- if(webOptions[i]->isPastebin)
+ if (webOptions[i]->isPastebin)
{
- strcpy_s(buf + j, 256 - j, "pastebinUserKey");
+ mir_strncpy(buf + j, "pastebinUserKey", SIZEOF(buf) - j);
db_set_ws(0, MODULE, buf, webOptions[i]->pastebinUserKey.c_str());
}
}
@@ -840,11 +840,11 @@ void Options::Save() void Options::Load()
{
DBVARIANT defWebV;
- if(!db_get_ws(0, MODULE, "defWeb", &defWebV))
+ if (!db_get_ws(0, MODULE, "defWeb", &defWebV))
{
- for(int i = 0; i < PasteToWeb::pages; ++i)
+ for (int i = 0; i < PasteToWeb::pages; ++i)
{
- if(!wcscmp(pasteToWebs[i]->GetName(), defWebV.pwszVal))
+ if (!mir_wstrcmp(pasteToWebs[i]->GetName(), defWebV.pwszVal))
{
defWeb = i;
break;
@@ -856,34 +856,34 @@ void Options::Load() autoUTF = db_get_b(0, MODULE, "autoUTF", 1) ? true : false;
confDlg = db_get_b(0, MODULE, "confDlg", 1) ? true : false;
autoSend = db_get_b(0, MODULE, "autoSend", 0) ? true : false;
- for(int i = 0 ; i < PasteToWeb::pages; ++i)
+ for (int i = 0; i < PasteToWeb::pages; ++i)
{
char buf[256];
TCHAR* name = pasteToWebs[i]->GetName();
int j = 0;
- while(name[j])
+ while (name[j])
{
buf[j] = (char)name[j];
++j;
}
buf[j++] = '_';
- strcpy_s(buf + j, 256 - j, "formats");
+ mir_strncpy(buf + j, "formats", SIZEOF(buf) - j);
DBVARIANT forms;
- if(!db_get_ws(0, MODULE, buf, &forms))
+ if (!db_get_ws(0, MODULE, buf, &forms))
{
webOptions[i]->formats.clear();
int k = 0;
wchar_t * id = forms.pwszVal;
wchar_t * name = NULL;
- while(forms.pwszVal[k])
+ while (forms.pwszVal[k])
{
- if(forms.pwszVal[k] == L'=')
+ if (forms.pwszVal[k] == L'=')
{
forms.pwszVal[k] = 0;
name = forms.pwszVal + k + 1;
}
- else if(forms.pwszVal[k] == L';')
+ else if (forms.pwszVal[k] == L';')
{
forms.pwszVal[k] = 0;
PasteFormat pf;
@@ -899,42 +899,42 @@ void Options::Load() db_free(&forms);
}
- strcpy_s(buf + j, 256 - j, "defFormatId");
+ mir_strncpy(buf + j, "defFormatId", SIZEOF(buf) - j);
DBVARIANT defForm;
- if(!db_get_ws(0, MODULE, buf, &defForm))
+ if (!db_get_ws(0, MODULE, buf, &defForm))
{
webOptions[i]->defFormatId = defForm.pwszVal;
db_free(&defForm);
}
- if(webOptions[i]->isSendFileName)
+ if (webOptions[i]->isSendFileName)
{
- strcpy_s(buf + j, 256 - j, "sendFileName");
+ mir_strncpy(buf + j, "sendFileName", SIZEOF(buf) - j);
webOptions[i]->sendFileName = db_get_b(0, MODULE, buf, 1) ? true : false;
}
-
- if(webOptions[i]->isPublicPaste)
+
+ if (webOptions[i]->isPublicPaste)
{
- strcpy_s(buf + j, 256 - j, "publicPaste");
+ mir_strncpy(buf + j, "publicPaste", SIZEOF(buf) - j);
webOptions[i]->publicPaste = db_get_b(0, MODULE, buf, 0) ? true : false;
}
- if(webOptions[i]->isCombo1)
+ if (webOptions[i]->isCombo1)
{
- strcpy_s(buf + j, 256 - j, "combo1");
+ mir_strncpy(buf + j, "combo1", SIZEOF(buf) - j);
DBVARIANT combo1;
- if(!db_get_ws(0, MODULE, buf, &combo1))
+ if (!db_get_ws(0, MODULE, buf, &combo1))
{
webOptions[i]->combo1 = combo1.pwszVal;
db_free(&combo1);
}
}
- if(webOptions[i]->isPastebin)
+ if (webOptions[i]->isPastebin)
{
- strcpy_s(buf + j, 256 - j, "pastebinUserKey");
+ mir_strncpy(buf + j, "pastebinUserKey", SIZEOF(buf) - j);
DBVARIANT pastebinUserKey;
- if(!db_get_ws(0, MODULE, buf, &pastebinUserKey))
+ if (!db_get_ws(0, MODULE, buf, &pastebinUserKey))
{
webOptions[i]->pastebinUserKey = pastebinUserKey.pwszVal;
db_free(&pastebinUserKey);
diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index 52825a706c..50a7f6f006 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -37,7 +37,7 @@ HINSTANCE hInst; #define DEF_PAGES_START 20
#define MS_PASTEIT_CONTACTMENU "PasteIt/ContactMenu"
-PLUGININFOEX pluginInfo={
+PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -46,14 +46,14 @@ PLUGININFOEX pluginInfo={ __AUTHOREMAIL,
__COPYRIGHT,
__AUTHORWEB,
- UNICODE_AWARE,
+ UNICODE_AWARE,
// {1AAC15E8-DCEC-4050-B66F-2AA0E6120C22}
- {0x1aac15e8, 0xdcec, 0x4050, {0xb6, 0x6f, 0x2a, 0xa0, 0xe6, 0x12, 0xc, 0x22}}
+ { 0x1aac15e8, 0xdcec, 0x4050, { 0xb6, 0x6f, 0x2a, 0xa0, 0xe6, 0x12, 0xc, 0x22 } }
};
static IconItem icon = { LPGEN("Paste It"), "PasteIt_main", IDI_MENU };
-XML_API xi = {0};
+XML_API xi = { 0 };
int hLangpack = 0;
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
@@ -72,12 +72,12 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda std::wstring GetFile()
{
TCHAR filter[512];
- _tcscpy_s(filter, 512, TranslateT("All Files (*.*)"));
- memcpy(filter + _tcslen(filter), _T("\0*.*\0"), 6 * sizeof(TCHAR));
+ mir_tstrncpy(filter, TranslateT("All Files (*.*)"), SIZEOF(filter));
+ memcpy(filter + mir_tstrlen(filter), _T("\0*.*\0"), 6 * sizeof(TCHAR));
TCHAR stzFilePath[1024];
stzFilePath[0] = 0;
stzFilePath[1] = 0;
- OPENFILENAME ofn = {0};
+ OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = 0;
ofn.lpstrFilter = filter;
@@ -86,7 +86,7 @@ std::wstring GetFile() ofn.lpstrTitle = TranslateT("Paste It - Select file");
ofn.nMaxFile = SIZEOF(stzFilePath);
ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR;
- if(GetOpenFileName(&ofn))
+ if (GetOpenFileName(&ofn))
{
return stzFilePath;
}
@@ -97,14 +97,14 @@ std::wstring GetFile() void PasteIt(MCONTACT hContact, int mode)
{
PasteToWeb* pasteToWeb = pasteToWebs[Options::instance->defWeb];
- if(mode == FROM_CLIPBOARD)
+ if (mode == FROM_CLIPBOARD)
{
pasteToWeb->FromClipboard();
}
- else if(mode == FROM_FILE)
+ else if (mode == FROM_FILE)
{
std::wstring file = GetFile();
- if(file.length() > 0)
+ if (file.length() > 0)
{
pasteToWeb->FromFile(file);
}
@@ -112,27 +112,27 @@ void PasteIt(MCONTACT hContact, int mode) }
else return;
- if(pasteToWeb->szFileLink[0] == 0 && pasteToWeb->error != NULL)
+ if (pasteToWeb->szFileLink[0] == 0 && pasteToWeb->error != NULL)
{
MessageBox(NULL, pasteToWeb->error, TranslateT("Error"), MB_OK | MB_ICONERROR);
}
- else if(hContact != NULL && pasteToWeb->szFileLink[0] != 0)
+ else if (hContact != NULL && pasteToWeb->szFileLink[0] != 0)
{
char *szProto = GetContactProto(hContact);
if (szProto && (INT_PTR)szProto != CALLSERVICE_NOTFOUND)
{
- BOOL isChat = db_get_b(hContact, szProto, "ChatRoom", 0);
- if(Options::instance->autoSend)
+ BOOL isChat = db_get_b(hContact, szProto, "ChatRoom", 0);
+ if (Options::instance->autoSend)
{
- if(!isChat)
+ if (!isChat)
{
- DBEVENTINFO dbei = {0};
+ DBEVENTINFO dbei = { 0 };
dbei.cbSize = sizeof(dbei);
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT;
dbei.szModule = szProto;
dbei.timestamp = (DWORD)time(NULL);
- dbei.cbBlob = (DWORD)strlen(pasteToWeb->szFileLink) + 1;
+ dbei.cbBlob = (DWORD)mir_strlen(pasteToWeb->szFileLink) + 1;
dbei.pBlob = (PBYTE)pasteToWeb->szFileLink;
db_event_add(hContact, &dbei);
CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)pasteToWeb->szFileLink);
@@ -144,39 +144,39 @@ void PasteIt(MCONTACT hContact, int mode) // in chat room.
// Next step is to get all protocol sessions and find
// one with correct hContact
- GC_INFO gci = {0};
+ GC_INFO gci = { 0 };
GCDEST gcd = { szProto, NULL, GC_EVENT_SENDMESSAGE };
GCEVENT gce = { sizeof(gce), &gcd };
- int cnt = (int)CallService(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)szProto);
- for (int i = 0; i < cnt ; i++ )
+ int cnt = (int)CallService(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)szProto);
+ for (int i = 0; i < cnt; i++)
{
gci.iItem = i;
gci.pszModule = szProto;
gci.Flags = GCF_BYINDEX | GCF_HCONTACT | GCF_ID;
CallService(MS_GC_GETINFO, 0, (LPARAM)&gci);
- if (gci.hContact == hContact)
+ if (gci.hContact == hContact)
{
// In this place session was finded, gci.pszID contains
// session ID, but it is in unicode or ascii format,
// depends on protocol wersion
gcd.ptszID = gci.pszID;
- gce.bIsMe = TRUE;
- gce.dwFlags = GCEF_ADDTOLOG;
- gce.ptszText = mir_a2u_cp(pasteToWeb->szFileLink, CP_ACP);
- gce.time = time(NULL);
- CallService(MS_GC_EVENT, 0, (LPARAM)(GCEVENT *) &gce);
- mir_free((void*)gce.ptszText);
- break;
+ gce.bIsMe = TRUE;
+ gce.dwFlags = GCEF_ADDTOLOG;
+ gce.ptszText = mir_a2u_cp(pasteToWeb->szFileLink, CP_ACP);
+ gce.time = time(NULL);
+ CallService(MS_GC_EVENT, 0, (LPARAM)(GCEVENT *)&gce);
+ mir_free((void*)gce.ptszText);
+ break;
}
}
}
-
+
// Send message to focus window
CallServiceSync(MS_MSG_SENDMESSAGE, hContact, 0);
}
else
{
- if(isChat)
+ if (isChat)
{
// MS_MSG_SENDMESSAGE in incompatible with chat rooms,
// because it sends text to IDC_MESSAGE window,
@@ -185,7 +185,7 @@ void PasteIt(MCONTACT hContact, int mode) // with assaigned to them chat windows.
// This map is prepared in ME_MSG_WINDOWEVENT event.
std::map<MCONTACT, HWND>::iterator it = contactWindows->find(hContact);
- if(it != contactWindows->end())
+ if (it != contactWindows->end())
{
// it->second is imput window, so now I can send to them
// new text. Afterr all is sended MS_MSG_SENDMESSAGE
@@ -209,24 +209,24 @@ void PasteIt(MCONTACT hContact, int mode) }
}
-int TabsrmmButtonPressed(WPARAM hContact, LPARAM lParam)
+int TabsrmmButtonPressed(WPARAM hContact, LPARAM lParam)
{
CustomButtonClickData *cbc = (CustomButtonClickData *)lParam;
- if (!strcmp(cbc->pszModule, MODULE) && cbc->dwButtonId == 1 && hContact)
+ if (!mir_strcmp(cbc->pszModule, MODULE) && cbc->dwButtonId == 1 && hContact)
{
- if (cbc->flags == BBCF_ARROWCLICKED)
+ if (cbc->flags == BBCF_ARROWCLICKED)
{
HMENU hMenu = CreatePopupMenu();
- if (hMenu)
+ if (hMenu)
{
AppendMenu(hMenu, MF_STRING, FROM_CLIPBOARD, TranslateT("Paste from clipboard"));
AppendMenu(hMenu, MF_STRING, FROM_FILE, TranslateT("Paste from file"));
HMENU hDefMenu = CreatePopupMenu();
- for(int i = 0 ; i < PasteToWeb::pages; ++i)
+ for (int i = 0; i < PasteToWeb::pages; ++i)
{
UINT flags = MF_STRING;
- if(Options::instance->defWeb == i)
+ if (Options::instance->defWeb == i)
flags |= MF_CHECKED;
AppendMenu(hDefMenu, flags, DEF_PAGES_START + i, pasteToWebs[i]->GetName());
@@ -237,7 +237,7 @@ int TabsrmmButtonPressed(WPARAM hContact, LPARAM lParam) POINT pt;
GetCursorPos(&pt);
HWND hwndBtn = WindowFromPoint(pt);
- if (hwndBtn)
+ if (hwndBtn)
{
RECT rc;
GetWindowRect(hwndBtn, &rc);
@@ -245,7 +245,7 @@ int TabsrmmButtonPressed(WPARAM hContact, LPARAM lParam) int selected = TrackPopupMenu(hMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, cbc->hwndFrom, 0);
if (selected != 0)
{
- if(selected >= DEF_PAGES_START)
+ if (selected >= DEF_PAGES_START)
{
Options::instance->SetDefWeb(selected - DEF_PAGES_START);
}
@@ -255,11 +255,11 @@ int TabsrmmButtonPressed(WPARAM hContact, LPARAM lParam) }
}
}
-
+
DestroyMenu(hDefMenu);
DestroyMenu(hMenu);
}
- }
+ }
else
{
PasteIt(hContact, FROM_CLIPBOARD);
@@ -272,7 +272,7 @@ int TabsrmmButtonPressed(WPARAM hContact, LPARAM lParam) int PrebuildContactMenu(WPARAM wParam, LPARAM lParam)
{
bool bIsContact = false;
-
+
char *szProto = GetContactProto(wParam);
if (szProto && (INT_PTR)szProto != CALLSERVICE_NOTFOUND)
bIsContact = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM) != 0;
@@ -281,9 +281,9 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) return 0;
}
-INT_PTR ContactMenuService(WPARAM hContact, LPARAM lParam)
+INT_PTR ContactMenuService(WPARAM hContact, LPARAM lParam)
{
- if(lParam >= DEF_PAGES_START)
+ if (lParam >= DEF_PAGES_START)
Options::instance->SetDefWeb(lParam - DEF_PAGES_START);
else
PasteIt(hContact, lParam);
@@ -305,7 +305,7 @@ void InitMenuItems() mi.flags = CMIF_CHILDPOPUP | CMIF_ROOTHANDLE | CMIF_TCHAR;
mi.pszService = MS_PASTEIT_CONTACTMENU;
mi.hParentMenu = hContactMenu;
- mi.popupPosition = FROM_CLIPBOARD;
+ mi.popupPosition = FROM_CLIPBOARD;
mi.ptszName = LPGENT("Paste from clipboard");
Menu_AddContactMenuItem(&mi);
@@ -316,14 +316,14 @@ void InitMenuItems() mi.popupPosition = DEF_PAGES_START - 1;
mi.ptszName = LPGENT("Default web page");
HGENMENU hDefWebMenu = Menu_AddContactMenuItem(&mi);
-
+
CLISTMENUITEM mi2 = { sizeof(mi2) };
mi2.pszService = MS_PASTEIT_CONTACTMENU;
mi2.hParentMenu = hDefWebMenu;
- for(int i = 0 ; i < PasteToWeb::pages; ++i)
+ for (int i = 0; i < PasteToWeb::pages; ++i)
{
- mi2.flags = CMIF_CHILDPOPUP | CMIF_ROOTHANDLE | CMIF_TCHAR;
- if(Options::instance->defWeb == i)
+ mi2.flags = CMIF_CHILDPOPUP | CMIF_ROOTHANDLE | CMIF_TCHAR;
+ if (Options::instance->defWeb == i)
mi2.flags |= CMIF_CHECKED;
mi2.ptszName = pasteToWebs[i]->GetName();
mi2.popupPosition = mi2.position = DEF_PAGES_START + i;
@@ -338,7 +338,7 @@ void DefWebPageChanged() CLISTMENUITEM mi = { sizeof(mi) };
for (int i = 0; i < PasteToWeb::pages; i++) {
mi.flags = CMIM_FLAGS;
- if (Options::instance->defWeb == i)
+ if (Options::instance->defWeb == i)
mi.flags |= CMIF_CHECKED;
Menu_ModifyItem(hWebPageMenus[i], &mi);
@@ -347,9 +347,9 @@ void DefWebPageChanged() void InitTabsrmmButton()
{
- if (ServiceExists(MS_BB_ADDBUTTON))
+ if (ServiceExists(MS_BB_ADDBUTTON))
{
- BBButton btn = {0};
+ BBButton btn = { 0 };
btn.cbSize = sizeof(btn);
btn.dwButtonID = 1;
btn.pszModuleName = MODULE;
@@ -359,7 +359,7 @@ void InitTabsrmmButton() btn.ptszTooltip = TranslateT("Paste It");
CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&btn);
- if(hTabsrmmButtonPressed != NULL)
+ if (hTabsrmmButtonPressed != NULL)
UnhookEvent(hTabsrmmButtonPressed);
hTabsrmmButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed);
@@ -368,21 +368,21 @@ void InitTabsrmmButton() int WindowEvent(WPARAM wParam, MessageWindowEventData* lParam)
{
- if(lParam->uType == MSG_WINDOW_EVT_OPEN)
+ if (lParam->uType == MSG_WINDOW_EVT_OPEN)
{
char *szProto = GetContactProto(lParam->hContact);
if (szProto && (INT_PTR)szProto != CALLSERVICE_NOTFOUND)
{
- if(db_get_b(lParam->hContact, szProto, "ChatRoom", 0))
+ if (db_get_b(lParam->hContact, szProto, "ChatRoom", 0))
{
(*contactWindows)[lParam->hContact] = lParam->hwndInput;
}
}
}
- else if(lParam->uType == MSG_WINDOW_EVT_CLOSE)
+ else if (lParam->uType == MSG_WINDOW_EVT_CLOSE)
{
std::map<MCONTACT, HWND>::iterator it = contactWindows->find(lParam->hContact);
- if(it != contactWindows->end())
+ if (it != contactWindows->end())
{
contactWindows->erase(it);
}
@@ -407,13 +407,13 @@ extern "C" int __declspec(dllexport) Load(void) Icon_Register(hInst, LPGEN("Paste It"), &icon, 1);
- NETLIBUSER nlu = {0};
+ NETLIBUSER nlu = { 0 };
nlu.cbSize = sizeof(nlu);
- nlu.flags = NUF_TCHAR | NUF_OUTGOING | NUF_HTTPCONNS;
+ nlu.flags = NUF_TCHAR | NUF_OUTGOING | NUF_HTTPCONNS;
nlu.szSettingsModule = MODULE;
nlu.ptszDescriptiveName = TranslateT("Paste It HTTP connections");
- g_hNetlibUser = ( HANDLE )CallService(MS_NETLIB_REGISTERUSER, 0, ( LPARAM )&nlu );
-
+ g_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+
pasteToWebs[0] = new PasteToWeb1();
pasteToWebs[0]->pageIndex = 0;
pasteToWebs[1] = new PasteToWeb2();
@@ -430,26 +430,26 @@ extern "C" int __declspec(dllexport) Load(void) return 0;
}
-extern "C" int __declspec(dllexport) Unload(void)
-{
+extern "C" int __declspec(dllexport) Unload(void)
+{
UnhookEvent(hModulesLoaded);
UnhookEvent(hPrebuildContactMenu);
UnhookEvent(hOptionsInit);
- if(hWindowEvent != NULL)
+ if (hWindowEvent != NULL)
UnhookEvent(hWindowEvent);
DestroyServiceFunction(hServiceContactMenu);
Netlib_CloseHandle(g_hNetlibUser);
- if(hTabsrmmButtonPressed != NULL)
+ if (hTabsrmmButtonPressed != NULL)
UnhookEvent(hTabsrmmButtonPressed);
- for(int i=0; i < PasteToWeb::pages; ++i)
- if(pasteToWebs[i] != NULL) {
+ for (int i = 0; i < PasteToWeb::pages; ++i)
+ if (pasteToWebs[i] != NULL) {
delete pasteToWebs[i];
pasteToWebs[i] = NULL;
}
- if(Options::instance != NULL) {
+ if (Options::instance != NULL) {
delete Options::instance;
Options::instance = NULL;
}
diff --git a/plugins/PasteIt/src/PasteToWeb.cpp b/plugins/PasteIt/src/PasteToWeb.cpp index 92e84798ff..b674d55173 100644 --- a/plugins/PasteIt/src/PasteToWeb.cpp +++ b/plugins/PasteIt/src/PasteToWeb.cpp @@ -46,62 +46,62 @@ struct FromFileData bool sendFileName;
};
-INT_PTR CALLBACK DlgProcFromClipboard(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK DlgProcFromClipboard(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
+ switch (msg)
{
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
+ {
+ TranslateDialogDefault(hwndDlg);
+ FromClipboardData* data = (FromClipboardData*)lParam;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+ int ts = 4;
+ Edit_SetTabStops(GetDlgItem(hwndDlg, IDC_CLIPBOARD_DATA), 1, &ts);
+ SetDlgItemText(hwndDlg, IDC_CLIPBOARD_DATA, data->content.c_str());
+ int sel = 0;
+ int i = 0;
+ std::wstring &defFormat = Options::instance->webOptions[data->page]->defFormatId;
+ HWND cb = GetDlgItem(hwndDlg, IDC_FORMAT);
+ for (std::list<PasteFormat>::iterator it = Options::instance->webOptions[data->page]->formats.begin(); it != Options::instance->webOptions[data->page]->formats.end(); ++it)
{
- TranslateDialogDefault(hwndDlg);
- FromClipboardData* data = (FromClipboardData*)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- int ts = 4;
- Edit_SetTabStops(GetDlgItem(hwndDlg, IDC_CLIPBOARD_DATA), 1, &ts);
- SetDlgItemText(hwndDlg, IDC_CLIPBOARD_DATA, data->content.c_str());
- int sel = 0;
- int i = 0;
- std::wstring &defFormat = Options::instance->webOptions[data->page]->defFormatId;
- HWND cb = GetDlgItem(hwndDlg, IDC_FORMAT);
- for(std::list<PasteFormat>::iterator it = Options::instance->webOptions[data->page]->formats.begin(); it != Options::instance->webOptions[data->page]->formats.end(); ++it)
- {
- ComboBox_AddString(cb, it->name.c_str());
- if(it->id == defFormat)
- sel = i;
- ++i;
- }
- if(!Options::instance->webOptions[data->page]->formats.empty())
- {
- ComboBox_SetCurSel(cb, sel);
- }
- return TRUE;
+ ComboBox_AddString(cb, it->name.c_str());
+ if (it->id == defFormat)
+ sel = i;
+ ++i;
}
- case WM_COMMAND:
+ if (!Options::instance->webOptions[data->page]->formats.empty())
+ {
+ ComboBox_SetCurSel(cb, sel);
+ }
+ return TRUE;
+ }
+ case WM_COMMAND:
+ {
+ if (HIWORD(wParam) == BN_CLICKED)
{
- if (HIWORD(wParam) == BN_CLICKED)
+ if (LOWORD(wParam) == IDOK)
{
- if (LOWORD(wParam) == IDOK)
+ FromClipboardData *clipboardData = (FromClipboardData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ int sel = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_FORMAT));
+ for (std::list<PasteFormat>::iterator it = Options::instance->webOptions[clipboardData->page]->formats.begin(); it != Options::instance->webOptions[clipboardData->page]->formats.end(); ++it)
{
- FromClipboardData *clipboardData = (FromClipboardData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- int sel = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_FORMAT));
- for(std::list<PasteFormat>::iterator it = Options::instance->webOptions[clipboardData->page]->formats.begin(); it != Options::instance->webOptions[clipboardData->page]->formats.end(); ++it)
+ if (sel-- <= 0)
{
- if(sel-- <= 0)
- {
- clipboardData->format = it->id;
- break;
- }
+ clipboardData->format = it->id;
+ break;
}
-
- EndDialog(hwndDlg, IDC_BTN_OK);
- }
- else if (LOWORD(wParam) == IDCANCEL)
- {
- EndDialog(hwndDlg, IDCANCEL);
}
- }
- break;
+ EndDialog(hwndDlg, IDC_BTN_OK);
+ }
+ else if (LOWORD(wParam) == IDCANCEL)
+ {
+ EndDialog(hwndDlg, IDCANCEL);
+ }
}
+
+ break;
+ }
}
return FALSE;
@@ -109,41 +109,41 @@ INT_PTR CALLBACK DlgProcFromClipboard(HWND hwndDlg, UINT msg, WPARAM wParam, LPA void RecodeDlg(HWND hwndDlg)
{
- ShowWindow(GetDlgItem(hwndDlg,IDC_RECODE),SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_RECODE), SW_HIDE);
FromFileData *fromFileData = (FromFileData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
unsigned int cp = Options::GetCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), false, fromFileData->codepage);
mir_free(fromFileData->contentW);
int cbLen = 0;
- if(cp == 1200 || cp == 1201)
+ if (cp == 1200 || cp == 1201)
{
// UTF-16
cbLen = fromFileData->contentLen / 2;
}
else
{
- cbLen = MultiByteToWideChar( cp, 0, fromFileData->content, fromFileData->contentLen, NULL, 0 );
+ cbLen = MultiByteToWideChar(cp, 0, fromFileData->content, fromFileData->contentLen, NULL, 0);
}
- fromFileData->contentW = ( wchar_t* )mir_alloc( sizeof( wchar_t )*(cbLen+1));
- if ( fromFileData->contentW != NULL )
+ fromFileData->contentW = (wchar_t*)mir_alloc(sizeof(wchar_t)*(cbLen + 1));
+ if (fromFileData->contentW != NULL)
{
- if(cp == 1200)
+ if (cp == 1200)
{
- memcpy_s(fromFileData->contentW, sizeof( wchar_t )*(cbLen+1), fromFileData->content, sizeof( wchar_t )*cbLen);
+ memcpy_s(fromFileData->contentW, sizeof(wchar_t)*(cbLen + 1), fromFileData->content, sizeof(wchar_t)*cbLen);
}
- else if(cp == 1201)
+ else if (cp == 1201)
{
- for(int i = 0 ; i < cbLen; ++i)
+ for (int i = 0; i < cbLen; ++i)
{
- fromFileData->contentW[i] = ((unsigned char)fromFileData->content[i*2] << 8) | (unsigned char)fromFileData->content[i*2 + 1];
+ fromFileData->contentW[i] = ((unsigned char)fromFileData->content[i * 2] << 8) | (unsigned char)fromFileData->content[i * 2 + 1];
}
}
else
{
- MultiByteToWideChar( cp, 0, fromFileData->content, fromFileData->contentLen, fromFileData->contentW, cbLen );
+ MultiByteToWideChar(cp, 0, fromFileData->content, fromFileData->contentLen, fromFileData->contentW, cbLen);
}
- fromFileData->contentW[ cbLen ] = 0;
+ fromFileData->contentW[cbLen] = 0;
SetDlgItemText(hwndDlg, IDC_FILE_DATA, fromFileData->contentW);
}
else
@@ -154,107 +154,107 @@ void RecodeDlg(HWND hwndDlg) fromFileData->codepage = cp;
}
-INT_PTR CALLBACK DlgProcFromFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK DlgProcFromFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ {
+ TranslateDialogDefault(hwndDlg);
+ FromFileData *fromFileData = (FromFileData*)lParam;
+ int ts = 4;
+ Edit_SetTabStops(GetDlgItem(hwndDlg, IDC_FILE_DATA), 1, &ts);
+ SetDlgItemText(hwndDlg, IDC_FILE_DATA, fromFileData->contentW);
+ SetDlgItemText(hwndDlg, IDC_FILE_PATH, fromFileData->fileName->c_str());
+ Options::InitCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), fromFileData->codepage);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_RECODE), SW_HIDE);
+
+ int sel = 0;
+ int i = 0;
+ std::wstring &defFormat = Options::instance->webOptions[fromFileData->page]->defFormatId;
+ HWND cb = GetDlgItem(hwndDlg, IDC_FORMAT);
+ for (std::list<PasteFormat>::iterator it = Options::instance->webOptions[fromFileData->page]->formats.begin(); it != Options::instance->webOptions[fromFileData->page]->formats.end(); ++it)
+ {
+ ComboBox_AddString(cb, it->name.c_str());
+ if (it->id == defFormat)
+ sel = i;
+ ++i;
+ }
+ if (!Options::instance->webOptions[fromFileData->page]->formats.empty())
+ {
+ ComboBox_SetCurSel(cb, sel);
+ }
+
+ if (Options::instance->webOptions[fromFileData->page]->isSendFileName)
+ {
+ bool sendFileName = Options::instance->webOptions[fromFileData->page]->sendFileName;
+ CheckDlgButton(hwndDlg, IDC_AUTOFORMAT, sendFileName ? BST_CHECKED : BST_UNCHECKED);
+ Button_Enable(GetDlgItem(hwndDlg, IDC_FORMAT), sendFileName ? 0 : 1);
+ Button_Enable(GetDlgItem(hwndDlg, IDC_FORMATTEXT), sendFileName ? 0 : 1);
+ }
+ else
+ Button_Enable(GetDlgItem(hwndDlg, IDC_AUTOFORMAT), FALSE);
+ return TRUE;
+ }
+ case WM_COMMAND:
{
- case WM_INITDIALOG:
+ if (HIWORD(wParam) == BN_CLICKED)
{
- TranslateDialogDefault(hwndDlg);
- FromFileData *fromFileData = (FromFileData*)lParam;
- int ts = 4;
- Edit_SetTabStops(GetDlgItem(hwndDlg, IDC_FILE_DATA), 1, &ts);
- SetDlgItemText(hwndDlg, IDC_FILE_DATA, fromFileData->contentW);
- SetDlgItemText(hwndDlg, IDC_FILE_PATH, fromFileData->fileName->c_str());
- Options::InitCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), fromFileData->codepage);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- ShowWindow(GetDlgItem(hwndDlg,IDC_RECODE),SW_HIDE);
-
- int sel = 0;
- int i = 0;
- std::wstring &defFormat = Options::instance->webOptions[fromFileData->page]->defFormatId;
- HWND cb = GetDlgItem(hwndDlg, IDC_FORMAT);
- for(std::list<PasteFormat>::iterator it = Options::instance->webOptions[fromFileData->page]->formats.begin(); it != Options::instance->webOptions[fromFileData->page]->formats.end(); ++it)
+ if (LOWORD(wParam) == IDOK)
+ {
+ FromFileData *fromFileData = (FromFileData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ int sel = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_FORMAT));
+ for (std::list<PasteFormat>::iterator it = Options::instance->webOptions[fromFileData->page]->formats.begin(); it != Options::instance->webOptions[fromFileData->page]->formats.end(); ++it)
+ {
+ if (sel-- <= 0)
+ {
+ fromFileData->format = it->id;
+ break;
+ }
+ }
+
+ if (Options::instance->webOptions[fromFileData->page]->isSendFileName)
+ fromFileData->sendFileName = IsDlgButtonChecked(hwndDlg, IDC_AUTOFORMAT) ? true : false;
+ else
+ fromFileData->sendFileName = false;
+
+ EndDialog(hwndDlg, IDC_BTN_OK);
+ }
+ else if (LOWORD(wParam) == IDCANCEL)
{
- ComboBox_AddString(cb, it->name.c_str());
- if(it->id == defFormat)
- sel = i;
- ++i;
+ EndDialog(hwndDlg, IDCANCEL);
}
- if(!Options::instance->webOptions[fromFileData->page]->formats.empty())
+ else if (LOWORD(wParam) == IDC_RECODE)
{
- ComboBox_SetCurSel(cb, sel);
+ RecodeDlg(hwndDlg);
}
-
- if(Options::instance->webOptions[fromFileData->page]->isSendFileName)
+ else if (LOWORD(wParam) == IDC_AUTOFORMAT)
{
- bool sendFileName = Options::instance->webOptions[fromFileData->page]->sendFileName;
- CheckDlgButton(hwndDlg, IDC_AUTOFORMAT, sendFileName ? BST_CHECKED : BST_UNCHECKED);
+ UINT sendFileName = IsDlgButtonChecked(hwndDlg, IDC_AUTOFORMAT);
Button_Enable(GetDlgItem(hwndDlg, IDC_FORMAT), sendFileName ? 0 : 1);
Button_Enable(GetDlgItem(hwndDlg, IDC_FORMATTEXT), sendFileName ? 0 : 1);
}
- else
- Button_Enable(GetDlgItem(hwndDlg, IDC_AUTOFORMAT), FALSE);
- return TRUE;
}
- case WM_COMMAND:
+ else if (LOWORD(wParam) == IDC_CODEPAGE)
{
- if (HIWORD(wParam) == BN_CLICKED)
+ if (HIWORD(wParam) == CBN_SELCHANGE)
{
- if (LOWORD(wParam) == IDOK)
- {
- FromFileData *fromFileData = (FromFileData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- int sel = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_FORMAT));
- for(std::list<PasteFormat>::iterator it = Options::instance->webOptions[fromFileData->page]->formats.begin(); it != Options::instance->webOptions[fromFileData->page]->formats.end(); ++it)
- {
- if(sel-- <= 0)
- {
- fromFileData->format = it->id;
- break;
- }
- }
-
- if(Options::instance->webOptions[fromFileData->page]->isSendFileName)
- fromFileData->sendFileName = IsDlgButtonChecked(hwndDlg, IDC_AUTOFORMAT) ? true : false;
- else
- fromFileData->sendFileName = false;
-
- EndDialog(hwndDlg, IDC_BTN_OK);
- }
- else if (LOWORD(wParam) == IDCANCEL)
- {
- EndDialog(hwndDlg, IDCANCEL);
- }
- else if(LOWORD(wParam) == IDC_RECODE)
- {
- RecodeDlg(hwndDlg);
- }
- else if(LOWORD(wParam) == IDC_AUTOFORMAT)
- {
- UINT sendFileName = IsDlgButtonChecked(hwndDlg, IDC_AUTOFORMAT);
- Button_Enable(GetDlgItem(hwndDlg, IDC_FORMAT), sendFileName ? 0 : 1);
- Button_Enable(GetDlgItem(hwndDlg, IDC_FORMATTEXT), sendFileName ? 0 : 1);
- }
+ RecodeDlg(hwndDlg);
}
- else if(LOWORD(wParam) == IDC_CODEPAGE)
+ else if (HIWORD(wParam) == CBN_EDITCHANGE)
{
- if(HIWORD(wParam) == CBN_SELCHANGE)
- {
- RecodeDlg(hwndDlg);
- }
- else if(HIWORD(wParam) == CBN_EDITCHANGE)
- {
- ShowWindow(GetDlgItem(hwndDlg,IDC_RECODE),SW_SHOW);
- }
- else if(HIWORD(wParam) == CBN_KILLFOCUS)
- {
- FromFileData *fromFileData = (FromFileData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- Options::GetCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), true, fromFileData->codepage);
- }
+ ShowWindow(GetDlgItem(hwndDlg, IDC_RECODE), SW_SHOW);
+ }
+ else if (HIWORD(wParam) == CBN_KILLFOCUS)
+ {
+ FromFileData *fromFileData = (FromFileData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ Options::GetCodepageCB(GetDlgItem(hwndDlg, IDC_CODEPAGE), true, fromFileData->codepage);
}
-
- break;
}
+
+ break;
+ }
}
return FALSE;
@@ -264,57 +264,57 @@ void PasteToWeb::FromClipboard() {
szFileLink[0] = 0;
error = NULL;
- std::wstring str;
+ std::wstring str;
BOOL isFile = 0;
- if(OpenClipboard(NULL))
+ if (OpenClipboard(NULL))
{
HANDLE obj = GetClipboardData(CF_UNICODETEXT);
- if(obj != NULL)
+ if (obj != NULL)
{
- LPCWSTR wStr = (LPCWSTR)GlobalLock(obj);
- str.append(wStr, wStr + wcslen(wStr));
+ LPCWSTR wStr = (LPCWSTR)GlobalLock(obj);
+ str.append(wStr, wStr + mir_wstrlen(wStr));
GlobalUnlock(obj);
// Sometimes clipboard CF_UNICODETEXT format returns only 2 characters,
// to fix this I check if CF_TEXT contains more characters,
// if this is true, this mean that CF_UNICODETEXT is invalid.
obj = GetClipboardData(CF_TEXT);
- if(obj != NULL)
+ if (obj != NULL)
{
- LPCSTR cStr = (LPCSTR)GlobalLock(obj);
- if(strlen(cStr) > str.length())
+ LPCSTR cStr = (LPCSTR)GlobalLock(obj);
+ if (strlen(cStr) > str.length())
{
str = L"";
LPWSTR wStr = mir_a2u_cp(cStr, CP_ACP);
- str.append(wStr, wStr + wcslen(wStr));
+ str.append(wStr, wStr + mir_wstrlen(wStr));
mir_free(wStr);
}
GlobalUnlock(obj);
}
}
- else
+ else
{
obj = GetClipboardData(CF_TEXT);
- if(obj != NULL)
+ if (obj != NULL)
{
- LPCSTR cStr = (LPCSTR)GlobalLock(obj);
+ LPCSTR cStr = (LPCSTR)GlobalLock(obj);
LPWSTR wStr = mir_a2u_cp(cStr, CP_ACP);
- str.append(wStr, wStr + wcslen(wStr));
+ str.append(wStr, wStr + mir_wstrlen(wStr));
mir_free(wStr);
GlobalUnlock(obj);
}
else
{
obj = GetClipboardData(CF_HDROP);
- if(obj != NULL)
+ if (obj != NULL)
{
- LPDROPFILES df = (LPDROPFILES) GlobalLock(obj);
+ LPDROPFILES df = (LPDROPFILES)GlobalLock(obj);
isFile = 1;
- if(df->fWide)
+ if (df->fWide)
{
// Unicode
WCHAR* file = (WCHAR*)((BYTE*)obj + df->pFiles);
- size_t len = wcslen(file);
- if(*(file + len + 1) == L'\0')
+ size_t len = mir_wstrlen(file);
+ if (*(file + len + 1) == L'\0')
{
str.append(file, file + len);
}
@@ -327,11 +327,11 @@ void PasteToWeb::FromClipboard() {
// ANSI
char* file = (char*)obj + df->pFiles;
- size_t len = strlen(file);
- if(*(file + len + 1) == '\0')
+ size_t len = mir_strlen(file);
+ if (*(file + len + 1) == '\0')
{
LPWSTR wStr = mir_a2u_cp(file, CP_ACP);
- str.append(wStr, wStr + wcslen(wStr));
+ str.append(wStr, wStr + mir_wstrlen(wStr));
mir_free(wStr);
}
else
@@ -347,22 +347,22 @@ void PasteToWeb::FromClipboard() CloseClipboard();
}
- if(str.length() > 0)
+ if (str.length() > 0)
{
- if(isFile)
+ if (isFile)
FromFile(str);
else
{
FromClipboardData data;
data.content = str;
data.page = pageIndex;
- if (Options::instance->confDlg && DialogBoxParam (hInst, MAKEINTRESOURCE(IDD_DLG_FROM_CLIPBOARD), 0, DlgProcFromClipboard, (LPARAM)&data) != IDC_BTN_OK)
- return;
+ if (Options::instance->confDlg && DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_FROM_CLIPBOARD), 0, DlgProcFromClipboard, (LPARAM)&data) != IDC_BTN_OK)
+ return;
SendToServer(str, L"", data.format);
}
}
- else if(error == NULL)
+ else if (error == NULL)
{
error = TranslateT("Cannot get data from clipboard");
}
@@ -373,21 +373,19 @@ void PasteToWeb::FromFile(std::wstring file) error = NULL;
szFileLink[0] = 0;
HANDLE hFile = CreateFile(file.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
- FromFileData fromFileData;
- fromFileData.content = NULL;
- fromFileData.contentLen = 0;
+ FromFileData fromFileData = { 0 };
fromFileData.fileName = &file;
- if(hFile != INVALID_HANDLE_VALUE)
+ if (hFile != INVALID_HANDLE_VALUE)
{
LARGE_INTEGER fileSize;
- if(GetFileSizeEx(hFile, &fileSize))
+ if (GetFileSizeEx(hFile, &fileSize))
{
- if(fileSize.QuadPart <= 10485760LL)
+ if (fileSize.QuadPart <= 10485760LL)
{
- if(fileSize.QuadPart > 512000LL)
+ if (fileSize.QuadPart > 512000LL)
{
mir_sntprintf(bufErr, SIZEOF(bufErr), TranslateT("File size is %d KB, do you really want to paste such a large file?"), fileSize.LowPart / 1024);
- if(MessageBox(NULL, bufErr, TranslateT("Are You sure?"), MB_YESNO | MB_ICONQUESTION) != IDYES)
+ if (MessageBox(NULL, bufErr, TranslateT("Are You sure?"), MB_YESNO | MB_ICONQUESTION) != IDYES)
{
CloseHandle(hFile);
return;
@@ -396,7 +394,7 @@ void PasteToWeb::FromFile(std::wstring file) DWORD readed;
fromFileData.contentLen = fileSize.LowPart;
fromFileData.content = (char*)mir_alloc(fromFileData.contentLen);
- if(!ReadFile(hFile, fromFileData.content, fromFileData.contentLen, &readed, NULL))
+ if (!ReadFile(hFile, fromFileData.content, fromFileData.contentLen, &readed, NULL))
{
mir_free(fromFileData.content);
fromFileData.content = NULL;
@@ -419,70 +417,70 @@ void PasteToWeb::FromFile(std::wstring file) error = bufErr;
}
- if(fromFileData.content != NULL)
+ if (fromFileData.content != NULL)
{
int cbLen = 0;
bool isDefTranslation = true;
- if(Options::instance->autoUTF)
+ if (Options::instance->autoUTF)
{
isDefTranslation = false;
fromFileData.codepage = CP_UTF8;
- cbLen = MultiByteToWideChar( fromFileData.codepage, MB_ERR_INVALID_CHARS, fromFileData.content, fromFileData.contentLen, NULL, 0 );
- if(cbLen == 0)
+ cbLen = MultiByteToWideChar(fromFileData.codepage, MB_ERR_INVALID_CHARS, fromFileData.content, fromFileData.contentLen, NULL, 0);
+ if (cbLen == 0)
{
int errorN = GetLastError();
- if(errorN == ERROR_NO_UNICODE_TRANSLATION)
+ if (errorN == ERROR_NO_UNICODE_TRANSLATION)
{
isDefTranslation = true;
}
}
}
- if(isDefTranslation)
+ if (isDefTranslation)
{
fromFileData.codepage = Options::instance->codepage;
- if(fromFileData.codepage == 1200 || fromFileData.codepage == 1201)
+ if (fromFileData.codepage == 1200 || fromFileData.codepage == 1201)
{
// UTF-16
cbLen = fromFileData.contentLen / 2;
}
else
{
- cbLen = MultiByteToWideChar( fromFileData.codepage, 0, fromFileData.content, fromFileData.contentLen, NULL, 0 );
+ cbLen = MultiByteToWideChar(fromFileData.codepage, 0, fromFileData.content, fromFileData.contentLen, NULL, 0);
}
}
- if(cbLen > 0)
+ if (cbLen > 0)
{
- fromFileData.contentW = ( wchar_t* )mir_alloc( sizeof( wchar_t )*(cbLen+1));
- if ( fromFileData.contentW != NULL )
+ fromFileData.contentW = (wchar_t*)mir_alloc(sizeof(wchar_t)*(cbLen + 1));
+ if (fromFileData.contentW != NULL)
{
- if(fromFileData.codepage == 1200)
+ if (fromFileData.codepage == 1200)
{
- memcpy_s(fromFileData.contentW, sizeof( wchar_t )*(cbLen+1), fromFileData.content, sizeof( wchar_t )*cbLen);
+ memcpy_s(fromFileData.contentW, sizeof(wchar_t)*(cbLen + 1), fromFileData.content, sizeof(wchar_t)*cbLen);
}
- else if(fromFileData.codepage == 1201)
+ else if (fromFileData.codepage == 1201)
{
- for(int i = 0 ; i < cbLen; ++i)
+ for (int i = 0; i < cbLen; ++i)
{
- fromFileData.contentW[i] = (fromFileData.content[i*2] << 8) | fromFileData.content[i*2 + 1];
+ fromFileData.contentW[i] = (fromFileData.content[i * 2] << 8) | fromFileData.content[i * 2 + 1];
}
}
else
{
- MultiByteToWideChar( fromFileData.codepage, 0, fromFileData.content, fromFileData.contentLen, fromFileData.contentW, cbLen );
+ MultiByteToWideChar(fromFileData.codepage, 0, fromFileData.content, fromFileData.contentLen, fromFileData.contentW, cbLen);
}
-
- fromFileData.contentW[ cbLen ] = 0;
+
+ fromFileData.contentW[cbLen] = 0;
fromFileData.page = pageIndex;
- if (!Options::instance->confDlg || DialogBoxParam (hInst, MAKEINTRESOURCE(IDD_DLG_FROM_FILE), 0, DlgProcFromFile, (LPARAM)&fromFileData) == IDC_BTN_OK)
+ if (!Options::instance->confDlg || DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_FROM_FILE), 0, DlgProcFromFile, (LPARAM)&fromFileData) == IDC_BTN_OK)
{
std::wstring fileName;
std::wstring::size_type pos1 = file.find_last_of(L'\\');
std::wstring::size_type pos2 = file.find_last_of(L'/');
- if(pos2 > pos1 && pos2 < file.length())
+ if (pos2 > pos1 && pos2 < file.length())
pos1 = pos2;
- if(pos1 >= 0 && pos1 + 1 < file.length())
+ if (pos1 >= 0 && pos1 + 1 < file.length())
fileName = file.substr(pos1 + 1);
else
fileName = file;
@@ -505,68 +503,68 @@ extern HANDLE g_hNetlibUser; wchar_t* PasteToWeb::SendToWeb(char* url, std::map<std::string, std::string>& headers, std::wstring content)
{
wchar_t* resCont = NULL;
- int cbLen = WideCharToMultiByte( CP_UTF8, 0, content.c_str(), -1, NULL, 0, NULL, NULL );
- char* contentBytes = ( char* )mir_alloc(cbLen);
- if ( contentBytes == NULL )
+ int cbLen = WideCharToMultiByte(CP_UTF8, 0, content.c_str(), -1, NULL, 0, NULL, NULL);
+ char* contentBytes = (char*)mir_alloc(cbLen);
+ if (contentBytes == NULL)
return resCont;
- WideCharToMultiByte( CP_UTF8, 0, content.c_str(), -1, contentBytes, cbLen, NULL, NULL );
+ WideCharToMultiByte(CP_UTF8, 0, content.c_str(), -1, contentBytes, cbLen, NULL, NULL);
--cbLen;
int nHeaders = 0;
- for(std::map<std::string, std::string>::iterator it = headers.begin(); it != headers.end(); ++it)
+ for (std::map<std::string, std::string>::iterator it = headers.begin(); it != headers.end(); ++it)
{
++nHeaders;
}
- NETLIBHTTPREQUEST nlhr={0};
+ NETLIBHTTPREQUEST nlhr = { 0 };
NETLIBHTTPHEADER* httpHeaders = new NETLIBHTTPHEADER[nHeaders];
- nlhr.cbSize=sizeof(nlhr);
- nlhr.requestType=REQUEST_POST;
- nlhr.flags=NLHRF_NODUMPSEND|NLHRF_DUMPASTEXT|NLHPIF_HTTP11;
- nlhr.szUrl=url;
+ nlhr.cbSize = sizeof(nlhr);
+ nlhr.requestType = REQUEST_POST;
+ nlhr.flags = NLHRF_NODUMPSEND | NLHRF_DUMPASTEXT | NLHPIF_HTTP11;
+ nlhr.szUrl = url;
nlhr.headers = httpHeaders;
nlhr.pData = contentBytes;
nlhr.dataLength = cbLen;
nHeaders = 0;
std::list<char*> mallBuf;
- for(std::map<std::string, std::string>::iterator it = headers.begin(); it != headers.end(); ++it)
+ for (std::map<std::string, std::string>::iterator it = headers.begin(); it != headers.end(); ++it)
{
char* b1 = new char[it->first.length() + 1];
char* b2 = new char[it->second.length() + 1];
- strcpy_s(b1, it->first.length() + 1, it->first.c_str());
- strcpy_s(b2, it->second.length() + 1, it->second.c_str());
+ mir_strncpy(b1, it->first.c_str(), it->first.length() + 1);
+ mir_strncpy(b2, it->second.c_str(), it->second.length() + 1);
httpHeaders[nHeaders].szName = b1;
httpHeaders[nHeaders].szValue = b2;
mallBuf.push_back(b1);
mallBuf.push_back(b2);
++nHeaders;
}
-
+
nlhr.headersCount = nHeaders;
- NETLIBHTTPREQUEST* nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,(WPARAM)g_hNetlibUser,(LPARAM)&nlhr);
- if(nlhrReply != NULL)
+ NETLIBHTTPREQUEST* nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)g_hNetlibUser, (LPARAM)&nlhr);
+ if (nlhrReply != NULL)
{
- if(nlhrReply->resultCode == 200)
+ if (nlhrReply->resultCode == 200)
{
int resLen = MultiByteToWideChar(CP_UTF8, 0, nlhrReply->pData, nlhrReply->dataLength, NULL, 0);
++resLen;
- resCont = ( wchar_t* )mir_alloc(resLen * sizeof(wchar_t));
- if ( resCont != NULL )
+ resCont = (wchar_t*)mir_alloc(resLen * sizeof(wchar_t));
+ if (resCont != NULL)
{
- resLen = MultiByteToWideChar( CP_UTF8, 0, nlhrReply->pData, nlhrReply->dataLength, resCont, resLen);
+ resLen = MultiByteToWideChar(CP_UTF8, 0, nlhrReply->pData, nlhrReply->dataLength, resCont, resLen);
resCont[resLen] = 0;
}
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,(LPARAM)nlhrReply);
+ CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
}
delete httpHeaders;
- for(std::list<char*>::iterator it = mallBuf.begin(); it != mallBuf.end(); ++it)
+ for (std::list<char*>::iterator it = mallBuf.begin(); it != mallBuf.end(); ++it)
{
delete *it;
}
-
+
mir_free(contentBytes);
return resCont;
}
diff --git a/plugins/PasteIt/src/PasteToWeb1.cpp b/plugins/PasteIt/src/PasteToWeb1.cpp index ef84d42c4f..032a7219e2 100644 --- a/plugins/PasteIt/src/PasteToWeb1.cpp +++ b/plugins/PasteIt/src/PasteToWeb1.cpp @@ -20,238 +20,238 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. PasteFormat PasteToWeb1::formats[] =
{
- {L"4cs", L"4CS"},
- {L"6502acme", L"6502 ACME Cross Assembler"},
- {L"6502kickass", L"6502 Kick Assembler"},
- {L"6502tasm", L"6502 TASM/64TASS"},
- {L"abap", L"ABAP"},
- {L"actionscript", L"ActionScript"},
- {L"actionscript3", L"ActionScript 3"},
- {L"ada", L"Ada"},
- {L"algol68", L"ALGOL 68"},
- {L"apache", L"Apache Log"},
- {L"applescript", L"AppleScript"},
- {L"apt_sources", L"APT Sources"},
- {L"asm", L"ASM (NASM)"},
- {L"asp", L"ASP"},
- {L"autoconf", L"autoconf"},
- {L"autohotkey", L"Autohotkey"},
- {L"autoit", L"AutoIt"},
- {L"avisynth", L"Avisynth"},
- {L"awk", L"Awk"},
- {L"bascomavr", L"BASCOM AVR"},
- {L"bash", L"Bash"},
- {L"basic4gl", L"Basic4GL"},
- {L"bibtex", L"BibTeX"},
- {L"blitzbasic", L"Blitz Basic"},
- {L"bnf", L"BNF"},
- {L"boo", L"BOO"},
- {L"bf", L"BrainFuck"},
- {L"c", L"C"},
- {L"c_mac", L"C for Macs"},
- {L"cil", L"C Intermediate Language"},
- {L"csharp", L"C#"},
- {L"cpp", L"C++"},
- {L"cpp-qt", L"C++ (with QT extensions)"},
- {L"c_loadrunner", L"C: Loadrunner"},
- {L"caddcl", L"CAD DCL"},
- {L"cadlisp", L"CAD Lisp"},
- {L"cfdg", L"CFDG"},
- {L"chaiscript", L"ChaiScript"},
- {L"clojure", L"Clojure"},
- {L"klonec", L"Clone C"},
- {L"klonecpp", L"Clone C++"},
- {L"cmake", L"CMake"},
- {L"cobol", L"COBOL"},
- {L"coffeescript", L"CoffeeScript"},
- {L"cfm", L"ColdFusion"},
- {L"css", L"CSS"},
- {L"cuesheet", L"Cuesheet"},
- {L"d", L"D"},
- {L"dcs", L"DCS"},
- {L"delphi", L"Delphi"},
- {L"oxygene", L"Delphi Prism (Oxygene)"},
- {L"diff", L"Diff"},
- {L"div", L"DIV"},
- {L"dos", L"DOS"},
- {L"dot", L"DOT"},
- {L"e", L"E"},
- {L"ecmascript", L"ECMAScript"},
- {L"eiffel", L"Eiffel"},
- {L"email", L"Email"},
- {L"epc", L"EPC"},
- {L"erlang", L"Erlang"},
- {L"fsharp", L"F#"},
- {L"falcon", L"Falcon"},
- {L"fo", L"FO Language"},
- {L"f1", L"Formula One"},
- {L"fortran", L"Fortran"},
- {L"freebasic", L"FreeBasic"},
- {L"gambas", L"GAMBAS"},
- {L"gml", L"Game Maker"},
- {L"gdb", L"GDB"},
- {L"genero", L"Genero"},
- {L"genie", L"Genie"},
- {L"gettext", L"GetText"},
- {L"go", L"Go"},
- {L"groovy", L"Groovy"},
- {L"gwbasic", L"GwBasic"},
- {L"haskell", L"Haskell"},
- {L"hicest", L"HicEst"},
- {L"hq9plus", L"HQ9 Plus"},
- {L"html4strict", L"HTML"},
- {L"html5", L"HTML 5"},
- {L"icon", L"Icon"},
- {L"idl", L"IDL"},
- {L"ini", L"INI file"},
- {L"inno", L"Inno Script"},
- {L"intercal", L"INTERCAL"},
- {L"io", L"IO"},
- {L"j", L"J"},
- {L"java", L"Java"},
- {L"java5", L"Java 5"},
- {L"javascript", L"JavaScript"},
- {L"jquery", L"jQuery"},
- {L"kixtart", L"KiXtart"},
- {L"latex", L"Latex"},
- {L"lb", L"Liberty BASIC"},
- {L"lsl2", L"Linden Scripting"},
- {L"lisp", L"Lisp"},
- {L"llvm", L"LLVM"},
- {L"locobasic", L"Loco Basic"},
- {L"logtalk", L"Logtalk"},
- {L"lolcode", L"LOL Code"},
- {L"lotusformulas", L"Lotus Formulas"},
- {L"lotusscript", L"Lotus Script"},
- {L"lscript", L"LScript"},
- {L"lua", L"Lua"},
- {L"m68k", L"M68000 Assembler"},
- {L"magiksf", L"MagikSF"},
- {L"make", L"Make"},
- {L"mapbasic", L"MapBasic"},
- {L"matlab", L"MatLab"},
- {L"mirc", L"mIRC"},
- {L"mmix", L"MIX Assembler"},
- {L"modula2", L"Modula 2"},
- {L"modula3", L"Modula 3"},
- {L"68000devpac", L"Motorola 68000 HiSoft Dev"},
- {L"mpasm", L"MPASM"},
- {L"mxml", L"MXML"},
- {L"mysql", L"MySQL"},
- {L"newlisp", L"newLISP"},
- {L"text", L"None"},
- {L"nsis", L"NullSoft Installer"},
- {L"oberon2", L"Oberon 2"},
- {L"objeck", L"Objeck Programming Langua"},
- {L"objc", L"Objective C"},
- {L"ocaml-brief", L"OCalm Brief"},
- {L"ocaml", L"OCaml"},
- {L"pf", L"OpenBSD PACKET FILTER"},
- {L"glsl", L"OpenGL Shading"},
- {L"oobas", L"Openoffice BASIC"},
- {L"oracle11", L"Oracle 11"},
- {L"oracle8", L"Oracle 8"},
- {L"oz", L"Oz"},
- {L"pascal", L"Pascal"},
- {L"pawn", L"PAWN"},
- {L"pcre", L"PCRE"},
- {L"per", L"Per"},
- {L"perl", L"Perl"},
- {L"perl6", L"Perl 6"},
- {L"php", L"PHP"},
- {L"php-brief", L"PHP Brief"},
- {L"pic16", L"Pic 16"},
- {L"pike", L"Pike"},
- {L"pixelbender", L"Pixel Bender"},
- {L"plsql", L"PL/SQL"},
- {L"postgresql", L"PostgreSQL"},
- {L"povray", L"POV-Ray"},
- {L"powershell", L"Power Shell"},
- {L"powerbuilder", L"PowerBuilder"},
- {L"proftpd", L"ProFTPd"},
- {L"progress", L"Progress"},
- {L"prolog", L"Prolog"},
- {L"properties", L"Properties"},
- {L"providex", L"ProvideX"},
- {L"purebasic", L"PureBasic"},
- {L"pycon", L"PyCon"},
- {L"python", L"Python"},
- {L"q", L"q/kdb+"},
- {L"qbasic", L"QBasic"},
- {L"rsplus", L"R"},
- {L"rails", L"Rails"},
- {L"rebol", L"REBOL"},
- {L"reg", L"REG"},
- {L"robots", L"Robots"},
- {L"rpmspec", L"RPM Spec"},
- {L"ruby", L"Ruby"},
- {L"gnuplot", L"Ruby Gnuplot"},
- {L"sas", L"SAS"},
- {L"scala", L"Scala"},
- {L"scheme", L"Scheme"},
- {L"scilab", L"Scilab"},
- {L"sdlbasic", L"SdlBasic"},
- {L"smalltalk", L"Smalltalk"},
- {L"smarty", L"Smarty"},
- {L"sql", L"SQL"},
- {L"systemverilog", L"SystemVerilog"},
- {L"tsql", L"T-SQL"},
- {L"tcl", L"TCL"},
- {L"teraterm", L"Tera Term"},
- {L"thinbasic", L"thinBasic"},
- {L"typoscript", L"TypoScript"},
- {L"unicon", L"Unicon"},
- {L"uscript", L"UnrealScript"},
- {L"vala", L"Vala"},
- {L"vbnet", L"VB.NET"},
- {L"verilog", L"VeriLog"},
- {L"vhdl", L"VHDL"},
- {L"vim", L"VIM"},
- {L"visualprolog", L"Visual Pro Log"},
- {L"vb", L"VisualBasic"},
- {L"visualfoxpro", L"VisualFoxPro"},
- {L"whitespace", L"WhiteSpace"},
- {L"whois", L"WHOIS"},
- {L"winbatch", L"Win Batch"},
- {L"xbasic", L"XBasic"},
- {L"xml", L"XML"},
- {L"xorg_conf", L"Xorg Config"},
- {L"xpp", L"XPP"},
- {L"yaml", L"YAML"},
- {L"z80", L"Z80 Assembler"},
- {L"zxbasic", L"ZXBasic"},
+ { L"4cs", L"4CS" },
+ { L"6502acme", L"6502 ACME Cross Assembler" },
+ { L"6502kickass", L"6502 Kick Assembler" },
+ { L"6502tasm", L"6502 TASM/64TASS" },
+ { L"abap", L"ABAP" },
+ { L"actionscript", L"ActionScript" },
+ { L"actionscript3", L"ActionScript 3" },
+ { L"ada", L"Ada" },
+ { L"algol68", L"ALGOL 68" },
+ { L"apache", L"Apache Log" },
+ { L"applescript", L"AppleScript" },
+ { L"apt_sources", L"APT Sources" },
+ { L"asm", L"ASM (NASM)" },
+ { L"asp", L"ASP" },
+ { L"autoconf", L"autoconf" },
+ { L"autohotkey", L"Autohotkey" },
+ { L"autoit", L"AutoIt" },
+ { L"avisynth", L"Avisynth" },
+ { L"awk", L"Awk" },
+ { L"bascomavr", L"BASCOM AVR" },
+ { L"bash", L"Bash" },
+ { L"basic4gl", L"Basic4GL" },
+ { L"bibtex", L"BibTeX" },
+ { L"blitzbasic", L"Blitz Basic" },
+ { L"bnf", L"BNF" },
+ { L"boo", L"BOO" },
+ { L"bf", L"BrainFuck" },
+ { L"c", L"C" },
+ { L"c_mac", L"C for Macs" },
+ { L"cil", L"C Intermediate Language" },
+ { L"csharp", L"C#" },
+ { L"cpp", L"C++" },
+ { L"cpp-qt", L"C++ (with QT extensions)" },
+ { L"c_loadrunner", L"C: Loadrunner" },
+ { L"caddcl", L"CAD DCL" },
+ { L"cadlisp", L"CAD Lisp" },
+ { L"cfdg", L"CFDG" },
+ { L"chaiscript", L"ChaiScript" },
+ { L"clojure", L"Clojure" },
+ { L"klonec", L"Clone C" },
+ { L"klonecpp", L"Clone C++" },
+ { L"cmake", L"CMake" },
+ { L"cobol", L"COBOL" },
+ { L"coffeescript", L"CoffeeScript" },
+ { L"cfm", L"ColdFusion" },
+ { L"css", L"CSS" },
+ { L"cuesheet", L"Cuesheet" },
+ { L"d", L"D" },
+ { L"dcs", L"DCS" },
+ { L"delphi", L"Delphi" },
+ { L"oxygene", L"Delphi Prism (Oxygene)" },
+ { L"diff", L"Diff" },
+ { L"div", L"DIV" },
+ { L"dos", L"DOS" },
+ { L"dot", L"DOT" },
+ { L"e", L"E" },
+ { L"ecmascript", L"ECMAScript" },
+ { L"eiffel", L"Eiffel" },
+ { L"email", L"Email" },
+ { L"epc", L"EPC" },
+ { L"erlang", L"Erlang" },
+ { L"fsharp", L"F#" },
+ { L"falcon", L"Falcon" },
+ { L"fo", L"FO Language" },
+ { L"f1", L"Formula One" },
+ { L"fortran", L"Fortran" },
+ { L"freebasic", L"FreeBasic" },
+ { L"gambas", L"GAMBAS" },
+ { L"gml", L"Game Maker" },
+ { L"gdb", L"GDB" },
+ { L"genero", L"Genero" },
+ { L"genie", L"Genie" },
+ { L"gettext", L"GetText" },
+ { L"go", L"Go" },
+ { L"groovy", L"Groovy" },
+ { L"gwbasic", L"GwBasic" },
+ { L"haskell", L"Haskell" },
+ { L"hicest", L"HicEst" },
+ { L"hq9plus", L"HQ9 Plus" },
+ { L"html4strict", L"HTML" },
+ { L"html5", L"HTML 5" },
+ { L"icon", L"Icon" },
+ { L"idl", L"IDL" },
+ { L"ini", L"INI file" },
+ { L"inno", L"Inno Script" },
+ { L"intercal", L"INTERCAL" },
+ { L"io", L"IO" },
+ { L"j", L"J" },
+ { L"java", L"Java" },
+ { L"java5", L"Java 5" },
+ { L"javascript", L"JavaScript" },
+ { L"jquery", L"jQuery" },
+ { L"kixtart", L"KiXtart" },
+ { L"latex", L"Latex" },
+ { L"lb", L"Liberty BASIC" },
+ { L"lsl2", L"Linden Scripting" },
+ { L"lisp", L"Lisp" },
+ { L"llvm", L"LLVM" },
+ { L"locobasic", L"Loco Basic" },
+ { L"logtalk", L"Logtalk" },
+ { L"lolcode", L"LOL Code" },
+ { L"lotusformulas", L"Lotus Formulas" },
+ { L"lotusscript", L"Lotus Script" },
+ { L"lscript", L"LScript" },
+ { L"lua", L"Lua" },
+ { L"m68k", L"M68000 Assembler" },
+ { L"magiksf", L"MagikSF" },
+ { L"make", L"Make" },
+ { L"mapbasic", L"MapBasic" },
+ { L"matlab", L"MatLab" },
+ { L"mirc", L"mIRC" },
+ { L"mmix", L"MIX Assembler" },
+ { L"modula2", L"Modula 2" },
+ { L"modula3", L"Modula 3" },
+ { L"68000devpac", L"Motorola 68000 HiSoft Dev" },
+ { L"mpasm", L"MPASM" },
+ { L"mxml", L"MXML" },
+ { L"mysql", L"MySQL" },
+ { L"newlisp", L"newLISP" },
+ { L"text", L"None" },
+ { L"nsis", L"NullSoft Installer" },
+ { L"oberon2", L"Oberon 2" },
+ { L"objeck", L"Objeck Programming Langua" },
+ { L"objc", L"Objective C" },
+ { L"ocaml-brief", L"OCalm Brief" },
+ { L"ocaml", L"OCaml" },
+ { L"pf", L"OpenBSD PACKET FILTER" },
+ { L"glsl", L"OpenGL Shading" },
+ { L"oobas", L"Openoffice BASIC" },
+ { L"oracle11", L"Oracle 11" },
+ { L"oracle8", L"Oracle 8" },
+ { L"oz", L"Oz" },
+ { L"pascal", L"Pascal" },
+ { L"pawn", L"PAWN" },
+ { L"pcre", L"PCRE" },
+ { L"per", L"Per" },
+ { L"perl", L"Perl" },
+ { L"perl6", L"Perl 6" },
+ { L"php", L"PHP" },
+ { L"php-brief", L"PHP Brief" },
+ { L"pic16", L"Pic 16" },
+ { L"pike", L"Pike" },
+ { L"pixelbender", L"Pixel Bender" },
+ { L"plsql", L"PL/SQL" },
+ { L"postgresql", L"PostgreSQL" },
+ { L"povray", L"POV-Ray" },
+ { L"powershell", L"Power Shell" },
+ { L"powerbuilder", L"PowerBuilder" },
+ { L"proftpd", L"ProFTPd" },
+ { L"progress", L"Progress" },
+ { L"prolog", L"Prolog" },
+ { L"properties", L"Properties" },
+ { L"providex", L"ProvideX" },
+ { L"purebasic", L"PureBasic" },
+ { L"pycon", L"PyCon" },
+ { L"python", L"Python" },
+ { L"q", L"q/kdb+" },
+ { L"qbasic", L"QBasic" },
+ { L"rsplus", L"R" },
+ { L"rails", L"Rails" },
+ { L"rebol", L"REBOL" },
+ { L"reg", L"REG" },
+ { L"robots", L"Robots" },
+ { L"rpmspec", L"RPM Spec" },
+ { L"ruby", L"Ruby" },
+ { L"gnuplot", L"Ruby Gnuplot" },
+ { L"sas", L"SAS" },
+ { L"scala", L"Scala" },
+ { L"scheme", L"Scheme" },
+ { L"scilab", L"Scilab" },
+ { L"sdlbasic", L"SdlBasic" },
+ { L"smalltalk", L"Smalltalk" },
+ { L"smarty", L"Smarty" },
+ { L"sql", L"SQL" },
+ { L"systemverilog", L"SystemVerilog" },
+ { L"tsql", L"T-SQL" },
+ { L"tcl", L"TCL" },
+ { L"teraterm", L"Tera Term" },
+ { L"thinbasic", L"thinBasic" },
+ { L"typoscript", L"TypoScript" },
+ { L"unicon", L"Unicon" },
+ { L"uscript", L"UnrealScript" },
+ { L"vala", L"Vala" },
+ { L"vbnet", L"VB.NET" },
+ { L"verilog", L"VeriLog" },
+ { L"vhdl", L"VHDL" },
+ { L"vim", L"VIM" },
+ { L"visualprolog", L"Visual Pro Log" },
+ { L"vb", L"VisualBasic" },
+ { L"visualfoxpro", L"VisualFoxPro" },
+ { L"whitespace", L"WhiteSpace" },
+ { L"whois", L"WHOIS" },
+ { L"winbatch", L"Win Batch" },
+ { L"xbasic", L"XBasic" },
+ { L"xml", L"XML" },
+ { L"xorg_conf", L"Xorg Config" },
+ { L"xpp", L"XPP" },
+ { L"yaml", L"YAML" },
+ { L"z80", L"Z80 Assembler" },
+ { L"zxbasic", L"ZXBasic" },
};
PasteFormat PasteToWeb1::defFormats[] =
{
- {L"text", L"None"},
- {L"xml", L"XML"},
- {L"html4strict", L"HTML"},
- {L"html5", L"HTML 5"},
- {L"javascript", L"JavaScript"},
- {L"php", L"PHP"},
- {L"c", L"C"},
- {L"csharp", L"C#"},
- {L"cpp", L"C++"},
- {L"java", L"Java"},
- {L"java5", L"Java 5"},
- {L"ini", L"INI file"},
- {L"css", L"CSS"},
- {L"sql", L"SQL"},
- {L"asm", L"ASM (NASM)"},
- {L"asp", L"ASP"},
- {L"caddcl", L"CAD DCL"},
- {L"cadlisp", L"CAD Lisp"},
- {L"delphi", L"Delphi"},
- {L"diff", L"Diff"},
- {L"jquery", L"jQuery"},
- {L"latex", L"Latex"},
- {L"pascal", L"Pascal"},
- {L"perl", L"Perl"},
- {L"perl6", L"Perl 6"},
- {L"python", L"Python"},
- {L"vbnet", L"VB.NET"},
- {L"vb", L"VisualBasic"},
+ { L"text", L"None" },
+ { L"xml", L"XML" },
+ { L"html4strict", L"HTML" },
+ { L"html5", L"HTML 5" },
+ { L"javascript", L"JavaScript" },
+ { L"php", L"PHP" },
+ { L"c", L"C" },
+ { L"csharp", L"C#" },
+ { L"cpp", L"C++" },
+ { L"java", L"Java" },
+ { L"java5", L"Java 5" },
+ { L"ini", L"INI file" },
+ { L"css", L"CSS" },
+ { L"sql", L"SQL" },
+ { L"asm", L"ASM (NASM)" },
+ { L"asp", L"ASP" },
+ { L"caddcl", L"CAD DCL" },
+ { L"cadlisp", L"CAD Lisp" },
+ { L"delphi", L"Delphi" },
+ { L"diff", L"Diff" },
+ { L"jquery", L"jQuery" },
+ { L"latex", L"Latex" },
+ { L"pascal", L"Pascal" },
+ { L"perl", L"Perl" },
+ { L"perl6", L"Perl 6" },
+ { L"python", L"Python" },
+ { L"vbnet", L"VB.NET" },
+ { L"vb", L"VisualBasic" },
};
PasteToWeb1::PasteToWeb1()
@@ -273,23 +273,23 @@ void PasteToWeb1::SendToServer(std::wstring str, std::wstring fileName, std::wst content += Options::instance->webOptions[pageIndex]->combo1.empty() ? _T("1M") : Options::instance->webOptions[pageIndex]->combo1;
content += _T("&api_dev_key=dcba056bf9cc71729fdad76dddcb0dcd&api_paste_format=");
content += format;
- if(!Options::instance->webOptions[pageIndex]->pastebinUserKey.empty())
+ if (!Options::instance->webOptions[pageIndex]->pastebinUserKey.empty())
{
content += _T("&api_user_key=");
content += Options::instance->webOptions[pageIndex]->pastebinUserKey;
}
content += _T("&api_paste_code=");
- for(std::wstring::iterator it = str.begin(); it != str.end(); ++it)
+ for (std::wstring::iterator it = str.begin(); it != str.end(); ++it)
{
- if(*it == L'%')
+ if (*it == L'%')
{
content += L"%25";
}
- else if(*it ==L'&')
+ else if (*it == L'&')
{
content += L"%26";
}
- else if(*it ==L'=')
+ else if (*it == L'=')
{
content += L"%3D";
}
@@ -298,11 +298,11 @@ void PasteToWeb1::SendToServer(std::wstring str, std::wstring fileName, std::wst content += *it;
}
}
-
+
wchar_t* resCont = SendToWeb("http://pastebin.com/api/api_post.php", headers, content);
- if(resCont != NULL)
+ if (resCont != NULL)
{
- if(memcmp(L"Bad API request, ", resCont, 17 * sizeof(wchar_t)) == 0)
+ if (memcmp(L"Bad API request, ", resCont, 17 * sizeof(wchar_t)) == 0)
{
mir_sntprintf(bufErr, SIZEOF(bufErr), TranslateT("Error during sending text to web page: %s"), resCont + 17);
error = bufErr;
@@ -310,7 +310,7 @@ void PasteToWeb1::SendToServer(std::wstring str, std::wstring fileName, std::wst else
{
char* s = mir_u2a_cp(resCont, CP_ACP);
- strcpy_s(szFileLink, 256, s);
+ mir_strncpy(szFileLink, s, SIZEOF(szFileLink));
mir_free(s);
}
mir_free(resCont);
@@ -332,9 +332,9 @@ std::wstring PasteToWeb1::GetUserKey(std::wstring& user, std::wstring& password) content += _T("&api_dev_key=dcba056bf9cc71729fdad76dddcb0dcd");
wchar_t* resCont = SendToWeb("http://pastebin.com/api/api_login.php", headers, content);
std::wstring toRet;
- if(resCont != NULL)
+ if (resCont != NULL)
{
- if(memcmp(L"Bad API request, ", resCont, 17 * sizeof(wchar_t)) == 0)
+ if (memcmp(L"Bad API request, ", resCont, 17 * sizeof(wchar_t)) == 0)
{
mir_sntprintf(bufErr, SIZEOF(bufErr), TranslateT("Error during getting user key from web page: %s"), resCont + 17);
MessageBox(NULL, bufErr, TranslateT("Error"), MB_OK | MB_ICONERROR);
diff --git a/plugins/PasteIt/src/PasteToWeb2.cpp b/plugins/PasteIt/src/PasteToWeb2.cpp index b8bc45e331..a7f4c3f0fe 100644 --- a/plugins/PasteIt/src/PasteToWeb2.cpp +++ b/plugins/PasteIt/src/PasteToWeb2.cpp @@ -20,25 +20,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. PasteFormat PasteToWeb2::defFormats[] =
{
- {L"text", L"Text"},
- {L"xml", L"XML"},
- {L"html", L"HTML"},
- {L"js", L"JavaScript"},
- {L"php", L"PHP"},
- {L"c", L"C"},
- {L"csharp", L"C#"},
- {L"cpp", L"C++"},
- {L"java", L"Java"},
- {L"ini", L"INI"},
- {L"css", L"CSS"},
- {L"sql", L"SQL"},
- {L"nasm", L"NASM"},
- {L"delphi", L"Delphi"},
- {L"diff", L"Diff"},
- {L"tex", L"TeX"},
- {L"perl", L"Perl"},
- {L"python", L"Python"},
- {L"vb.net", L"VB.net"}
+ { L"text", L"Text" },
+ { L"xml", L"XML" },
+ { L"html", L"HTML" },
+ { L"js", L"JavaScript" },
+ { L"php", L"PHP" },
+ { L"c", L"C" },
+ { L"csharp", L"C#" },
+ { L"cpp", L"C++" },
+ { L"java", L"Java" },
+ { L"ini", L"INI" },
+ { L"css", L"CSS" },
+ { L"sql", L"SQL" },
+ { L"nasm", L"NASM" },
+ { L"delphi", L"Delphi" },
+ { L"diff", L"Diff" },
+ { L"tex", L"TeX" },
+ { L"perl", L"Perl" },
+ { L"python", L"Python" },
+ { L"vb.net", L"VB.net" }
};
PasteToWeb2::PasteToWeb2()
@@ -55,7 +55,7 @@ void PasteToWeb2::SendToServer(std::wstring str, std::wstring fileName, std::wst std::map<std::string, std::string> headers;
headers["Content-Type"] = "text/xml";
std::wstring content = _T("<?xml version=\"1.0\"?>\r\n<methodCall><methodName>create_paste</methodName><params><param><value>");
- if(fileName == L"")
+ if (fileName == L"")
{
content += format;
content += _T("</value></param><param><value>");
@@ -64,13 +64,13 @@ void PasteToWeb2::SendToServer(std::wstring str, std::wstring fileName, std::wst {
content += _T("</value></param><param><value>");
}
- for(std::wstring::iterator it = str.begin(); it != str.end(); ++it)
+ for (std::wstring::iterator it = str.begin(); it != str.end(); ++it)
{
- if(*it == L'&')
+ if (*it == L'&')
{
content += L"&";
}
- else if(*it ==L'<')
+ else if (*it == L'<')
{
content += L"<";
}
@@ -81,15 +81,15 @@ void PasteToWeb2::SendToServer(std::wstring str, std::wstring fileName, std::wst }
content += _T("</value></param><param><value></value></param><param><value>");
- if(fileName != L"")
+ if (fileName != L"")
{
- for(std::wstring::iterator it = fileName.begin(); it != fileName.end(); ++it)
+ for (std::wstring::iterator it = fileName.begin(); it != fileName.end(); ++it)
{
- if(*it == L'&')
+ if (*it == L'&')
{
content += L"&";
}
- else if(*it ==L'<')
+ else if (*it == L'<')
{
content += L"<";
}
@@ -100,28 +100,28 @@ void PasteToWeb2::SendToServer(std::wstring str, std::wstring fileName, std::wst }
}
content += _T("</value></param><param><value></value></param><param><value><double>1.5</double></value></param></params></methodCall>");
-
+
wchar_t* resCont = SendToWeb("http://wklej.to/api/", headers, content);
error = TranslateT("Error during sending text to web page");
- if(resCont != NULL)
+ if (resCont != NULL)
{
HXML hXml = xi.parseString(resCont, NULL, _T("methodResponse"));
- if(hXml != NULL)
+ if (hXml != NULL)
{
HXML node = xi.getChildByPath(hXml, _T("params/param/value/array/data/value/int"), 0);
- if(node != NULL && !_tcscmp(xi.getText(node), _T("1")))
+ if (node != NULL && !mir_tstrcmp(xi.getText(node), _T("1")))
{
node = xi.getChildByPath(hXml, _T("params/param/value/array/data"), 0);
- if(node != NULL)
+ if (node != NULL)
{
node = xi.getNthChild(node, _T("value"), 1);
- if(node != NULL)
+ if (node != NULL)
{
node = xi.getChildByPath(node, _T("string"), 0);
- if(node != NULL)
+ if (node != NULL)
{
char* s = mir_t2a_cp(xi.getText(node), CP_ACP);
- strcpy_s(szFileLink, 256, s);
+ mir_strncpy(szFileLink, s, SIZEOF(szFileLink));
mir_free(s);
error = NULL;
}
@@ -137,51 +137,51 @@ void PasteToWeb2::SendToServer(std::wstring str, std::wstring fileName, std::wst std::list<PasteFormat> PasteToWeb2::GetFormats()
{
std::list<PasteFormat> ret;
-
+
std::map<std::string, std::string> headers;
headers["Content-Type"] = "text/xml";
std::wstring content = _T("<?xml version=\"1.0\"?>\r\n<methodCall><methodName>types</methodName></methodCall>");
-
+
wchar_t* resCont = SendToWeb("http://wklej.to/api/", headers, content);
- if(resCont != NULL)
+ if (resCont != NULL)
{
HXML hXml = xi.parseString(resCont, NULL, _T("methodResponse"));
- if(hXml != NULL)
+ if (hXml != NULL)
{
HXML node = xi.getChildByPath(hXml, _T("params/param/value/array/data/value/int"), 0);
- if(node != NULL && !_tcscmp(xi.getText(node), _T("1")))
+ if (node != NULL && !mir_tstrcmp(xi.getText(node), _T("1")))
{
node = xi.getChildByPath(hXml, _T("params/param/value/array/data"), 0);
- if(node != NULL)
+ if (node != NULL)
{
node = xi.getNthChild(node, _T("value"), 1);
- if(node != NULL)
+ if (node != NULL)
{
node = xi.getChildByPath(node, _T("string"), 0);
- if(node != NULL)
+ if (node != NULL)
{
std::wstring str = xi.getText(node);
std::wstring::size_type pos = str.find(L'\n');
- if(pos < str.length())
+ if (pos < str.length())
{
str = str.substr(pos + 1);
}
pos = str.find(L'\n');
- if(pos < str.length())
+ if (pos < str.length())
{
str = str.substr(pos + 1);
}
pos = str.find(L'\n');
- while(pos < str.length())
+ while (pos < str.length())
{
std::wstring line = str.substr(0, pos);
std::wstring::size_type sep = line.find(L':');
- if(sep < line.length())
+ if (sep < line.length())
{
PasteFormat pf;
pf.name = line.substr(0, sep);
std::wstring::size_type sep2 = line.find(L',');
- if(sep2 < line.length())
+ if (sep2 < line.length())
{
pf.id = line.substr(sep + 2, sep2 - sep - 2);
}
@@ -192,7 +192,7 @@ std::list<PasteFormat> PasteToWeb2::GetFormats() ret.push_back(pf);
}
- if(pos < str.length() - 1)
+ if (pos < str.length() - 1)
{
str = str.substr(pos + 1);
}
@@ -205,12 +205,12 @@ std::list<PasteFormat> PasteToWeb2::GetFormats() {
std::wstring line = str;
std::wstring::size_type sep = line.find(L':');
- if(sep < line.length())
+ if (sep < line.length())
{
PasteFormat pf;
pf.name = line.substr(0, sep);
std::wstring::size_type sep2 = line.find(L',');
- if(sep2 < line.length())
+ if (sep2 < line.length())
{
pf.id = line.substr(sep + 2, sep2 - sep - 2);
}
diff --git a/plugins/PasteIt/src/version.h b/plugins/PasteIt/src/version.h index 6771141b89..782bf851a2 100644 --- a/plugins/PasteIt/src/version.h +++ b/plugins/PasteIt/src/version.h @@ -2,7 +2,7 @@ #define __MINOR_VERSION 0
#define __RELEASE_NUM 0
#define __BUILD_NUM 3
-
+
#include <stdver.h>
#define __PLUGIN_NAME "Paste it"
|