Fri, 20 Jan 2006 00:19:53 +0000
[gaim-migrate @ 15309]
Add .cvsignore actions to meanwhile so cvs shuts up about it.
| 12956 | 1 | |
| 2 | /* | |
| 3 | Meanwhile - Unofficial Lotus Sametime Community Client Library | |
| 4 | Copyright (C) 2004 Christopher (siege) O'Brien | |
| 5 | ||
| 6 | This library is free software; you can redistribute it and/or | |
| 7 | modify it under the terms of the GNU Library General Public | |
| 8 | License as published by the Free Software Foundation; either | |
| 9 | version 2 of the License, or (at your option) any later version. | |
| 10 | ||
| 11 | This library is distributed in the hope that it will be useful, | |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 | Library General Public License for more details. | |
| 15 | ||
| 16 | You should have received a copy of the GNU Library General Public | |
| 17 | License along with this library; if not, write to the Free | |
| 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 19 | */ | |
| 20 | ||
| 21 | #ifndef _MW_DEBUG_H | |
| 22 | #define _MW_DEBUG_H | |
| 23 | ||
| 24 | ||
| 25 | #include <stdarg.h> | |
| 26 | #include <glib.h> | |
| 27 | ||
| 28 | #include "mw_common.h" | |
| 29 | ||
| 30 | ||
| 31 | /** replaces NULL strings with "(null)". useful for printf where | |
| 32 | you're unsure that the %s will be non-NULL. Note that while the | |
| 33 | linux printf will do this automatically, not all will. The others | |
| 34 | will instead segfault */ | |
| 35 | #define NSTR(str) ((str)? (str): "(null)") | |
| 36 | ||
| 37 | ||
| 38 | #ifndef g_debug | |
| 39 | #define g_debug(format...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format) | |
| 40 | #endif | |
| 41 | ||
| 42 | ||
| 43 | #ifndef g_info | |
| 44 | #define g_info(format...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format) | |
| 45 | #endif | |
| 46 | ||
| 47 | ||
| 48 | #ifndef MW_MAILME_ADDRESS | |
| 49 | /** email address used in mw_debug_mailme. */ | |
| 50 | #define MW_MAILME_ADDRESS "meanwhile-devel@lists.sourceforge.net" | |
| 51 | #endif | |
| 52 | ||
| 53 | ||
| 54 | #ifndef MW_MAILME_CUT_START | |
| 55 | #define MW_MAILME_CUT_START "-------- begin copy --------" | |
| 56 | #endif | |
| 57 | ||
| 58 | ||
| 59 | #ifndef MW_MAILME_CUT_STOP | |
| 60 | #define MW_MAILME_CUT_STOP "--------- end copy ---------" | |
| 61 | #endif | |
| 62 | ||
| 63 | ||
| 64 | #ifndef MW_MAILME_MESSAGE | |
| 65 | /** message used in mw_debug_mailme instructing user on what to do | |
| 66 | with the debugging output produced from that function */ | |
| 67 | #define MW_MAILME_MESSAGE "\n" \ | |
| 68 | " Greetings! It seems that you've run across protocol data that the\n" \ | |
| 69 | "Meanwhile library does not yet know about. As such, there may be\n" \ | |
| 70 | "some unexpected behaviour in this session. If you'd like to help\n" \ | |
| 71 | "resolve this issue, please copy and paste the following block into\n" \ | |
| 72 | "an email to the address listed below with a brief explanation of\n" \ | |
| 73 | "what you were doing at the time of this message. Thanks a lot!" | |
| 74 | #endif | |
| 75 | ||
| 76 | ||
| 77 | void mw_debug_datav(const guchar *buf, gsize len, | |
| 78 | const char *info, va_list args); | |
| 79 | ||
| 80 | ||
| 81 | void mw_debug_data(const guchar *buf, gsize len, | |
| 82 | const char *info, ...); | |
| 83 | ||
| 84 | ||
| 85 | void mw_debug_opaquev(struct mwOpaque *o, const char *info, va_list args); | |
| 86 | ||
| 87 | ||
| 88 | void mw_debug_opaque(struct mwOpaque *o, const char *info, ...); | |
| 89 | ||
| 90 | ||
| 91 | void mw_mailme_datav(const guchar *buf, gsize len, | |
| 92 | const char *info, va_list args); | |
| 93 | ||
| 94 | void mw_mailme_data(const guchar *buf, gsize len, | |
| 95 | const char *info, ...); | |
| 96 | ||
| 97 | ||
| 98 | /** Outputs a hex dump of a mwOpaque with debugging info and a | |
| 99 | pre-defined message. Identical to mw_mailme_opaque, but taking a | |
| 100 | va_list argument */ | |
| 101 | void mw_mailme_opaquev(struct mwOpaque *o, const char *info, va_list args); | |
| 102 | ||
| 103 | ||
| 104 | ||
| 105 | /** Outputs a hex dump of a mwOpaque with debugging info and a | |
| 106 | pre-defined message. | |
| 107 | ||
| 108 | if MW_MAILME is undefined or false, this function acts the same as | |
| 109 | mw_mailme_opaque. | |
| 110 | ||
| 111 | @arg block data to be printed in a hex block | |
| 112 | @arg info a printf-style format string | |
| 113 | ||
| 114 | The resulting message is in the following format: | |
| 115 | @code | |
| 116 | MW_MAILME_MESSAGE | |
| 117 | " Please send mail to: " MW_MAILME_ADDRESS | |
| 118 | MW_MAILME_CUT_START | |
| 119 | info | |
| 120 | block | |
| 121 | MW_MAILME_CUT_STOP | |
| 122 | @endcode | |
| 123 | */ | |
| 124 | void mw_mailme_opaque(struct mwOpaque *o, const char *info, ...); | |
| 125 | ||
| 126 | ||
| 127 | #endif | |
| 128 |