From cb4a46e7fbe62d788e66ed6121c717a2d22a4d7c Mon Sep 17 00:00:00 2001 From: watcherhd Date: Thu, 21 Apr 2011 14:14:52 +0000 Subject: svn.miranda.im is moving to a new home! git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@7 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb --- splashscreen/src/debug.h | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 splashscreen/src/debug.h (limited to 'splashscreen/src/debug.h') diff --git a/splashscreen/src/debug.h b/splashscreen/src/debug.h new file mode 100644 index 0000000..3e8ac38 --- /dev/null +++ b/splashscreen/src/debug.h @@ -0,0 +1,74 @@ +#ifndef __debug_h__ +#define __debug_h__ + +#include + +#define PlugName "SplashScreen" +extern char 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, const char *fmt, ...) +{ + POPUPDATA ppd; + va_list va; + char debug[1024]; + int ibsize = 1023; + + va_start(va, fmt); + _vsnprintf(debug, ibsize, 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) + strncpy(ppd.lpzContactName, (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,0), MAX_CONTACTNAME); + else + strncpy(ppd.lpzContactName, PlugName, MAX_CONTACTNAME); + strncat(ppd.lpzText, 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(fopen(szLogFile,"w")); + return 0; +} + +/* + * log timestamp + */ + +void inline logTimeStamp() +{ + FILE *f = fopen(szLogFile, "a"); + fprintf(f,"Time: %s\n", __TIME__); + fclose(f); +} + +/* + * logging func + */ + +void inline logMessage(const char *func, const char *msg) +{ + FILE *f = fopen(szLogFile, "a"); + fprintf(f,"%s:\t\t%s\n", func, msg); + fclose(f); +} + +#endif // __debug_h__ \ No newline at end of file -- cgit v1.2.3