本文整理汇总了C++中purple_debug_misc函数的典型用法代码示例。如果您正苦于以下问题:C++ purple_debug_misc函数的具体用法?C++ purple_debug_misc怎么用?C++ purple_debug_misc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了purple_debug_misc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ycht_packet_read
static void ycht_packet_read(YchtPkt *pkt, const char *buf, int len)
{
const char *pos = buf;
const char *needle;
char *tmp, *tmp2;
int i = 0;
while (len > 0 && (needle = g_strstr_len(pos, len, YCHT_SEP))) {
tmp = g_strndup(pos, needle - pos);
pkt->data = g_list_append(pkt->data, tmp);
len -= needle - pos + strlen(YCHT_SEP);
pos = needle + strlen(YCHT_SEP);
tmp2 = g_strescape(tmp, NULL);
purple_debug_misc("yahoo", "Data[%d]:\t%s\n", i++, tmp2);
g_free(tmp2);
}
if (len) {
tmp = g_strndup(pos, len);
pkt->data = g_list_append(pkt->data, tmp);
tmp2 = g_strescape(tmp, NULL);
purple_debug_misc("yahoo", "Data[%d]:\t%s\n", i, tmp2);
g_free(tmp2);
};
purple_debug_misc("yahoo", "--==End of incoming YCHT packet==--\n");
}
示例2: pidgin_io_invoke
static gboolean pidgin_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data)
{
PidginIOClosure *closure = data;
PurpleInputCondition purple_cond = 0;
if (condition & PIDGIN_READ_COND)
purple_cond |= PURPLE_INPUT_READ;
if (condition & PIDGIN_WRITE_COND)
purple_cond |= PURPLE_INPUT_WRITE;
#if 0
purple_debug_misc("gtk_eventloop",
"CLOSURE: callback for %d, fd is %d\n",
closure->result, g_io_channel_unix_get_fd(source));
#endif
#ifdef _WIN32
if(! purple_cond) {
#ifdef DEBUG
purple_debug_misc("gtk_eventloop",
"CLOSURE received GIOCondition of 0x%x, which does not"
" match 0x%x (READ) or 0x%x (WRITE)\n",
condition, PIDGIN_READ_COND, PIDGIN_WRITE_COND);
#endif /* DEBUG */
return TRUE;
}
#endif /* _WIN32 */
closure->function(closure->data, g_io_channel_unix_get_fd(source),
purple_cond);
return TRUE;
}
示例3: http_connection_send_request
static void
http_connection_send_request(PurpleHTTPConnection *conn, const GString *req)
{
char *data;
int ret;
size_t len;
/* Sending something to the server, restart the inactivity timer */
jabber_stream_restart_inactivity_timer(conn->bosh->js);
data = g_strdup_printf("POST %s HTTP/1.1\r\n"
"Host: %s\r\n"
"User-Agent: %s\r\n"
"Content-Encoding: text/xml; charset=utf-8\r\n"
"Content-Length: %" G_GSIZE_FORMAT "\r\n\r\n"
"%s",
conn->bosh->path, conn->bosh->host, bosh_useragent,
req->len, req->str);
len = strlen(data);
++conn->requests;
++conn->bosh->requests;
if (purple_debug_is_unsafe() && purple_debug_is_verbose())
/* Will contain passwords for SASL PLAIN and is verbose */
purple_debug_misc("jabber", "BOSH (%p): Sending %s\n", conn, data);
else if (purple_debug_is_verbose())
purple_debug_misc("jabber", "BOSH (%p): Sending request of "
"%" G_GSIZE_FORMAT " bytes.\n", conn, len);
if (conn->writeh == 0)
ret = http_connection_do_send(conn, data, len);
else {
ret = -1;
errno = EAGAIN;
}
if (ret < 0 && errno != EAGAIN) {
/*
* TODO: Handle this better. Probably requires a PurpleBOSHConnection
* buffer that stores what is "being sent" until the
* PurpleHTTPConnection reports it is fully sent.
*/
gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"),
g_strerror(errno));
purple_connection_error_reason(conn->bosh->js->gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
tmp);
g_free(tmp);
return;
} else if (ret < len) {
if (ret < 0)
ret = 0;
if (conn->writeh == 0)
conn->writeh = purple_input_add(conn->psc ? conn->psc->fd : conn->fd,
PURPLE_INPUT_WRITE, http_connection_send_cb, conn);
purple_circ_buffer_append(conn->write_buf, data + ret, len - ret);
}
}
示例4: g_strdup_printf
static const gchar *get_proc_exe(const gchar *p_proc_path)
{
static gchar exe[PATH_MAX];
gchar *proc_exe = g_strdup_printf("%s/exe", p_proc_path);
#ifdef DEBUG_VERBOSE
purple_debug_misc("gfire", "get_proc_exe: Resolving symlink \"%s\"\n", proc_exe);
#endif // DEBUG_VERBOSE
int len = readlink(proc_exe, exe, PATH_MAX - 1);
if(len == -1)
{
#ifdef DEBUG
purple_debug_error("gfire", "get_proc_exe: readlink() failed\n");
#endif // DEBUG
g_free(proc_exe);
return NULL;
}
exe[len] = 0;
#ifdef DEBUG_VERBOSE
purple_debug_misc("gfire", "get_proc_exe: \"%s\" -> \"%s\"\n", proc_exe, exe);
#endif // DEBUG_VERBOSE
g_free(proc_exe);
return exe;
}
示例5: got_page_cb
static void got_page_cb(PurpleUtilFetchUrlData * url_data, gpointer user_data, const gchar * url_text, gsize len, const gchar * error_message)
{
BuddyIconContext *ctx = user_data;
TwitterConvIcon *conv_icon;
const gchar *pic_data;
conv_icon = twitter_conv_icon_find(ctx->account, ctx->buddy_name);
twitter_buddy_icon_context_free(ctx);
g_return_if_fail(conv_icon != NULL);
conv_icon->requested = FALSE;
conv_icon->fetch_data = NULL;
if (len && !error_message && twitter_response_text_status_code(url_text) == 200 && (pic_data = twitter_response_text_data(url_text, len))) {
purple_debug_info(PLUGIN_ID, "Attempting to create pixbuf\n");
purple_debug_misc(PLUGIN_ID, "MHM: url text is |%s|\n", url_text);
purple_debug_misc(PLUGIN_ID, "MHM: url text is |%02x %02x %02x %02x|\n", pic_data[0], pic_data[1], pic_data[2], pic_data[3]);
conv_icon->pixbuf = make_scaled_pixbuf((const guchar *) pic_data, len);
}
if (conv_icon->pixbuf) {
purple_debug_info(PLUGIN_ID, "All succeeded, inserting\n");
insert_requested_icon(conv_icon);
}
}
示例6: start_direct_connection
/* start the connection when all the details are available */
void
start_direct_connection()
{
int server_pid=fork();
if (server_pid==0)
{
/* child process: run the server */
purple_debug_misc(PLUGIN_ID,"server_ip=\"%s\"\n",purple_value_get_string(server_ip));
const char* cmd=purple_prefs_get_string(PREF_SERVER_COMMAND_LINE);
/* replace the port in the command string */
GRegex *port_regex=g_regex_new("[$]PORT",0,0,NULL);
char* command=g_regex_replace(port_regex,cmd,-1,0,purple_value_get_string(port),0,NULL);
purple_debug_misc(PLUGIN_ID,"server command=\"%s\"\n",command);
gchar **splitted_command=g_strsplit(command," ",0);
execvp(splitted_command[0],splitted_command);
g_free(command);
g_free(splitted_command);
g_free(port_regex);
}
else
{
/* original process: sent the connection request*/
send_connect_request_message();
}
}
示例7: g_strdup_printf
static const gchar *get_proc_cwd(GHashTable *p_environ, const gchar *p_proc_path)
{
static gchar cwd[PATH_MAX + 1];
gchar *proc_cwd = g_strdup_printf("%s/cwd", p_proc_path);
#ifdef DEBUG_VERBOSE
purple_debug_misc("gfire", "get_proc_cwd: No match, resolving symlink \"%s\"\n", proc_cwd);
#endif // DEBUG_VERBOSE
ssize_t len = readlink(proc_cwd, cwd, PATH_MAX);
if(len == -1)
{
#ifdef DEBUG
purple_debug_error("gfire", "get_proc_cwd: readlink() failed\n");
#endif // DEBUG
g_free(proc_cwd);
return NULL;
}
cwd[len] = 0;
#ifdef DEBUG_VERBOSE
purple_debug_misc("gfire", "get_proc_cwd: \"%s\" -> \"%s\"\n", proc_cwd, cwd);
#endif // DEBUG_VERBOSE
g_free(proc_cwd);
return cwd;
}
示例8: purple_xfer_ui_ready
void
purple_xfer_ui_ready(PurpleXfer *xfer)
{
PurpleInputCondition cond;
PurpleXferType type;
PurpleXferPrivData *priv;
g_return_if_fail(xfer != NULL);
priv = g_hash_table_lookup(xfers_data, xfer);
priv->ready |= PURPLE_XFER_READY_UI;
if (0 == (priv->ready & PURPLE_XFER_READY_PRPL)) {
purple_debug_misc("xfer", "UI is ready on ft %p, waiting for prpl\n", xfer);
return;
}
purple_debug_misc("xfer", "UI (and prpl) ready on ft %p, so proceeding\n", xfer);
type = purple_xfer_get_type(xfer);
if (type == PURPLE_XFER_SEND)
cond = PURPLE_INPUT_WRITE;
else /* if (type == PURPLE_XFER_RECEIVE) */
cond = PURPLE_INPUT_READ;
if (xfer->watcher == 0 && xfer->fd != -1)
xfer->watcher = purple_input_add(xfer->fd, cond, transfer_cb, xfer);
priv->ready = PURPLE_XFER_READY_NONE;
do_transfer(xfer);
}
示例9: msn_soap_read_cb
static void
msn_soap_read_cb(gpointer data, gint fd, PurpleInputCondition cond)
{
MsnSoapConnection *conn = data;
int count = 0, cnt, perrno;
/* This buffer needs to be larger than any packets received from
login.live.com or Adium will fail to receive the packet
(something weird with the login.live.com server). With NSS it works
fine, so I believe it's some bug with OS X */
char buf[16 * 1024];
gsize cursor;
if (conn->message == NULL) {
conn->message = msn_soap_message_new(NULL, NULL);
}
if (conn->buf == NULL) {
conn->buf = g_string_new_len(buf, 0);
}
cursor = conn->buf->len;
while ((cnt = purple_ssl_read(conn->ssl, buf, sizeof(buf))) > 0) {
purple_debug_info("soap", "read %d bytes\n", cnt);
count += cnt;
g_string_append_len(conn->buf, buf, cnt);
}
perrno = errno;
if (cnt < 0 && perrno != EAGAIN)
purple_debug_info("soap", "read: %s\n", g_strerror(perrno));
if (conn->current_request && conn->current_request->secure &&
!purple_debug_is_unsafe())
purple_debug_misc("soap", "Received secure request.\n");
else if (count != 0)
purple_debug_misc("soap", "current %s\n", conn->buf->str + cursor);
/* && count is necessary for Adium, on OS X the last read always
return an error, so we want to proceed anyway. See #5212 for
discussion on this and the above buffer size issues */
if(cnt < 0 && errno == EAGAIN && count == 0)
return;
/* msn_soap_process could alter errno */
msn_soap_process(conn);
if ((cnt < 0 && perrno != EAGAIN) || cnt == 0) {
/* It's possible msn_soap_process closed the ssl connection */
if (conn->ssl) {
purple_ssl_close(conn->ssl);
conn->ssl = NULL;
msn_soap_connection_handle_next(conn);
}
}
}
示例10: find_available_http_connection
static PurpleHTTPConnection *
find_available_http_connection(PurpleBOSHConnection *conn)
{
int i;
if (purple_debug_is_verbose()) {
for (i = 0; i < NUM_HTTP_CONNECTIONS; ++i) {
PurpleHTTPConnection *httpconn = conn->connections[i];
if (httpconn == NULL)
purple_debug_misc("jabber", "BOSH %p->connections[%d] = (nil)\n",
conn, i);
else
purple_debug_misc("jabber", "BOSH %p->connections[%d] = %p, state = %d"
", requests = %d\n", conn, i, httpconn,
httpconn->state, httpconn->requests);
}
}
/* Easy solution: Does everyone involved support pipelining? Hooray! Just use
* one TCP connection! */
if (conn->pipelining)
return conn->connections[0]->state == HTTP_CONN_CONNECTED ?
conn->connections[0] : NULL;
/* First loop, look for a connection that's ready */
for (i = 0; i < NUM_HTTP_CONNECTIONS; ++i) {
if (conn->connections[i] &&
conn->connections[i]->state == HTTP_CONN_CONNECTED &&
conn->connections[i]->requests == 0)
return conn->connections[i];
}
/* Second loop, is something currently connecting? If so, just queue up. */
for (i = 0; i < NUM_HTTP_CONNECTIONS; ++i) {
if (conn->connections[i] &&
conn->connections[i]->state == HTTP_CONN_CONNECTING)
return NULL;
}
/* Third loop, look for one that's NULL and create a new connection */
for (i = 0; i < NUM_HTTP_CONNECTIONS; ++i) {
if (!conn->connections[i]) {
purple_debug_info("jabber", "bosh: Creating and connecting new httpconn\n");
conn->connections[i] = jabber_bosh_http_connection_init(conn);
http_connection_connect(conn->connections[i]);
return NULL;
}
}
purple_debug_warning("jabber", "Could not find a HTTP connection!\n");
/* None available. */
return NULL;
}
示例11: ggp_ggdrive_auth_done
static void ggp_ggdrive_auth_done(PurpleHttpConnection *hc,
PurpleHttpResponse *response, gpointer user_data)
{
PurpleConnection *gc = purple_http_conn_get_purple_connection(hc);
ggp_edisc_session_data *sdata = ggp_edisc_get_sdata(gc);
JsonParser *parser;
JsonObject *result;
int status = -1;
g_return_if_fail(sdata != NULL);
sdata->auth_request = NULL;
if (!purple_http_response_is_successful(response)) {
purple_debug_misc("gg", "ggp_ggdrive_auth_done: authentication "
"failed due to unsuccessful request (code = %d)\n",
purple_http_response_get_code(response));
ggp_ggdrive_auth_results(gc, FALSE);
return;
}
parser = ggp_json_parse(purple_http_response_get_data(response, NULL));
result = json_node_get_object(json_parser_get_root(parser));
result = json_object_get_object_member(result, "result");
if (json_object_has_member(result, "status"))
status = json_object_get_int_member(result, "status");
g_object_unref(parser);
if (status != 0 ) {
purple_debug_misc("gg", "ggp_ggdrive_auth_done: authentication "
"failed due to bad result (status=%d)\n", status);
if (purple_debug_is_verbose())
purple_debug_misc("gg", "ggp_ggdrive_auth_done: "
"result = %s\n",
purple_http_response_get_data(response, NULL));
ggp_ggdrive_auth_results(gc, FALSE);
return;
}
sdata->security_token = g_strdup(purple_http_response_get_header(
response, "X-gged-security-token"));
if (!sdata->security_token) {
purple_debug_misc("gg", "ggp_ggdrive_auth_done: authentication "
"failed due to missing security token header\n");
ggp_ggdrive_auth_results(gc, FALSE);
return;
}
if (purple_debug_is_unsafe())
purple_debug_misc("gg", "ggp_ggdrive_auth_done: "
"security_token=%s\n", sdata->security_token);
ggp_ggdrive_auth_results(gc, TRUE);
}
示例12: sending_im_msg_cb
/* initialize an IM message to potentially be split */
static void
sending_im_msg_cb(PurpleAccount *account, const char *receiver,
const char **message)
{
message_to_conv *msg_to_conv;
if (splitter_injected_message)
return;
purple_debug_misc("purple-splitter", "splitter plugin invoked\n");
g_return_if_fail(account != NULL);
g_return_if_fail(receiver != NULL);
g_return_if_fail(message != NULL);
g_return_if_fail(*message != NULL);
/* OTR compatibility hack */
if (0 == strncmp(*message, "?OTR", strlen("?OTR")))
return;
msg_to_conv = g_new0(message_to_conv, 1);
msg_to_conv->sender_username = g_strdup(account->username);
msg_to_conv->sender_protocol_id = g_strdup(account->protocol_id);
msg_to_conv->receiver = g_strdup(receiver);
msg_to_conv->type = PURPLE_CONV_TYPE_IM;
split_and_send(msg_to_conv, message);
}
示例13: aim_locate_getcaps_short
guint32
aim_locate_getcaps_short(OscarData *od, ByteStream *bs, int len)
{
guint32 flags = 0;
int offset;
for (offset = 0; byte_stream_empty(bs) && (offset < len); offset += 0x02) {
guint8 *cap;
int i, identified;
cap = byte_stream_getraw(bs, 0x02);
for (i = 0, identified = 0; !(aim_caps[i].flag & OSCAR_CAPABILITY_LAST); i++) {
if (memcmp(&aim_caps[i].data[2], cap, 0x02) == 0) {
flags |= aim_caps[i].flag;
identified++;
break; /* should only match once... */
}
}
if (!identified)
purple_debug_misc("oscar", "unknown short capability: {%02x%02x}\n", cap[0], cap[1]);
g_free(cap);
}
return flags;
}
示例14: plugin_load
/* As we've covered before, libpurple calls this function, if present, when it
* loads the plugin. Here we're using it to show off the capabilities of the
* debug API and just blindly returning TRUE to tell libpurple it's safe to
* continue loading. */
static gboolean
plugin_load(PurplePlugin *plugin)
{
/* Define these for convenience--we're just using them to show the
* similarities of the debug functions to the standard printf(). */
gint i = 256;
gfloat f = 512.1024;
const gchar *s = "example string";
/* Introductory message */
purple_debug_info(PLUGIN_ID,
"Called plugin_load. Beginning debug demonstration\n");
/* Show off the debug API a bit */
purple_debug_misc(PLUGIN_ID,
"MISC level debug message. i = %d, f = %f, s = %s\n", i, f, s);
purple_debug_info(PLUGIN_ID,
"INFO level debug message. i = %d, f = %f, s = %s\n", i, f, s);
purple_debug_warning(PLUGIN_ID,
"WARNING level debug message. i = %d, f = %f, s = %s\n", i, f, s);
purple_debug_error(PLUGIN_ID,
"ERROR level debug message. i = %d, f = %f, s = %s\n", i, f, s);
purple_debug_fatal(PLUGIN_ID,
"FATAL level debug message. i = %d, f = %f, s = %s\n", i, f, s);
/* Now just return TRUE to tell libpurple to finish loading. */
return TRUE;
}
示例15: show_debug_cmd
static void
show_debug_cmd(MsnCmdProc *cmdproc, gboolean incoming, const char *command)
{
MsnServConn *servconn;
const char *names[] = { "NS", "SB" };
char *show;
char tmp;
size_t len;
servconn = cmdproc->servconn;
len = strlen(command);
show = g_strdup(command);
tmp = (incoming) ? 'S' : 'C';
if ((show[len - 1] == '\n') && (show[len - 2] == '\r'))
{
show[len - 2] = '\0';
}
purple_debug_misc("msn", "%c: %s %03d: %s\n", tmp,
names[servconn->type], servconn->num, show);
g_free(show);
}