diff options
Diffstat (limited to 'plugins/HTTPServer/src')
-rw-r--r-- | plugins/HTTPServer/src/Glob.h | 2 | ||||
-rw-r--r-- | plugins/HTTPServer/src/GuiElements.cpp | 25 | ||||
-rw-r--r-- | plugins/HTTPServer/src/IndexHTML.cpp | 2 | ||||
-rw-r--r-- | plugins/HTTPServer/src/main.cpp | 18 |
4 files changed, 26 insertions, 21 deletions
diff --git a/plugins/HTTPServer/src/Glob.h b/plugins/HTTPServer/src/Glob.h index ba1cb0e1e9..fe853b5e00 100644 --- a/plugins/HTTPServer/src/Glob.h +++ b/plugins/HTTPServer/src/Glob.h @@ -54,7 +54,7 @@ using namespace std; #define SD_BOTH 0x02
#define MODULENAME "HTTPServer"
-#define MSG_BOX_TITEL Translate("Miranda NG HTTP-Server")
+#define MSG_BOX_TITLE "Miranda NG HTTP-Server"
#define SplitIpAddress( p ) (BYTE)(p>>24),(BYTE)(p>>16),(BYTE)(p>>8),(BYTE)(p)
diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index a8b08272a7..285cc7595f 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -416,7 +416,6 @@ UINT_PTR CALLBACK ShareNewFileDialogHook( return false;
}
-
/////////////////////////////////////////////////////////////////////
// Member Function : bShowShareNewFileDlg
// Type : Global
@@ -432,13 +431,12 @@ UINT_PTR CALLBACK ShareNewFileDialogHook( bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare)
{
- OPENFILENAME ofn = { 0 };
- ofn.lStructSize = sizeof(OPENFILENAME);
-
char temp[MAX_PATH];
mir_snprintf(temp, "%s (*.*)%c*.*%c%c", Translate("All files"), 0, 0, 0);
- ofn.lpstrFilter = temp;
+ OPENFILENAME ofn = { 0 };
+ ofn.lStructSize = sizeof(OPENFILENAME);
+ ofn.lpstrFilter = temp;
ofn.lpstrFile = pstNewShare->pszRealPath;
ofn.nMaxFile = pstNewShare->dwMaxRealPath;
@@ -449,7 +447,6 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) *ofn.lpstrFile = '\0';
}
-
ofn.Flags = /*OFN_DONTADDTORECENT |*/ OFN_NOREADONLYRETURN
| OFN_ENABLEHOOK | OFN_ENABLETEMPLATE | OFN_EXPLORER | OFN_ENABLESIZING
| OFN_ALLOWMULTISELECT;
@@ -477,10 +474,10 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) pszFileNamePos = strchr(pszFileNamePos, '"');
if (pszFileNamePos) {
pszFileNamePos++;
- char* start = pszFileNamePos;
+ char *start = pszFileNamePos;
pszFileNamePos = strchr(pszFileNamePos, '"');
if (pszFileNamePos) {
- char* end = pszFileNamePos;
+ char *end = pszFileNamePos;
memmove(pstNewShare->pszSrvPath + 1, start, end - start);
*(end - (start - (pstNewShare->pszSrvPath + 1))) = '\0';
@@ -490,7 +487,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) pstNewShare->pszRealPath[pstNewShare->dwMaxRealPath] = '\0';
if (CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)pstNewShare)) {
- MessageBox(nullptr, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
+ MessageBoxW(nullptr, TranslateT("Failed to share new file"), TranslateW(_A2W(MSG_BOX_TITLE)), MB_OK);
return false;
}
pszFileNamePos++;
@@ -501,7 +498,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) }
else {
if (CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)pstNewShare)) {
- MessageBox(nullptr, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
+ MessageBoxW(nullptr, TranslateT("Failed to share new file"), TranslateW(_A2W(MSG_BOX_TITLE)), MB_OK);
return false;
}
}
@@ -790,7 +787,7 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara strncpy(&szServPath[1], fileName + 1, MAX_PATH - 2);
if (CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)&stNewShare)) {
- MessageBox(nullptr, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
+ MessageBoxW(nullptr, TranslateT("Failed to share new file"), TranslateW(_A2W(MSG_BOX_TITLE)), MB_OK);
return false;
}
}
@@ -1192,7 +1189,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP mir_snprintf(szKeyWord, Translate("Your external IP was detected as %d.%d.%d.%d\r\nby: %s"),
SplitIpAddress(dwExternalIP),
szUrl);
- MessageBox(hwndDlg, szKeyWord, MSG_BOX_TITEL, MB_OK);
+ MessageBox(hwndDlg, szKeyWord, Translate(MSG_BOX_TITLE), MB_OK);
}
break;
@@ -1209,14 +1206,14 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP bool bNew = IsDlgButtonChecked(hwndDlg, IDC_ADD_STATISTICS_MENU_ITEM) == BST_CHECKED;
if (b != bNew) {
g_plugin.setByte("AddStatisticsMenuItem", bNew);
- MessageBox(hwndDlg, Translate("You need to restart Miranda to change the main menu"), MSG_BOX_TITEL, MB_OK);
+ MessageBoxW(hwndDlg, TranslateT("You need to restart Miranda to change the main menu"), TranslateW(_A2W(MSG_BOX_TITLE)), MB_OK);
}
b = g_plugin.getByte("AddAcceptConMenuItem", 1) != 0;
bNew = IsDlgButtonChecked(hwndDlg, IDC_ACCEPT_COM_MENU_ITEM) == BST_CHECKED;
if (b != bNew) {
g_plugin.setByte("AddAcceptConMenuItem", bNew);
- MessageBox(hwndDlg, Translate("You need to restart Miranda to change the main menu"), MSG_BOX_TITEL, MB_OK);
+ MessageBoxW(hwndDlg, TranslateT("You need to restart Miranda to change the main menu"), TranslateW(_A2W(MSG_BOX_TITLE)), MB_OK);
}
bNew = IsDlgButtonChecked(hwndDlg, IDC_WRITE_LOG_FILE) == BST_CHECKED;
diff --git a/plugins/HTTPServer/src/IndexHTML.cpp b/plugins/HTTPServer/src/IndexHTML.cpp index c32f782f81..b46ce7bb6b 100644 --- a/plugins/HTTPServer/src/IndexHTML.cpp +++ b/plugins/HTTPServer/src/IndexHTML.cpp @@ -69,7 +69,7 @@ bool LoadIndexHTMLTemplate() HANDLE hFile = CreateFile(pszBuf, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
- MessageBox(nullptr, "HTTPServerIndex.html not found in Plugin Path", MSG_BOX_TITEL, MB_OK);
+ MessageBoxW(nullptr, L"HTTPServerIndex.html not found in Plugin Path", TranslateW(_A2W(MSG_BOX_TITLE)), MB_OK);
return false;
}
diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index c430b0574f..80b12983a3 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -42,6 +42,12 @@ const char* pszDefaultShares[] = { nullptr, nullptr
};
+static IconItem iconList[] =
+{
+ { "Disable server", "disable", IDI_DISABLE_SERVER },
+ { "Enable server", "enable", IDI_SHARE_NEW_FILE },
+};
+
int OptionsInitialize(WPARAM, LPARAM);
int PreShutdown(WPARAM, LPARAM);
@@ -628,18 +634,18 @@ INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/) char szTemp[200];
mir_snprintf(szTemp, Translate("Failed to bind to port %s\r\nThis is most likely because another program or service is using this port"),
nlb.wPort == 80 ? "80" : nus.szIncomingPorts);
- MessageBox(nullptr, szTemp, MSG_BOX_TITEL, MB_OK);
+ MessageBox(nullptr, szTemp, MSG_BOX_TITLE, MB_OK);
return 1001;
}
dwLocalPortUsed = nlb.wPort;
dwLocalIpAddress = nlb.dwInternalIP;
- Menu_ModifyItem(hAcceptConnectionsMenuItem, LPGENW("Disable HTTP server"), LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_DISABLE_SERVER)));
+ Menu_ModifyItem(hAcceptConnectionsMenuItem, LPGENW("Disable HTTP server"), iconList[0].hIcolib);
}
else if (hDirectBoundPort && wparam == 0) {
Netlib_CloseHandle(hDirectBoundPort);
hDirectBoundPort = nullptr;
- Menu_ModifyItem(hAcceptConnectionsMenuItem, LPGENW("Enable HTTP server"), LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SHARE_NEW_FILE)));
+ Menu_ModifyItem(hAcceptConnectionsMenuItem, LPGENW("Enable HTTP server"), iconList[1].hIcolib);
}
else return 0; // no changes;
@@ -785,6 +791,8 @@ int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) int CMPlugin::Load()
{
+ g_plugin.registerIcon(MSG_BOX_TITLE, iconList, MODULENAME);
+
hHttpAcceptConnectionsService = CreateServiceFunction(MS_HTTP_ACCEPT_CONNECTIONS, nToggelAcceptConnections);
hHttpAddChangeRemoveService = CreateServiceFunction(MS_HTTP_ADD_CHANGE_REMOVE, nAddChangeRemoveShare);
hHttpGetShareService = CreateServiceFunction(MS_HTTP_GET_SHARE, nGetShare);
@@ -797,7 +805,7 @@ int CMPlugin::Load() mir_strncat(szPluginPath, "\\HTTPServer\\", _countof(szPluginPath) - mir_strlen(szPluginPath));
int err = CreateDirectoryTree(szPluginPath);
if ((err != 0) && (err != ERROR_ALREADY_EXISTS)) {
- MessageBox(nullptr, "Failed to create HTTPServer directory.", MSG_BOX_TITEL, MB_OK);
+ MessageBoxW(nullptr, L"Failed to create HTTPServer directory.", TranslateW(_A2W(MSG_BOX_TITLE)), MB_OK);
return 1;
}
@@ -807,7 +815,7 @@ int CMPlugin::Load() sLogFilePath += "HTTPServer.log";
if (!bInitMimeHandling())
- MessageBox(nullptr, "Failed to read configuration file : " szMimeTypeConfigFile, MSG_BOX_TITEL, MB_OK);
+ MessageBoxW(nullptr, L"Failed to read configuration file : " szMimeTypeConfigFile, TranslateW(_A2W(MSG_BOX_TITLE)), MB_OK);
nMaxUploadSpeed = g_plugin.getDword("MaxUploadSpeed", nMaxUploadSpeed);
nMaxConnectionsTotal = g_plugin.getDword("MaxConnectionsTotal", nMaxConnectionsTotal);
|