diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2013-04-18 19:13:18 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2013-04-18 19:13:18 +0000 |
commit | f508be9159ff1612f1502a4ed2c6b5a585757cbf (patch) | |
tree | dc6aaac9be36d46c4aa059804c336d2fdc130898 /plugins/SeenPlugin | |
parent | 88b083394b91794dd060c0c568185ffcd497fa6b (diff) |
- removed obsolete code
- added %A variable to show the user's Account name
git-svn-id: http://svn.miranda-ng.org/main/trunk@4470 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SeenPlugin')
-rw-r--r-- | plugins/SeenPlugin/src/file.cpp | 31 | ||||
-rw-r--r-- | plugins/SeenPlugin/src/history.cpp | 2 | ||||
-rw-r--r-- | plugins/SeenPlugin/src/main.cpp | 4 | ||||
-rw-r--r-- | plugins/SeenPlugin/src/menu.cpp | 6 | ||||
-rw-r--r-- | plugins/SeenPlugin/src/missed.cpp | 4 | ||||
-rw-r--r-- | plugins/SeenPlugin/src/options.cpp | 21 | ||||
-rw-r--r-- | plugins/SeenPlugin/src/seen.h | 10 | ||||
-rw-r--r-- | plugins/SeenPlugin/src/utils.cpp | 70 |
8 files changed, 72 insertions, 76 deletions
diff --git a/plugins/SeenPlugin/src/file.cpp b/plugins/SeenPlugin/src/file.cpp index 2e78e8f5c6..8aea65614b 100644 --- a/plugins/SeenPlugin/src/file.cpp +++ b/plugins/SeenPlugin/src/file.cpp @@ -27,22 +27,26 @@ Prepares the log file: */
int InitFileOutput(void)
{
- TCHAR szfpath[256], szmpath[256];
+ TCHAR szfpath[MAX_PATH], szmpath[MAX_PATH];
GetModuleFileName(NULL, szmpath, MAX_PATH);
DBVARIANT dbv;
- _tcscpy(szfpath, !db_get_ts(NULL, S_MOD, "FileName", &dbv) ? dbv.ptszVal : _T(DEFAULT_FILENAME));
- db_free(&dbv);
+ if(!db_get_ts(NULL, S_MOD, "FileName", &dbv))
+ {
+ _tcsncpy(szfpath, dbv.ptszVal, MAX_PATH);
+ db_free(&dbv);
+ }
+ else _tcsncpy(szfpath, DEFAULT_FILENAME, MAX_PATH);
if (szfpath[0] == '\\')
- _tcscpy(szfpath, szfpath+1);
+ _tcsncpy(szfpath, szfpath+1, MAX_PATH);
TCHAR *str = _tcsrchr(szmpath, '\\');
if (str != NULL)
*++str=0;
- _tcscat(szmpath, szfpath);
- _tcscpy(szfpath, szmpath);
+ _tcsncat(szmpath, szfpath, MAX_PATH);
+ _tcsncpy(szfpath, szmpath, MAX_PATH);
str = _tcsrchr(szmpath, '\\');
if (str != NULL)
@@ -60,13 +64,17 @@ void FileWrite(HANDLE hcontact) TCHAR szout[1024];
DBVARIANT dbv;
- db_get_ts(NULL, S_MOD, "PathToFile", &dbv);
- _tcscpy(szout, ParseString(dbv.ptszVal, hcontact, 1));
+ if(!db_get_ts(NULL, S_MOD, "PathToFile", &dbv))
+ {
+ _tcsncpy(szout, ParseString(dbv.ptszVal, hcontact, 1), SIZEOF(szout));
+ db_free(&dbv);
+ }
+ else _tcsncpy(szout, DEFAULT_FILENAME, SIZEOF(szout));
HANDLE fhout = CreateFile(szout, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, 0, NULL);
if (fhout == INVALID_HANDLE_VALUE){
TCHAR fullpath[1024];
- _tcscpy(fullpath, szout);
+ _tcsncpy(fullpath, szout, SIZEOF(fullpath));
TCHAR *dirpath = _tcsrchr(fullpath, '\\');
if (dirpath != NULL)
*dirpath = '\0';
@@ -75,14 +83,13 @@ void FileWrite(HANDLE hcontact) if (fhout == INVALID_HANDLE_VALUE)
return;
}
- db_free(&dbv);
SetFilePointer(fhout,0,0,FILE_END);
if ( !db_get_ts(NULL, S_MOD,"FileStamp", &dbv)) {
- _tcscpy(szout, ParseString(dbv.ptszVal, hcontact, 1));
+ _tcsncpy(szout, ParseString(dbv.ptszVal, hcontact, 1), SIZEOF(szout));
db_free(&dbv);
}
- else _tcscpy(szout, ParseString( _T(DEFAULT_FILESTAMP), hcontact, 1));
+ else _tcsncpy(szout, ParseString(DEFAULT_FILESTAMP, hcontact, 1), SIZEOF(szout));
DWORD byteswritten;
WriteFile(fhout, _T2A(szout), (DWORD)_tcslen(szout), &byteswritten, NULL);
diff --git a/plugins/SeenPlugin/src/history.cpp b/plugins/SeenPlugin/src/history.cpp index 13d5b88277..b431531830 100644 --- a/plugins/SeenPlugin/src/history.cpp +++ b/plugins/SeenPlugin/src/history.cpp @@ -55,7 +55,7 @@ void HistoryWrite(HANDLE hContact) ptszString = ParseString(dbv.ptszVal, hContact, 0);
db_free(&dbv);
}
- else ptszString = ParseString( _T(DEFAULT_HISTORYSTAMP), hContact, 0);
+ else ptszString = ParseString(DEFAULT_HISTORYSTAMP, hContact, 0);
db_set_ts(hContact, S_MOD, BuildSetting(historyLast), ptszString);
historyLast = (historyLast+1) % historyMax;
diff --git a/plugins/SeenPlugin/src/main.cpp b/plugins/SeenPlugin/src/main.cpp index 98391ee155..824050a96e 100644 --- a/plugins/SeenPlugin/src/main.cpp +++ b/plugins/SeenPlugin/src/main.cpp @@ -49,7 +49,7 @@ DBVTranslation idleTr[TRANSNUMBER]={ BOOL includeIdle;
LIST<logthread_info> arContacts(16, LIST<logthread_info>::FTSortFunc(HandleKeySortT));
-int MainInit(WPARAM wparam,LPARAM lparam)
+int MainInit(WPARAM,LPARAM)
{
includeIdle = (BOOL )db_get_b(NULL,S_MOD,"IdleSupport",1);
HookEvent(ME_OPT_INITIALISE, OptionsInit);
@@ -103,7 +103,7 @@ extern "C" __declspec(dllexport) int Load(void) return 0;
}
-extern "C" __declspec(dllexport) PLUGININFOEX * MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX * MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
diff --git a/plugins/SeenPlugin/src/menu.cpp b/plugins/SeenPlugin/src/menu.cpp index 7c0e2222db..6056971494 100644 --- a/plugins/SeenPlugin/src/menu.cpp +++ b/plugins/SeenPlugin/src/menu.cpp @@ -28,13 +28,13 @@ void InitHistoryDialog(void); /*
Handles the messages sent by clicking the contact's menu item
*/
-INT_PTR MenuitemClicked(WPARAM wparam,LPARAM lparam)
+INT_PTR MenuitemClicked(WPARAM wparam,LPARAM)
{
ShowHistory((HANDLE)wparam, 0);
return 0;
}
-int BuildContactMenu(WPARAM wparam,LPARAM lparam)
+int BuildContactMenu(WPARAM wparam,LPARAM)
{
int id = -1, isetting;
HANDLE hContact = (HANDLE)wparam;
@@ -52,7 +52,7 @@ int BuildContactMenu(WPARAM wparam,LPARAM lparam) cmi.ptszName = ParseString(dbv.ptszVal, (HANDLE)wparam, 0);
db_free(&dbv);
}
- else cmi.ptszName = ParseString( _T(DEFAULT_MENUSTAMP), (HANDLE)wparam, 0);
+ else cmi.ptszName = ParseString(DEFAULT_MENUSTAMP, (HANDLE)wparam, 0);
if ( !_tcscmp(cmi.ptszName, TranslateT("<unknown>"))) {
if ( IsWatchedProtocol(szProto))
diff --git a/plugins/SeenPlugin/src/missed.cpp b/plugins/SeenPlugin/src/missed.cpp index 4b7d4bcf44..2ff6abf00c 100644 --- a/plugins/SeenPlugin/src/missed.cpp +++ b/plugins/SeenPlugin/src/missed.cpp @@ -107,7 +107,7 @@ int ShowMissed(void) TCHAR sztemp[1024], szcount[7];
for (int loop=0; loop < mcs.count; loop++) {
- _tcscat(sztemp, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, mcs.wpcontact[loop], GCDNF_TCHAR));
+ _tcsncat(sztemp, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, mcs.wpcontact[loop], GCDNF_TCHAR), SIZEOF(sztemp));
if ( db_get_b(NULL, S_MOD, "MissedOnes_Count", 0)) {
wsprintf(szcount, _T(" [%i]"), mcs.times[loop]);
_tcscat(sztemp, szcount);
@@ -159,7 +159,7 @@ int Test(WPARAM wparam,LPARAM lparam) return 0;
}
-int ModeChange_mo(WPARAM wparam,LPARAM lparam)
+int ModeChange_mo(WPARAM,LPARAM lparam)
{
ACKDATA *ack = (ACKDATA *)lparam;
if (ack->type != ACKTYPE_STATUS || ack->result != ACKRESULT_SUCCESS || ack->hContact != NULL)
diff --git a/plugins/SeenPlugin/src/options.cpp b/plugins/SeenPlugin/src/options.cpp index 6fa34e2a1b..3b672ad2e4 100644 --- a/plugins/SeenPlugin/src/options.cpp +++ b/plugins/SeenPlugin/src/options.cpp @@ -203,7 +203,7 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa SetDlgItemText(hdlg, IDC_MENUSTAMP, dbv.ptszVal);
db_free(&dbv);
}
- else SetDlgItemText(hdlg, IDC_MENUSTAMP, _T(DEFAULT_MENUSTAMP));
+ else SetDlgItemText(hdlg, IDC_MENUSTAMP, DEFAULT_MENUSTAMP);
if ( !db_get_ts(NULL, S_MOD, "UserStamp", &dbv)) {
SetDlgItemText(hdlg, IDC_USERSTAMP, dbv.ptszVal);
@@ -215,19 +215,19 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa SetDlgItemText(hdlg, IDC_FILESTAMP, dbv.ptszVal);
db_free(&dbv);
}
- else SetDlgItemText(hdlg, IDC_FILESTAMP, _T(DEFAULT_FILESTAMP));
+ else SetDlgItemText(hdlg, IDC_FILESTAMP, DEFAULT_FILESTAMP);
if ( !db_get_ts(NULL, S_MOD, "FileName", &dbv)) {
SetDlgItemText(hdlg, IDC_FILENAME, dbv.ptszVal);
db_free(&dbv);
}
- else SetDlgItemText(hdlg, IDC_FILENAME, _T(DEFAULT_FILENAME));
+ else SetDlgItemText(hdlg, IDC_FILENAME, DEFAULT_FILENAME);
if ( !db_get_ts(NULL, S_MOD, "HistoryStamp", &dbv)) {
SetDlgItemText(hdlg, IDC_HISTORYSTAMP, dbv.ptszVal);
db_free(&dbv);
}
- else SetDlgItemText(hdlg, IDC_HISTORYSTAMP, _T(DEFAULT_HISTORYSTAMP));
+ else SetDlgItemText(hdlg, IDC_HISTORYSTAMP, DEFAULT_HISTORYSTAMP);
SetDlgItemInt(hdlg, IDC_HISTORYSIZE,db_get_w(NULL,S_MOD,"HistoryMax",10-1)-1,FALSE);
@@ -287,7 +287,7 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa if (LOWORD(wparam) == IDC_VARIABLES) {
char szout[2048];
wsprintfA(szout,VARIABLE_LIST);
- MessageBoxA(NULL,szout,Translate("Last Seen Variables"),MB_OK|MB_TOPMOST);
+ MessageBoxA(hdlg,szout,Translate("Last Seen Variables"),MB_OK|MB_TOPMOST);
}
break; //case WM_COMMAND
@@ -367,15 +367,14 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa // save protocol list
HWND hwndTreeView = GetDlgItem(hdlg, IDC_PROTOCOLLIST);
- HTREEITEM hItem;
- TVITEM tvItem;
- char *watchedProtocols;
char *protocol;
int size=1;
- watchedProtocols = (char *)malloc(sizeof(char));
+ char *watchedProtocols = (char *)malloc(sizeof(char));
*watchedProtocols = '\0';
- hItem = TreeView_GetRoot(hwndTreeView);
+ HTREEITEM hItem = TreeView_GetRoot(hwndTreeView);
+
+ TVITEM tvItem;
tvItem.mask = TVIF_HANDLE | TVIF_STATE | TVIF_PARAM;
tvItem.stateMask = TVIS_STATEIMAGEMASK;
@@ -436,7 +435,7 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpa return 0;
}
-int OptionsInit(WPARAM wparam,LPARAM lparam)
+int OptionsInit(WPARAM wparam,LPARAM)
{
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.position = 100000000;
diff --git a/plugins/SeenPlugin/src/seen.h b/plugins/SeenPlugin/src/seen.h index 0fb4921070..34d70efe26 100644 --- a/plugins/SeenPlugin/src/seen.h +++ b/plugins/SeenPlugin/src/seen.h @@ -76,16 +76,16 @@ WCHAR *any_to_Idle(HANDLE hContact, const char *module_name, const char *setting #define ICON_FREE 19
#define ICON_INVIS 20
-#define DEFAULT_MENUSTAMP "%d.%m.%Y - %H:%M [%s]"
+#define DEFAULT_MENUSTAMP _T("%d.%m.%Y - %H:%M [%s]")
#define DEFAULT_POPUPSTAMP TranslateT("%n is %s (%u)")
#define DEFAULT_POPUPSTAMPTEXT TranslateT("%i(%r)%bWas %o")
#define DEFAULT_USERSTAMP TranslateT("Name:%t%N%bStatus:%t%s%bDay:%t%d.%m.%Y%bTime:%t%H:%M:%S%bPrevious Status:%t%o%b%b%P ID:%t%u%bExternal IP:%t%i%bInternal IP:%t%r%bClientID: %t%C%b%bStatus Message:%t%T")
-#define DEFAULT_FILESTAMP "%d.%m.%Y %H:%M:%S%t%n%t%s%t%u%t%r | %i%t%N"
-#define DEFAULT_FILENAME "logs\\%P.txt"
-#define DEFAULT_HISTORYSTAMP "%d.%m.%Y - %H:%M [%s]"
+#define DEFAULT_FILESTAMP _T("%d.%m.%Y %H:%M:%S%t%n%t%s%t%u%t%r | %i%t%N")
+#define DEFAULT_FILENAME _T("logs\\%P.txt")
+#define DEFAULT_HISTORYSTAMP _T("%d.%m.%Y - %H:%M [%s]")
#define DEFAULT_WATCHEDPROTOCOLS ""
-#define VARIABLE_LIST "%s \n%%Y: \t %s \n%%y: \t %s \n%%m: \t %s \n%%E: \t %s \n%%e: \t %s \n%%d: \t %s \n%%W: \t %s \n%%w: \t %s \n\n%s \n%%H: \t %s \n%%h: \t %s \n%%p: \t %s \n%%M: \t %s \n%%S: \t %s \n\n%s \n%%n: \t %s \n%%N: \t %s \n%%u: \t %s \n%%G: \t %s \n%%s: \t %s \n%%T: \t %s \n%%o: \t %s \n%%i: \t %s \n%%r: \t %s \n%%C: \t %s \n%%P: \t %s \n\n%s \n%%t: \t %s \n%%b: \t %s\n\n%s\t%s \"#\" %s\n\t%s %s", Translate("-- Date --"), Translate("year (4 digits)"), Translate("year (2 digits)"), Translate("month"), Translate("name of month"), Translate("short name of month"), Translate("day"), Translate("weekday (full)"), Translate("weekday (abbreviated)"), Translate("-- Time --"), Translate("hours (24)"), Translate("hours (12)"), Translate("AM/PM"), Translate("minutes"), Translate("seconds"), Translate("-- User --"), Translate("username"), Translate("nick"), Translate("UIN/handle"), Translate("Group"), Translate("Status"), Translate("Status message"), Translate("Old status"), Translate("external IP"), Translate("internal IP"),Translate("Client info"),Translate("Protocol"), Translate("-- Format --"), Translate("tabulator"), Translate("line break"), Translate("Note:"),Translate("Use"),Translate("for empty string"),Translate("instead of"),Translate("<unknown>")
+#define VARIABLE_LIST "%s \n%%Y: \t %s \n%%y: \t %s \n%%m: \t %s \n%%E: \t %s \n%%e: \t %s \n%%d: \t %s \n%%W: \t %s \n%%w: \t %s \n\n%s \n%%H: \t %s \n%%h: \t %s \n%%p: \t %s \n%%M: \t %s \n%%S: \t %s \n\n%s \n%%n: \t %s \n%%N: \t %s \n%%u: \t %s \n%%G: \t %s \n%%s: \t %s \n%%T: \t %s \n%%o: \t %s \n%%i: \t %s \n%%r: \t %s \n%%C: \t %s \n%%P: \t %s \n%%A:\t %s\n\n%s \n%%t: \t %s \n%%b: \t %s\n\n%s\t%s \"#\" %s\n\t%s %s", Translate("-- Date --"), Translate("year (4 digits)"), Translate("year (2 digits)"), Translate("month"), Translate("name of month"), Translate("short name of month"), Translate("day"), Translate("weekday (full)"), Translate("weekday (abbreviated)"), Translate("-- Time --"), Translate("hours (24)"), Translate("hours (12)"), Translate("AM/PM"), Translate("minutes"), Translate("seconds"), Translate("-- User --"), Translate("username"), Translate("nick"), Translate("UIN/handle"), Translate("Group"), Translate("Status"), Translate("Status message"), Translate("Old status"), Translate("external IP"), Translate("internal IP"),Translate("Client info"),Translate("Protocol"), Translate("Account"),Translate("-- Format --"), Translate("tabulator"), Translate("line break"), Translate("Note:"),Translate("Use"),Translate("for empty string"),Translate("instead of"),Translate("<unknown>")
typedef struct{
int count;
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index 22f41290f9..e9b06d92d4 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -262,7 +262,7 @@ LBL_charPtr: case 'G':
if ( !db_get_ts(hcontact, "CList", "Group", &dbv)) {
- _tcscpy(szdbsetting, dbv.ptszVal);
+ _tcsncpy(szdbsetting, dbv.ptszVal, SIZEOF(szdbsetting));
db_free(&dbv);
charPtr = szdbsetting;
goto LBL_charPtr;
@@ -283,40 +283,20 @@ LBL_charPtr: _ltot(ci.dVal, szdbsetting, 10);
break;
case CNFT_ASCIIZ:
- _tcscpy(szdbsetting, ci.pszVal);
+ _tcsncpy(szdbsetting, ci.pszVal, SIZEOF(szdbsetting));
break;
}
}
- else if (ci.szProto != NULL) {
- if ( isYahoo(ci.szProto)) { // YAHOO support
- db_get_ts(hcontact, ci.szProto, "id", &dbv);
- _tcscpy(szdbsetting, dbv.ptszVal);
- db_free(&dbv);
- }
- else if ( isJabber(ci.szProto)) { // JABBER support
- if ( db_get_ts(hcontact, ci.szProto, "LoginName", &dbv))
- goto LBL_noData;
-
- _tcscpy(szdbsetting, dbv.ptszVal);
- db_free(&dbv);
-
- db_get_ts(hcontact, ci.szProto, "LoginServer", &dbv);
- _tcscat(szdbsetting, _T("@"));
- _tcscat(szdbsetting, dbv.ptszVal);
- db_free(&dbv);
- }
- else goto LBL_noData;
- }
else goto LBL_noData;
charPtr = szdbsetting;
goto LBL_charPtr;
case 's':
if (isetting = db_get_w(hcontact,S_MOD,hcontact ? "StatusTriger" : courProtoName, 0)) {
- _tcscpy(szdbsetting, TranslateTS((TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)(isetting|0x8000), GSMDF_TCHAR)));
+ _tcsncpy(szdbsetting, (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)(isetting|0x8000), GSMDF_TCHAR), SIZEOF(szdbsetting));
if ( !(isetting & 0x8000)) {
- _tcscat(szdbsetting, _T("/"));
- _tcscat(szdbsetting, TranslateT("Idle"));
+ _tcsncat(szdbsetting, _T("/"), SIZEOF(szdbsetting));
+ _tcsncat(szdbsetting, TranslateT("Idle"), SIZEOF(szdbsetting));
}
charPtr = szdbsetting;
goto LBL_charPtr;
@@ -333,10 +313,10 @@ LBL_charPtr: case 'o':
if (isetting = db_get_w(hcontact, S_MOD, hcontact ? "OldStatus" : courProtoName, 0)) {
- _tcscpy(szdbsetting, TranslateTS((TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)isetting, GSMDF_TCHAR)));
- if (includeIdle) if (hcontact) if ( db_get_b(hcontact, S_MOD, "OldIdle", 0)) {
- _tcscat(szdbsetting, _T("/"));
- _tcscat(szdbsetting, TranslateT("Idle"));
+ _tcsncpy(szdbsetting, (TCHAR*) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)isetting, GSMDF_TCHAR), SIZEOF(szdbsetting));
+ if (includeIdle && hcontact && db_get_b(hcontact, S_MOD, "OldIdle", 0)) {
+ _tcsncat(szdbsetting, _T("/"), SIZEOF(szdbsetting));
+ _tcsncat(szdbsetting, TranslateT("Idle"), SIZEOF(szdbsetting));
}
charPtr = szdbsetting;
goto LBL_charPtr;
@@ -349,7 +329,7 @@ LBL_charPtr: if ( db_get_ts(hcontact, ci.szProto, *p == 'i' ? "Resource" : "System", &dbv))
goto LBL_noData;
- _tcscpy(szdbsetting, dbv.ptszVal);
+ _tcsncpy(szdbsetting, dbv.ptszVal, SIZEOF(szdbsetting));
db_free(&dbv);
charPtr = szdbsetting;
}
@@ -359,13 +339,13 @@ LBL_charPtr: goto LBL_noData;
ia.S_un.S_addr = htonl(dwsetting);
- _tcscpy(szdbsetting, _A2T( inet_ntoa(ia)));
+ _tcsncpy(szdbsetting, _A2T( inet_ntoa(ia)), SIZEOF(szdbsetting));
charPtr = szdbsetting;
}
goto LBL_charPtr;
case 'P':
- _tcscpy(szdbsetting, ci.szProto ? _A2T(ci.szProto) : (wantempty ? _T("") : _T("ProtoUnknown")));
+ _tcsncpy(szdbsetting, ci.szProto ? _A2T(ci.szProto) : (wantempty ? _T("") : _T("ProtoUnknown")), SIZEOF(szdbsetting));
charPtr = szdbsetting;
goto LBL_charPtr;
@@ -375,7 +355,7 @@ LBL_charPtr: case 'C': // Get Client Info
if ( !db_get_ts(hcontact, ci.szProto, "MirVer", &dbv)) {
- _tcscpy(szdbsetting, dbv.ptszVal);
+ _tcsncpy(szdbsetting, dbv.ptszVal, SIZEOF(szdbsetting));
db_free(&dbv);
}
else goto LBL_noData;
@@ -386,6 +366,16 @@ LBL_charPtr: charPtr = _T("\t");
goto LBL_charPtr;
+ case 'A':
+ {
+ PROTOACCOUNT *pa = ProtoGetAccount(ci.szProto);
+ if(!pa) goto LBL_noData;
+ _tcsncpy(szdbsetting, pa->tszAccountName, SIZEOF(szdbsetting));
+ charPtr = szdbsetting;
+ goto LBL_charPtr;
+ }
+
+
default:
*d++ = p[-1];
*d++ = *p;
@@ -398,13 +388,13 @@ LBL_charPtr: void _DBWriteTime(SYSTEMTIME *st,HANDLE hcontact)
{
- db_set_w((HANDLE)hcontact,S_MOD,"Day",st->wDay);
- db_set_w((HANDLE)hcontact,S_MOD,"Month",st->wMonth);
- db_set_w((HANDLE)hcontact,S_MOD,"Year",st->wYear);
- db_set_w((HANDLE)hcontact,S_MOD,"Hours",st->wHour);
- db_set_w((HANDLE)hcontact,S_MOD,"Minutes",st->wMinute);
- db_set_w((HANDLE)hcontact,S_MOD,"Seconds",st->wSecond);
- db_set_w((HANDLE)hcontact,S_MOD,"WeekDay",st->wDayOfWeek);
+ db_set_w(hcontact,S_MOD,"Day",st->wDay);
+ db_set_w(hcontact,S_MOD,"Month",st->wMonth);
+ db_set_w(hcontact,S_MOD,"Year",st->wYear);
+ db_set_w(hcontact,S_MOD,"Hours",st->wHour);
+ db_set_w(hcontact,S_MOD,"Minutes",st->wMinute);
+ db_set_w(hcontact,S_MOD,"Seconds",st->wSecond);
+ db_set_w(hcontact,S_MOD,"WeekDay",st->wDayOfWeek);
}
|