本文整理汇总了C++中purple_debug函数的典型用法代码示例。如果您正苦于以下问题:C++ purple_debug函数的具体用法?C++ purple_debug怎么用?C++ purple_debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了purple_debug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: purple_account_get_string
static char *irc_send_convert(struct irc_conn *irc, const char *string)
{
char *utf8;
GError *err = NULL;
gchar **encodings;
const gchar *enclist;
enclist = purple_account_get_string(irc->account, "encoding", IRC_DEFAULT_CHARSET);
encodings = g_strsplit(enclist, ",", 2);
if (encodings[0] == NULL || !g_ascii_strcasecmp("UTF-8", encodings[0])) {
g_strfreev(encodings);
return NULL;
}
utf8 = g_convert(string, strlen(string), encodings[0], "UTF-8", NULL, NULL, &err);
if (err) {
purple_debug(PURPLE_DEBUG_ERROR, "irc", "Send conversion error: %s\n", err->message);
purple_debug(PURPLE_DEBUG_ERROR, "irc", "Sending as UTF-8 instead of %s\n", encodings[0]);
utf8 = g_strdup(string);
g_error_free(err);
}
g_strfreev(encodings);
return utf8;
}
示例2: purple_account_get_string
static char *gaym_send_convert(struct gaym_conn *gaym, const char *string)
{
char *utf8;
GError *err = NULL;
const gchar *charset;
charset =
purple_account_get_string(gaym->account, "encoding",
IRC_DEFAULT_CHARSET);
if (!strcasecmp("UTF-8", charset))
return g_strdup(string);
utf8 =
g_convert(string, strlen(string), charset, "UTF-8", NULL, NULL,
&err);
if (err) {
purple_debug(PURPLE_DEBUG_ERROR, "gaym", "Send conversion error: %s\n",
err->message);
purple_debug(PURPLE_DEBUG_ERROR, "gaym",
"Sending as UTF-8 instead of %s\n", charset);
utf8 = g_strdup(string);
g_error_free(err);
}
return utf8;
}
示例3: qq_process_request_login_token_reply
void qq_process_request_login_token_reply(guint8 *buf, gint buf_len, PurpleConnection *gc)
{
qq_data *qd;
gchar *hex_dump;
g_return_if_fail(buf != NULL && buf_len != 0);
qd = (qq_data *) gc->proto_data;
if (buf[0] == QQ_REQUEST_LOGIN_TOKEN_REPLY_OK) {
if (buf[1] != buf_len-2) {
purple_debug(PURPLE_DEBUG_INFO, "QQ",
"Malformed login token reply packet. Packet specifies length of %d, actual length is %d\n", buf[1], buf_len-2);
purple_debug(PURPLE_DEBUG_INFO, "QQ",
"Attempting to proceed with the actual packet length.\n");
}
hex_dump = hex_dump_to_str(buf+2, buf_len-2);
purple_debug(PURPLE_DEBUG_INFO, "QQ",
"<<< got a token with %d bytes -> [default] decrypt and dump\n%s", buf_len-2, hex_dump);
qq_send_packet_login(gc, buf_len-2, buf+2);
} else {
purple_debug(PURPLE_DEBUG_ERROR, "QQ", "Unknown request login token reply code : %d\n", buf[0]);
hex_dump = hex_dump_to_str(buf, buf_len);
purple_debug(PURPLE_DEBUG_WARNING, "QQ",
">>> %d bytes -> [default] decrypt and dump\n%s",
buf_len, hex_dump);
try_dump_as_gbk(buf, buf_len);
purple_connection_error(gc, _("Error requesting login token"));
}
g_free(hex_dump);
}
示例4: gfire_read_attrib
GList *gfire_read_buddy_status(PurpleConnection *gc, int packet_len)
{
int index = XFIRE_HEADER_LEN + 1;
int itmp = 0;
GList *btmp = NULL;
gfire_buddy *gf_buddy = NULL;
GList *ret = NULL;
GList *sids = NULL;
GList *msgs = NULL;
GList *s, *m;
gfire_data *gfire = (gfire_data *)gc->proto_data;
itmp = gfire_read_attrib(&sids, gfire->buff_in + index, packet_len - index, "sid", FALSE, TRUE, 0, 0,
XFIRE_SID_LEN);
if (itmp < 1 ) {
//FIXME add mem cleanup code
FIXME("gfire_read_attrib returned < 1! sids");
return NULL;
}
index += itmp + 1;
itmp = gfire_read_attrib(&msgs, gfire->buff_in + index, packet_len - index, "msg", TRUE, FALSE, 0, 0, 0);
if (itmp < 1 ) {
//FIXME add mem cleanup code
FIXME("gfire_read_attrib returned < 1! msgs");
return NULL;
}
msgs = g_list_first(msgs); sids = g_list_first(sids);
m = msgs; s = sids;
while ( NULL != s ){
btmp = gfire_find_buddy_in_list(gfire->buddies, s->data, GFFB_SIDBIN);
if (NULL == btmp) {
purple_debug(PURPLE_DEBUG_MISC, "gfire", "WARN: pkt 154: (away status) could not find sid in buddy list.\n");
} else {
gf_buddy = (gfire_buddy *)btmp->data;
if (NULL != m->data) {
/* got an away message */
gf_buddy->away = TRUE;
gf_buddy->away_msg = m->data;
} else {
/* no message, user is back */
gf_buddy->away = FALSE;
if (NULL != gf_buddy->away_msg) g_free(gf_buddy->away_msg);
gf_buddy->away_msg = NULL;
}
ret = g_list_append(ret, (gpointer *)gf_buddy);
purple_debug(PURPLE_DEBUG_MISC, "gfire","(away): %s, is away/back with msg %s\n",
NN(gf_buddy->name), NN(gf_buddy->away_msg));
}
g_free(s->data);
s->data = NULL;
s = g_list_next(s); m = g_list_next(m);
}
g_list_free(msgs);
g_list_free(sids);
return ret;
}
示例5: gfire_game_load_config_xml
gboolean gfire_game_load_config_xml(gboolean p_force)
{
if(!p_force && gfire_games_config)
return TRUE;
xmlnode *node = NULL;
gchar *filename = g_build_filename(purple_user_dir(), "gfire_game_config.xml", NULL);
if(filename)
{
purple_debug(PURPLE_DEBUG_INFO, "gfire", "Loading Game Launch Data from: %s\n", filename);
g_free(filename);
}
node = purple_util_read_xml_from_file("gfire_game_config.xml", "Gfire Game Config List");
if(!node)
{
purple_debug(PURPLE_DEBUG_ERROR, "gfire", "gfire_game_load_config_xml: Couldn't load game config.\n");
return FALSE;
}
// Check for a valid game config
if(g_utf8_collate(node->name, "game_config"))
{
xmlnode_free(node);
return FALSE;
}
// Check for a valid version
if(!xmlnode_get_attrib(node, "version") || g_utf8_collate(xmlnode_get_attrib(node, "version"), "2"))
{
xmlnode_free(node);
return FALSE;
}
// Delete all old configurations
gfire_game_config_cleanup();
// Parse all games
xmlnode *game_node = xmlnode_get_child(node, "game");
while(game_node)
{
gfire_game_configuration *gconf = gfire_game_configuration_create_from_xml(game_node);
if(gconf)
gfire_games_config = g_list_append(gfire_games_config, gconf);
game_node = xmlnode_get_next_twin(game_node);
}
gfire_game_config_sort();
xmlnode_free(node);
return TRUE;
}
示例6: gfire_game_load_games_xml
gboolean gfire_game_load_games_xml()
{
xmlnode *node = NULL;
gchar *filename = g_build_filename(purple_user_dir(), "gfire_games.xml", NULL);
if(filename)
{
purple_debug(PURPLE_DEBUG_INFO, "gfire", "Loading Game Data from: %s\n", filename);
g_free(filename);
}
node = purple_util_read_xml_from_file("gfire_games.xml", "Gfire Games List");
if(!node)
{
purple_debug(PURPLE_DEBUG_ERROR, "gfire", "gfire_game_load_games_xml: Couldn't load game list.\n");
return FALSE;
}
// Delete all old games
gfire_game_cleanup();
// Read the games version
if(g_utf8_collate(node->name, "games"))
{
xmlnode_free(node);
return FALSE;
}
if(!xmlnode_get_attrib(node, "version"))
gfire_games_version = 0;
else
sscanf(xmlnode_get_attrib(node, "version"), "%u", &gfire_games_version);
// Read all games
xmlnode *game_node = xmlnode_get_child(node, "game");
while(game_node)
{
gboolean external = FALSE;
gfire_game *game = gfire_game_create_from_xml(game_node, &external);
if(game)
{
gfire_games = g_list_append(gfire_games, game);
if(external)
gfire_games_external = g_list_append(gfire_games_external, game);
}
game_node = xmlnode_get_next_twin(game_node);
}
xmlnode_free(node);
return TRUE;
}
示例7: load_perl_plugin
static gboolean
load_perl_plugin(PurplePlugin *plugin)
{
PurplePerlScript *gps = (PurplePerlScript *)plugin->info->extra_info;
char *atmp[3] = { plugin->path, NULL, NULL };
if (gps == NULL || gps->load_sub == NULL)
return FALSE;
purple_debug(PURPLE_DEBUG_INFO, "perl", "Loading perl script\n");
if (my_perl == NULL)
perl_init();
plugin->handle = gps;
atmp[1] = gps->package;
PERL_SET_CONTEXT(my_perl);
execute_perl("Purple::PerlLoader::load_n_eval", 2, atmp);
{
dSP;
PERL_SET_CONTEXT(my_perl);
SPAGAIN;
ENTER;
SAVETMPS;
PUSHMARK(sp);
XPUSHs(sv_2mortal(purple_perl_bless_object(plugin,
"Purple::Plugin")));
PUTBACK;
perl_call_pv(gps->load_sub, G_EVAL | G_SCALAR);
SPAGAIN;
if (SvTRUE(ERRSV)) {
STRLEN len;
purple_debug(PURPLE_DEBUG_ERROR, "perl",
"Perl function %s exited abnormally: %s\n",
gps->load_sub, SvPV(ERRSV, len));
}
PUTBACK;
FREETMPS;
LEAVE;
}
return TRUE;
}
示例8: text_sent_cb
static void
text_sent_cb(GtkEntry *entry)
{
const char *txt;
PurpleConnection *gc;
const char *protocol_id;
if (account == NULL)
return;
gc = purple_account_get_connection(account);
txt = gtk_entry_get_text(entry);
protocol_id = purple_account_get_protocol_id(account);
purple_debug_misc("raw", "protocol_id = %s\n", protocol_id);
if (strcmp(protocol_id, "prpl-toc") == 0) {
int *a = (int *)purple_connection_get_protocol_data(gc);
unsigned short seqno = htons(a[1]++ & 0xffff);
unsigned short len = htons(strlen(txt) + 1);
write(*a, "*\002", 2);
write(*a, &seqno, 2);
write(*a, &len, 2);
write(*a, txt, ntohs(len));
purple_debug(PURPLE_DEBUG_MISC, "raw", "TOC C: %s\n", txt);
} else if (strcmp(protocol_id, "prpl-msn") == 0) {
MsnSession *session = purple_connection_get_protocol_data(gc);
char buf[strlen(txt) + 3];
g_snprintf(buf, sizeof(buf), "%s\r\n", txt);
msn_servconn_write(session->notification->servconn, buf, strlen(buf));
} else if (strcmp(protocol_id, "prpl-irc") == 0) {
write(*(int *)purple_connection_get_protocol_data(gc), txt, strlen(txt));
write(*(int *)purple_connection_get_protocol_data(gc), "\r\n", 2);
purple_debug(PURPLE_DEBUG_MISC, "raw", "IRC C: %s\n", txt);
} else if (strcmp(protocol_id, "prpl-jabber") == 0) {
jabber_send_raw((JabberStream *)purple_connection_get_protocol_data(gc), txt, -1);
} else {
purple_debug_error("raw", "Unknown protocol ID %s\n", protocol_id);
}
gtk_entry_set_text(entry, "");
}
示例9: ggp_libgaduw_debug_handler
static void ggp_libgaduw_debug_handler(int level, const char * format,
va_list args)
{
PurpleDebugLevel purple_level;
char *msg;
if ((level & GG_DEBUG_NET) || (level & GG_DEBUG_FUNCTION) ||
(level & GG_DEBUG_VERBOSE))
{
if (!purple_debug_is_verbose())
return;
}
if ((level & GG_DEBUG_DUMP) || /* GG session protocol packets */
(level & GG_DEBUG_TRAFFIC)) /* HTTP traffic */
{
if (!purple_debug_is_verbose() || !purple_debug_is_unsafe())
return;
}
msg = g_strdup_vprintf(format, args);
if (level & GG_DEBUG_ERROR)
purple_level = PURPLE_DEBUG_ERROR;
else if (level & GG_DEBUG_WARNING)
purple_level = PURPLE_DEBUG_WARNING;
else
purple_level = PURPLE_DEBUG_MISC;
purple_debug(purple_level, "gg", "%s", msg);
g_free(msg);
}
示例10: fb_util_vdebug
void
fb_util_vdebug(PurpleDebugLevel level, const gchar *format, va_list ap)
{
gboolean unsafe;
gboolean verbose;
gchar *str;
g_return_if_fail(format != NULL);
unsafe = (level & FB_UTIL_DEBUG_FLAG_UNSAFE) != 0;
verbose = (level & FB_UTIL_DEBUG_FLAG_VERBOSE) != 0;
if ((unsafe && !purple_debug_is_unsafe()) ||
(verbose && !purple_debug_is_verbose()))
{
return;
}
/* Ensure all local flags are removed */
level &= ~FB_UTIL_DEBUG_FLAG_ALL;
str = g_strdup_vprintf(format, ap);
purple_debug(level, "facebook", "%s\n", str);
g_free(str);
}
示例11: jabber_oob_xfer_read
static gssize jabber_oob_xfer_read(guchar **buffer, PurpleXfer *xfer) {
JabberOOBXfer *jox = xfer->data;
char test[2048];
char *tmp, *lenstr;
int len;
if((len = read(xfer->fd, test, sizeof(test))) > 0) {
jox->headers = g_string_append_len(jox->headers, test, len);
if((tmp = strstr(jox->headers->str, "\r\n\r\n"))) {
*tmp = '\0';
lenstr = strstr(jox->headers->str, "Content-Length: ");
if(lenstr) {
int size;
sscanf(lenstr, "Content-Length: %d", &size);
purple_xfer_set_size(xfer, size);
}
purple_xfer_set_read_fnc(xfer, NULL);
tmp += 4;
*buffer = (unsigned char*) g_strdup(tmp);
return strlen(tmp);
}
return 0;
} else if (errno != EAGAIN) {
purple_debug(PURPLE_DEBUG_ERROR, "jabber", "Read error on oob xfer!\n");
purple_xfer_cancel_local(xfer);
}
return 0;
}
示例12: plugin_load
static gboolean
plugin_load(PurplePlugin *plugin)
{
purple_debug(PURPLE_DEBUG_INFO, "simple", "simple plugin loaded.\n");
return TRUE;
}
示例13: snd
/** This function needs to be better written **/
static char * snd(char * sndType) {
char *daemon = "";
if (strcmp (sndType, "arts") == 0 ||
strcmp (sndType, "esd") == 0 ||
strcmp (sndType, "alsa") == 0 ||
strcmp (sndType, "automatic") == 0) {
FILE *which_pf;
char sndserver[1024];
if (strcmp (sndType, "arts") == 0)
which_pf= popen("which artsdsp 2>/dev/null","r");
else if (strcmp (sndType, "esd") == 0)
which_pf= popen("which esddsp 2>/dev/null","r");
else if (strcmp (sndType, "alsa") == 0)
which_pf= popen("which aoss 2>/dev/null","r");
else if (strcmp (sndType, "automatic") == 0)
which_pf= popen("which artsdsp 2>/dev/null","r");
fscanf(which_pf,"%1023s",sndserver);
pclose(which_pf);
daemon=sndserver;
}
else{
purple_debug(PURPLE_DEBUG_INFO, "pidgin festival sound method ", sndType);
}
return daemon;
}
示例14: plugin_load
static gboolean
plugin_load(PurplePlugin *plugin) {
FILE *which_pf;
char line[1024];
which_pf= popen("which festival 2>/dev/null","r");
fscanf(which_pf,"%1023s",line);
pclose(which_pf);
if( *line != '/')
return FALSE;
char proc[1024];
sprintf(proc, "%s %s", snd((char *)purple_prefs_get_string("/pidgin/sound/method")), line);
purple_debug(PURPLE_DEBUG_INFO, "pidgin festival", proc);
int errno=0;
festival_pf= popen(proc,"w");
if(errno) {
pclose(festival_pf);
return FALSE;
}
load_conf();
void *conv_handle = purple_conversations_get_handle();
void *blist_handle = purple_blist_get_handle();
void *accounts_handle = purple_accounts_get_handle();
purple_signal_connect(conv_handle, "received-im-msg",
plugin, PURPLE_CALLBACK(im_recv_im), NULL);
purple_signal_connect(conv_handle, "received-chat-msg",
plugin, PURPLE_CALLBACK(im_recv_im), NULL);
purple_signal_connect(conv_handle, "conversation-created",
plugin, PURPLE_CALLBACK(chat_created), NULL);
purple_signal_connect(blist_handle, "buddy-signed-on",
plugin, PURPLE_CALLBACK(buddy_signed_on_cb), NULL);
purple_signal_connect(blist_handle, "buddy-signed-off",
plugin, PURPLE_CALLBACK(buddy_signed_off_cb), NULL);
purple_signal_connect(conv_handle, "chat-buddy-joined",
plugin, PURPLE_CALLBACK(chat_buddy_joined_cb), NULL);
purple_signal_connect(conv_handle, "chat-buddy-left",
plugin, PURPLE_CALLBACK(chat_buddy_left_cb), NULL);
/* Buddy List subsystem signals */
purple_signal_connect(blist_handle, "buddy-away",
plugin, PURPLE_CALLBACK(buddy_away_cb), NULL);
purple_signal_connect(blist_handle, "buddy-back",
plugin, PURPLE_CALLBACK(buddy_back_cb), NULL);
purple_signal_connect(blist_handle, "buddy-idle",
plugin, PURPLE_CALLBACK(buddy_idle_cb), NULL);
purple_signal_connect(blist_handle, "buddy-unidle",
plugin, PURPLE_CALLBACK(buddy_unidle_cb), NULL);
purple_signal_connect(accounts_handle, "account-connecting",
plugin, PURPLE_CALLBACK(account_connecting_cb), NULL);
return TRUE;
}
示例15: yahoo_receivefile_connected
static void yahoo_receivefile_connected(gpointer data, gint source, const gchar *error_message)
{
PurpleXfer *xfer;
struct yahoo_xfer_data *xd;
purple_debug(PURPLE_DEBUG_INFO, "yahoo",
"AAA - in yahoo_receivefile_connected\n");
if (!(xfer = data))
return;
if (!(xd = xfer->data))
return;
if ((source < 0) || (xd->path == NULL) || (xd->host == NULL)) {
purple_xfer_error(PURPLE_XFER_RECEIVE, purple_xfer_get_account(xfer),
xfer->who, _("Unable to connect."));
purple_xfer_cancel_remote(xfer);
return;
}
xfer->fd = source;
/* The first time we get here, assemble the tx buffer */
if (xd->txbuflen == 0) {
xd->txbuf = g_strdup_printf("GET /%s HTTP/1.0\r\nHost: %s\r\n\r\n",
xd->path, xd->host);
xd->txbuflen = strlen(xd->txbuf);
xd->txbuf_written = 0;
}
if (!xd->tx_handler)
{
xd->tx_handler = purple_input_add(source, PURPLE_INPUT_WRITE,
yahoo_receivefile_send_cb, xfer);
yahoo_receivefile_send_cb(xfer, source, PURPLE_INPUT_WRITE);
}
}