diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/netlib/netliblog.cpp | 302 | ||||
-rw-r--r-- | src/resource.h | 1 | ||||
-rw-r--r-- | src/resource.rc | 7 |
3 files changed, 130 insertions, 180 deletions
diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp index 99f0aff8ba..b09a6bdcb1 100644 --- a/src/modules/netlib/netliblog.cpp +++ b/src/modules/netlib/netliblog.cpp @@ -44,8 +44,8 @@ struct { int showUser;
int dumpSent, dumpRecv, dumpProxy, dumpSsl;
int textDumps, autoDetectText;
- int save;
-} logOptions = {0};
+}
+logOptions = {0};
typedef struct {
const char* pszHead;
@@ -67,50 +67,47 @@ static const TCHAR* szTimeFormats[] = static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch(message) {
+ TCHAR str[MAX_PATH];
+
+ switch (message) {
case WM_INITDIALOG:
logOptions.hwndOpts = hwndDlg;
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_DUMPRECV, logOptions.dumpRecv?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DUMPSENT, logOptions.dumpSent?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DUMPPROXY, logOptions.dumpProxy?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DUMPSSL, logOptions.dumpSsl?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TEXTDUMPS, logOptions.textDumps?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTODETECTTEXT, logOptions.autoDetectText?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DUMPRECV, logOptions.dumpRecv ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DUMPSENT, logOptions.dumpSent ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DUMPPROXY, logOptions.dumpProxy ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DUMPSSL, logOptions.dumpSsl ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TEXTDUMPS, logOptions.textDumps ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTODETECTTEXT, logOptions.autoDetectText ? BST_CHECKED : BST_UNCHECKED);
{
- int i;
- for (i=0; i < SIZEOF(szTimeFormats); i++)
+ for (int i=0; i < SIZEOF(szTimeFormats); i++)
SendDlgItemMessage(hwndDlg, IDC_TIMEFORMAT, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szTimeFormats[i]));
}
SendDlgItemMessage(hwndDlg, IDC_TIMEFORMAT, CB_SETCURSEL, logOptions.timeFormat, 0);
- CheckDlgButton(hwndDlg, IDC_SHOWNAMES, logOptions.showUser?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TOOUTPUTDEBUGSTRING, logOptions.toOutputDebugString?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TOFILE, logOptions.toFile?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWNAMES, logOptions.showUser ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TOOUTPUTDEBUGSTRING, logOptions.toOutputDebugString ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TOFILE, logOptions.toFile ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemText(hwndDlg, IDC_FILENAME, logOptions.szUserFile);
SetDlgItemText(hwndDlg, IDC_PATH, logOptions.szFile);
- CheckDlgButton(hwndDlg, IDC_SHOWTHISDLGATSTART, db_get_b(NULL, "Netlib", "ShowLogOptsAtStart", 0)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWTHISDLGATSTART, db_get_b(NULL, "Netlib", "ShowLogOptsAtStart", 0) ? BST_CHECKED : BST_UNCHECKED);
{
DBVARIANT dbv;
- if ( !db_get_s(NULL, "Netlib", "RunAtStart", &dbv)) {
+ if (!db_get_s(NULL, "Netlib", "RunAtStart", &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_RUNATSTART, dbv.pszVal);
db_free(&dbv);
}
- }
- logOptions.save = 0;
- {
- TVINSERTSTRUCT tvis = {0};
- int i;
+
+ TVINSERTSTRUCT tvis = { 0 };
HWND hwndFilter = GetDlgItem(hwndDlg, IDC_FILTER);
SetWindowLongPtr(hwndFilter, GWL_STYLE, GetWindowLongPtr(hwndFilter, GWL_STYLE) | (TVS_NOHSCROLL | TVS_CHECKBOXES));
tvis.hParent = NULL;
tvis.hInsertAfter = TVI_SORT;
- tvis.item.mask = TVIF_PARAM|TVIF_TEXT|TVIF_STATE;
+ tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
- for (i=0; i < netlibUser.getCount(); i++)
- {
+ for (int i = 0; i < netlibUser.getCount(); i++) {
tvis.item.pszText = netlibUser[i]->user.ptszDescriptiveName;
tvis.item.lParam = i;
tvis.item.state = INDEXTOSTATEIMAGEMASK((netlibUser[i]->toLog) ? 2 : 1);
@@ -122,22 +119,9 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa TreeView_InsertItem(hwndFilter, &tvis);
}
return TRUE;
+
case WM_COMMAND:
- switch(LOWORD(wParam)) {
-/*
- case IDC_DUMPRECV:
- case IDC_DUMPSENT:
- case IDC_DUMPPROXY:
- case IDC_TEXTDUMPS:
- case IDC_AUTODETECTTEXT:
- case IDC_TIMEFORMAT:
- case IDC_SHOWNAMES:
- case IDC_TOOUTPUTDEBUGSTRING:
- case IDC_TOFILE:
- case IDC_SHOWTHISDLGATSTART:
- case IDC_RUNATSTART:
- break;
-*/
+ switch (LOWORD(wParam)) {
case IDC_FILENAME:
if (HIWORD(wParam) == EN_CHANGE) {
if ((HWND)lParam == GetFocus())
@@ -146,147 +130,118 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa TCHAR path[MAX_PATH];
GetWindowText((HWND)lParam, path, MAX_PATH);
- PathToAbsoluteT( VARST(path), path);
+ PathToAbsoluteT(VARST(path), path);
SetDlgItemText(hwndDlg, IDC_PATH, path);
}
break;
+
case IDC_FILENAMEBROWSE:
case IDC_RUNATSTARTBROWSE:
- {
- TCHAR str[MAX_PATH+2];
- OPENFILENAME ofn = {0};
- TCHAR filter[512], *pfilter;
-
GetWindowText(GetWindow((HWND)lParam, GW_HWNDPREV), str, SIZEOF(str));
- ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
- ofn.hwndOwner = hwndDlg;
- ofn.Flags = OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
- if (LOWORD(wParam) == IDC_FILENAMEBROWSE) {
- ofn.lpstrTitle = TranslateT("Select where log file will be created");
- } else {
- ofn.Flags|=OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST;
- ofn.lpstrTitle = TranslateT("Select program to be run");
- }
- _tcscpy(filter, TranslateT("All files"));
- _tcscat(filter, _T(" (*)"));
- pfilter = filter+lstrlen(filter)+1;
- _tcscpy(pfilter, _T("*"));
- pfilter = pfilter+lstrlen(pfilter)+1;
- *pfilter = '\0';
- ofn.lpstrFilter = filter;
- ofn.lpstrFile = str;
- ofn.nMaxFile = SIZEOF(str)-2;
- ofn.nMaxFileTitle = MAX_PATH;
- if (LOWORD(wParam) == IDC_FILENAMEBROWSE) {
- if ( !GetSaveFileName(&ofn)) return 1;
- } else {
- if ( !GetOpenFileName(&ofn)) return 1;
- }
- if (LOWORD(wParam) == IDC_RUNATSTARTBROWSE && _tcschr(str, ' ') != NULL) {
- MoveMemory(str+1, str, SIZEOF(str)-2);
- str[0] = '"';
- lstrcat(str, _T("\""));
+ {
+ TCHAR filter[512];
+ OPENFILENAME ofn = { 0 };
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
+ ofn.hwndOwner = hwndDlg;
+ ofn.Flags = OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
+ if (LOWORD(wParam) == IDC_FILENAMEBROWSE)
+ ofn.lpstrTitle = TranslateT("Select where log file will be created");
+ else {
+ ofn.Flags |= OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
+ ofn.lpstrTitle = TranslateT("Select program to be run");
+ }
+ _tcscpy(filter, TranslateT("All files"));
+ _tcscat(filter, _T(" (*)"));
+ TCHAR *pfilter = filter + lstrlen(filter) + 1;
+ _tcscpy(pfilter, _T("*"));
+ pfilter = pfilter + lstrlen(pfilter) + 1;
+ *pfilter = '\0';
+ ofn.lpstrFilter = filter;
+ ofn.lpstrFile = str;
+ ofn.nMaxFile = SIZEOF(str) - 2;
+ ofn.nMaxFileTitle = MAX_PATH;
+ if (LOWORD(wParam) == IDC_FILENAMEBROWSE) {
+ if (!GetSaveFileName(&ofn)) return 1;
+ }
+ else if (!GetOpenFileName(&ofn))
+ return 1;
+
+ if (LOWORD(wParam) == IDC_RUNATSTARTBROWSE && _tcschr(str, ' ') != NULL) {
+ MoveMemory(str + 1, str, SIZEOF(str) - 2);
+ str[0] = '"';
+ lstrcat(str, _T("\""));
+ }
+ SetWindowText(GetWindow((HWND)lParam, GW_HWNDPREV), str);
}
- SetWindowText(GetWindow((HWND)lParam, GW_HWNDPREV), str);
break;
- }
+
case IDC_RUNNOW:
- {
- TCHAR str[MAX_PATH+1];
- STARTUPINFO si = {0};
+ GetDlgItemText(hwndDlg, IDC_RUNATSTART, str, MAX_PATH);
+ if (str[0]) {
+ STARTUPINFO si = { sizeof(si) };
PROCESS_INFORMATION pi;
- GetDlgItemText(hwndDlg, IDC_RUNATSTART, str, MAX_PATH);
- si.cb = sizeof(si);
- if (str[0]) CreateProcess(NULL, str, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+ CreateProcess(NULL, str, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
}
break;
- case IDC_SAVE:
- logOptions.save = 1;
- //
+
case IDOK:
- {
- TCHAR str[MAX_PATH];
-
- GetDlgItemText(hwndDlg, IDC_RUNATSTART, str, MAX_PATH);
- db_set_ts(NULL, "Netlib", "RunAtStart", str);
- db_set_b(NULL, "Netlib", "ShowLogOptsAtStart", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTHISDLGATSTART));
-
- mir_free(logOptions.szUserFile);
- GetWindowText( GetDlgItem(hwndDlg, IDC_FILENAME), str, MAX_PATH);
- logOptions.szUserFile = mir_tstrdup(str);
-
- mir_free(logOptions.szFile);
- GetWindowText( GetDlgItem(hwndDlg, IDC_PATH), str, MAX_PATH);
- logOptions.szFile = mir_tstrdup(str);
-
- logOptions.dumpRecv = IsDlgButtonChecked(hwndDlg, IDC_DUMPRECV);
- logOptions.dumpSent = IsDlgButtonChecked(hwndDlg, IDC_DUMPSENT);
- logOptions.dumpProxy = IsDlgButtonChecked(hwndDlg, IDC_DUMPPROXY);
- logOptions.dumpSsl = IsDlgButtonChecked(hwndDlg, IDC_DUMPSSL);
- logOptions.textDumps = IsDlgButtonChecked(hwndDlg, IDC_TEXTDUMPS);
- logOptions.autoDetectText = IsDlgButtonChecked(hwndDlg, IDC_AUTODETECTTEXT);
- logOptions.timeFormat = SendDlgItemMessage(hwndDlg, IDC_TIMEFORMAT, CB_GETCURSEL, 0, 0);
- logOptions.showUser = IsDlgButtonChecked(hwndDlg, IDC_SHOWNAMES);
- logOptions.toOutputDebugString = IsDlgButtonChecked(hwndDlg, IDC_TOOUTPUTDEBUGSTRING);
- logOptions.toFile = IsDlgButtonChecked(hwndDlg, IDC_TOFILE);
- }
+ GetDlgItemText(hwndDlg, IDC_RUNATSTART, str, MAX_PATH);
+ db_set_ts(NULL, "Netlib", "RunAtStart", str);
+ db_set_b(NULL, "Netlib", "ShowLogOptsAtStart", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTHISDLGATSTART));
+
+ GetWindowText(GetDlgItem(hwndDlg, IDC_FILENAME), str, MAX_PATH);
+ replaceStrT(logOptions.szUserFile, str);
+
+ GetWindowText(GetDlgItem(hwndDlg, IDC_PATH), str, MAX_PATH);
+ replaceStrT(logOptions.szFile, str);
+ db_set_ts(NULL, "Netlib", "File", logOptions.szFile);
+
+ db_set_b(NULL, "Netlib", "DumpRecv", logOptions.dumpRecv = IsDlgButtonChecked(hwndDlg, IDC_DUMPRECV));
+ db_set_b(NULL, "Netlib", "DumpSent", logOptions.dumpSent = IsDlgButtonChecked(hwndDlg, IDC_DUMPSENT));
+ db_set_b(NULL, "Netlib", "DumpProxy", logOptions.dumpProxy = IsDlgButtonChecked(hwndDlg, IDC_DUMPPROXY));
+ db_set_b(NULL, "Netlib", "DumpSsl", logOptions.dumpSsl = IsDlgButtonChecked(hwndDlg, IDC_DUMPSSL));
+ db_set_b(NULL, "Netlib", "TextDumps", logOptions.textDumps = IsDlgButtonChecked(hwndDlg, IDC_TEXTDUMPS));
+ db_set_b(NULL, "Netlib", "AutoDetectText", logOptions.autoDetectText = IsDlgButtonChecked(hwndDlg, IDC_AUTODETECTTEXT));
+ db_set_b(NULL, "Netlib", "TimeFormat", logOptions.timeFormat = SendDlgItemMessage(hwndDlg, IDC_TIMEFORMAT, CB_GETCURSEL, 0, 0));
+ db_set_b(NULL, "Netlib", "ShowUser", logOptions.showUser = IsDlgButtonChecked(hwndDlg, IDC_SHOWNAMES));
+ db_set_b(NULL, "Netlib", "ToOutputDebugString", logOptions.toOutputDebugString = IsDlgButtonChecked(hwndDlg, IDC_TOOUTPUTDEBUGSTRING));
+ db_set_b(NULL, "Netlib", "ToFile", logOptions.toFile = IsDlgButtonChecked(hwndDlg, IDC_TOFILE));
{
HWND hwndFilter = GetDlgItem(logOptions.hwndOpts, IDC_FILTER);
- TVITEM tvi = {0};
+ TVITEM tvi = { 0 };
BOOL checked;
- tvi.mask = TVIF_HANDLE|TVIF_PARAM|TVIF_STATE|TVIF_TEXT;
+ tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE | TVIF_TEXT;
tvi.hItem = TreeView_GetRoot(hwndFilter);
- while (tvi.hItem)
- {
+ while (tvi.hItem) {
TreeView_GetItem(hwndFilter, &tvi);
- checked = ((tvi.state&TVIS_STATEIMAGEMASK)>>12 == 2);
+ checked = ((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 2);
if (tvi.lParam == -1) {
logOptions.toLog = checked;
- if (logOptions.save)
db_set_dw(NULL, "Netlib", "NLlog", checked);
}
- else
- if (tvi.lParam < netlibUser.getCount()) {
+ else if (tvi.lParam < netlibUser.getCount()) {
netlibUser[tvi.lParam]->toLog = checked;
- if (logOptions.save)
- db_set_dw(NULL, netlibUser[tvi.lParam]->user.szSettingsModule, "NLlog", checked);
+ db_set_dw(NULL, netlibUser[tvi.lParam]->user.szSettingsModule, "NLlog", checked);
}
tvi.hItem = TreeView_GetNextSibling(hwndFilter, tvi.hItem);
}
}
- if (logOptions.save) {
- db_set_b(NULL, "Netlib", "DumpRecv", (BYTE)logOptions.dumpRecv);
- db_set_b(NULL, "Netlib", "DumpSent", (BYTE)logOptions.dumpSent);
- db_set_b(NULL, "Netlib", "DumpProxy", (BYTE)logOptions.dumpProxy);
- db_set_b(NULL, "Netlib", "DumpSsl", (BYTE)logOptions.dumpSsl);
- db_set_b(NULL, "Netlib", "TextDumps", (BYTE)logOptions.textDumps);
- db_set_b(NULL, "Netlib", "AutoDetectText", (BYTE)logOptions.autoDetectText);
- db_set_b(NULL, "Netlib", "TimeFormat", (BYTE)logOptions.timeFormat);
- db_set_b(NULL, "Netlib", "ShowUser", (BYTE)logOptions.showUser);
- db_set_b(NULL, "Netlib", "ToOutputDebugString", (BYTE)logOptions.toOutputDebugString);
- db_set_b(NULL, "Netlib", "ToFile", (BYTE)logOptions.toFile);
- db_set_ts(NULL, "Netlib", "File", logOptions.szFile ? logOptions.szUserFile: _T(""));
- logOptions.save = 0;
- }
- else
- DestroyWindow(hwndDlg);
-
- break;
case IDCANCEL:
DestroyWindow(hwndDlg);
- break;
}
break;
+
case WM_CLOSE:
DestroyWindow(hwndDlg);
break;
+
case WM_DESTROY:
- ImageList_Destroy(TreeView_GetImageList( GetDlgItem(hwndDlg, IDC_FILTER), TVSIL_STATE));
+ ImageList_Destroy(TreeView_GetImageList(GetDlgItem(hwndDlg, IDC_FILTER), TVSIL_STATE));
logOptions.hwndOpts = NULL;
break;
}
@@ -308,32 +263,31 @@ static INT_PTR ShowOptions(WPARAM, LPARAM) static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam)
{
- NetlibUser *nlu = (NetlibUser*)wParam;
- NetlibUser nludummy;
- const char *pszMsg = (const char*)lParam;
- char szTime[32], szHead[128];
- LARGE_INTEGER liTimeNow;
- DWORD dwOriginalLastError;
-
- if ( !bIsActive)
+ if (!bIsActive)
return 0;
+ DWORD dwOriginalLastError = GetLastError();
+
+ NetlibUser *nlu = (NetlibUser*)wParam;
+ const char *pszMsg = (const char*)lParam;
if ((nlu != NULL && GetNetlibHandleType(nlu) != NLH_USER) || pszMsg == NULL) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
/* if the Netlib user handle is NULL, just pretend its not */
+ NetlibUser nludummy;
if (nlu == NULL) {
- if ( !logOptions.toLog)
+ if (!logOptions.toLog)
return 1;
nlu = &nludummy;
nlu->user.szSettingsModule = "(NULL)";
}
- else if ( !nlu->toLog)
+ else if (!nlu->toLog)
return 1;
- dwOriginalLastError = GetLastError();
+ LARGE_INTEGER liTimeNow;
+ char szTime[32], szHead[128];
switch (logOptions.timeFormat) {
case TIMEFORMAT_HHMMSS:
GetTimeFormatA(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER,
@@ -374,7 +328,7 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam) if (logOptions.toFile && logOptions.szFile[0]) {
size_t len = strlen(pszMsg);
- mir_writeLogA(hLogger, "%s%s%s", szHead, pszMsg, pszMsg[len-1] == '\n' ? "" : "\r\n");
+ mir_writeLogA(hLogger, "%s%s%s", szHead, pszMsg, pszMsg[len - 1] == '\n' ? "" : "\r\n");
}
LOGMSG logMsg = { szHead, pszMsg };
@@ -395,8 +349,7 @@ static INT_PTR NetlibLogW(WPARAM wParam, LPARAM lParam) void NetlibLogf(NetlibUser* nlu, const char *fmt, ...)
{
- if (nlu == NULL)
- {
+ if (nlu == NULL) {
if ( !logOptions.toLog)
return;
}
@@ -427,7 +380,7 @@ void NetlibDumpData(NetlibConnection *nlc, PBYTE buf, int len, int sent, int fla return;
// Check user's log settings
- if ( !(logOptions.toOutputDebugString || GetSubscribersCount(hLogEvent) != 0 || (logOptions.toFile && logOptions.szFile[0])))
+ if (!(logOptions.toOutputDebugString || GetSubscribersCount(hLogEvent) != 0 || (logOptions.toFile && logOptions.szFile[0])))
return;
if ((sent && !logOptions.dumpSent) || (!sent && !logOptions.dumpRecv))
return;
@@ -444,18 +397,18 @@ void NetlibDumpData(NetlibConnection *nlc, PBYTE buf, int len, int sent, int fla // check filter settings
if (nlu == NULL) {
- if ( !logOptions.toLog)
+ if (!logOptions.toLog)
return;
}
- else if ( !nlu->toLog)
+ else if (!nlu->toLog)
return;
bool isText = true;
- if ( !logOptions.textDumps)
+ if (!logOptions.textDumps)
isText = false;
- else if ( !(flags & MSG_DUMPASTEXT)) {
+ else if (!(flags & MSG_DUMPASTEXT)) {
if (logOptions.autoDetectText) {
- for (int i=0; i < len; i++) {
+ for (int i = 0; i < len; i++) {
if ((buf[i] < ' ' && buf[i] != '\t' && buf[i] != '\r' && buf[i] != '\n') || buf[i] >= 0x80) {
isText = false;
break;
@@ -477,7 +430,7 @@ void NetlibDumpData(NetlibConnection *nlc, PBYTE buf, int len, int sent, int fla // Binary data
else {
int line, col, colsInLine;
- int sz = titleLineLen + ((len+16)>>4) * 78 + 1;
+ int sz = titleLineLen + ((len + 16) >> 4) * 78 + 1;
useStack = sz <= 8192;
szBuf = (char*)(useStack ? alloca(sz) : mir_alloc(sz));
@@ -496,19 +449,19 @@ void NetlibDumpData(NetlibConnection *nlc, PBYTE buf, int len, int sent, int fla pszBuf += wsprintfA(pszBuf, "%08X: ", line); //!!!!!!!!!!
// Dump data as hex
for (col = 0; col < colsInLine; col++)
- pszBuf += wsprintfA(pszBuf, "%02X%c", buf[line + col], ((col&3) == 3 && col != 15)?'-':' '); //!!!!!!!!!!
+ pszBuf += wsprintfA(pszBuf, "%02X%c", buf[line + col], ((col & 3) == 3 && col != 15) ? '-' : ' '); //!!!!!!!!!!
// Fill out last line with blanks
- for (; col<16; col++) {
+ for (; col < 16; col++) {
lstrcpyA(pszBuf, " ");
pszBuf += 3;
}
- *pszBuf++=' ';
+ *pszBuf++ = ' ';
}
for (col = 0; col < colsInLine; col++)
- *pszBuf++ = (buf[line+col] < ' ') ? '.' : (char)buf[line+col];
+ *pszBuf++ = (buf[line + col] < ' ') ? '.' : (char)buf[line + col];
- if (len-line <= 16)
+ if (len - line <= 16)
break;
*pszBuf++ = '\r'; // End each line with a break
@@ -518,15 +471,13 @@ void NetlibDumpData(NetlibConnection *nlc, PBYTE buf, int len, int sent, int fla }
NetlibLog((WPARAM)nlu, (LPARAM)szBuf);
- if ( !useStack)
+ if (!useStack)
mir_free(szBuf);
}
void NetlibLogInit(void)
{
- DBVARIANT dbv;
LARGE_INTEGER li;
-
QueryPerformanceFrequency(&li);
perfCounterFreq = li.QuadPart;
QueryPerformanceCounter(&li);
@@ -549,7 +500,8 @@ void NetlibLogInit(void) logOptions.toFile = db_get_b(NULL, "Netlib", "ToFile", 0);
logOptions.toLog = db_get_dw(NULL, "Netlib", "NLlog", 1);
- if ( !db_get_ts(NULL, "Netlib", "File", &dbv)) {
+ DBVARIANT dbv;
+ if (!db_get_ts(NULL, "Netlib", "File", &dbv)) {
logOptions.szUserFile = mir_tstrdup(dbv.ptszVal);
TCHAR path[MAX_PATH];
@@ -568,12 +520,12 @@ void NetlibLogInit(void) if (db_get_b(NULL, "Netlib", "ShowLogOptsAtStart", 0))
NetlibLogShowOptions();
- if ( !db_get_ts(NULL, "Netlib", "RunAtStart", &dbv)) {
- STARTUPINFO si = { 0 };
- PROCESS_INFORMATION pi;
- si.cb = sizeof(si);
- if (dbv.ptszVal[0])
+ if (!db_get_ts(NULL, "Netlib", "RunAtStart", &dbv)) {
+ if (dbv.ptszVal[0]) {
+ STARTUPINFO si = { sizeof(si) };
+ PROCESS_INFORMATION pi;
CreateProcess(NULL, dbv.ptszVal, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+ }
db_free(&dbv);
}
}
diff --git a/src/resource.h b/src/resource.h index 131d866515..17c4e5654d 100644 --- a/src/resource.h +++ b/src/resource.h @@ -150,7 +150,6 @@ #define IDI_AUTH_GRANT 325
#define IDI_AUTH_REQUEST 326
#define IDI_AUTH_REVOKE 327
-#define IDC_SAVE 1001
#define IDI_ONTHEPHONE 1002
#define IDC_MESSAGE 1002
#define IDI_OUTTOLUNCH 1003
diff --git a/src/resource.rc b/src/resource.rc index 52e895917e..3939b3e43f 100644 --- a/src/resource.rc +++ b/src/resource.rc @@ -235,6 +235,7 @@ BEGIN CONTROL "Sent bytes",IDC_DUMPSENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,181,26,122,10
CONTROL "Additional data due to proxy communication",IDC_DUMPPROXY,
"Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,181,39,122,18
+ CONTROL "SSL traffic",IDC_DUMPSSL,"Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,181,56,122,10
CONTROL "Text dumps where available",IDC_TEXTDUMPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,181,69,122,10
CONTROL "Auto-detect text",IDC_AUTODETECTTEXT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,181,83,122,10
CONTROL "Calling modules' names",IDC_SHOWNAMES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,181,96,122,10
@@ -251,10 +252,8 @@ BEGIN PUSHBUTTON "Run now",IDC_RUNNOW,241,200,60,12
CONTROL "Show this dialog box when Miranda NG starts",IDC_SHOWTHISDLGATSTART,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,226,294,10
- PUSHBUTTON "Save as default",IDC_SAVE,6,241,79,14
- DEFPUSHBUTTON "OK",IDOK,173,241,54,14
- PUSHBUTTON "Cancel",IDCANCEL,249,241,54,14
- CONTROL "SSL traffic",IDC_DUMPSSL,"Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,181,56,122,10
+ DEFPUSHBUTTON "OK",IDOK,194,241,54,14
+ PUSHBUTTON "Cancel",IDCANCEL,254,241,54,14
END
IDD_OPT_SOUND DIALOGEX 0, 0, 285, 240
|