diff options
author | mataes2007 <mataes2007@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb> | 2011-11-26 15:41:10 +0000 |
---|---|---|
committer | mataes2007 <mataes2007@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb> | 2011-11-26 15:41:10 +0000 |
commit | f04d64869f3b1de54fb343f28f955584780001b8 (patch) | |
tree | 5453dc10de3d980de79ffe019fa0b5fcb692a27d /SplashScreen/src/debug.h | |
parent | 7aff1e4cb053394db57c2814d5fe1e6493e0cc75 (diff) |
Project folders rename part 3
git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@215 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb
Diffstat (limited to 'SplashScreen/src/debug.h')
-rw-r--r-- | SplashScreen/src/debug.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/SplashScreen/src/debug.h b/SplashScreen/src/debug.h new file mode 100644 index 0000000..70c44e2 --- /dev/null +++ b/SplashScreen/src/debug.h @@ -0,0 +1,72 @@ +#ifndef __debug_h__
+#define __debug_h__
+
+#define PlugName "SplashScreen"
+extern TCHAR szLogFile[MAX_PATH];
+
+/*
+ * output a notification message.
+ * may accept a hContact to include the contacts nickname in the notification message...
+ * the actual message is using printf() rules for formatting and passing the arguments...
+ *
+ */
+
+int inline _DebugPopup(HANDLE hContact, TCHAR *fmt, ...)
+{
+ POPUPDATAT ppd;
+ va_list va;
+ TCHAR debug[1024];
+
+ va_start(va, fmt);
+ mir_sntprintf(debug, SIZEOF(debug), fmt, va);
+
+ if(CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0) == 1)
+ {
+ ZeroMemory((void *)&ppd, sizeof(ppd));
+ ppd.lchContact = hContact;
+ ppd.lchIcon = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA);
+ if(hContact != 0)
+ _tcsncpy_s(ppd.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR), MAX_CONTACTNAME);
+ else
+ _tcsncpy_s(ppd.lptzContactName, _T(PlugName), MAX_CONTACTNAME);
+ _tcsncpy_s(ppd.lptzText, debug, MAX_SECONDLINE - 20);
+ ppd.colorText = RGB(255,255,255);
+ ppd.colorBack = RGB(255,0,0);
+ CallService(MS_POPUP_ADDPOPUP, (WPARAM)&ppd, 0);
+ }
+ return 0;
+}
+
+/*
+ * initialize logfile
+ */
+
+int inline initLog()
+{
+ fclose(_tfopen(szLogFile, _T("w")));
+ return 0;
+}
+
+/*
+ * log timestamp
+ */
+
+void inline logTimeStamp()
+{
+ FILE *f = _tfopen(szLogFile, _T("a"));
+ _ftprintf(f, _T("Time:\t\t\t\t%s\n"), _T(__TIME__));
+ fclose(f);
+}
+
+/*
+ * logging func
+ */
+
+void inline logMessage(TCHAR *func, TCHAR *msg)
+{
+ FILE *f = _tfopen(szLogFile, _T("a"));
+ _ftprintf(f, _T("%s:\t\t%s\n"), func, msg);
+ fclose(f);
+}
+
+#endif // __debug_h__
\ No newline at end of file |