From a9e0de25139d71ddb979d053049b32803a97dbbc Mon Sep 17 00:00:00 2001 From: dequis Date: Wed, 12 Jul 2017 19:53:29 -0300 Subject: purple: enable debug during core initialization Noisy but often important --- protocols/purple/purple.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'protocols') diff --git a/protocols/purple/purple.c b/protocols/purple/purple.c index 0b74c8d8..5d935028 100644 --- a/protocols/purple/purple.c +++ b/protocols/purple/purple.c @@ -1794,6 +1794,7 @@ void purple_initmodule() GList *prots; GString *help; char *dir; + gboolean debug_enabled = !!getenv("BITLBEE_DEBUG"); if (purple_get_core() != NULL) { log_message(LOGLVL_ERROR, "libpurple already initialized. " @@ -1812,7 +1813,7 @@ void purple_initmodule() purple_plugins_add_search_path(dir); g_free(dir); - purple_debug_set_enabled(FALSE); + purple_debug_set_enabled(debug_enabled); purple_core_set_ui_ops(&bee_core_uiops); purple_eventloop_set_ui_ops(&glib_eventloops); if (!purple_core_init("BitlBee")) { @@ -1820,6 +1821,7 @@ void purple_initmodule() fprintf(stderr, "libpurple initialization failed.\n"); abort(); } + purple_debug_set_enabled(FALSE); if (proxytype != PROXY_NONE) { PurpleProxyInfo *pi = purple_global_proxy_get_info(); -- cgit v1.2.3 From d11822ad2ff37193c8a5c6fc34d8c175e2281efc Mon Sep 17 00:00:00 2001 From: Alex Schroeder Date: Wed, 9 Aug 2017 07:55:15 +0200 Subject: Twitter: fix format strings for integers Silence the following compiler warning: format specifies type 'unsigned long long' but the argument has type 'guint64'. When formatting a json_integer, use PRId64 for int64_t. When formatting ordinary integers, use G_GUINT64_FORMAT for guint64. --- protocols/twitter/twitter_lib.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'protocols') diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index 761d74f7..8425c58e 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -307,7 +307,7 @@ static gboolean twitter_xt_get_friends_id_list(json_value *node, struct twitter_ } txl->list = g_slist_prepend(txl->list, - g_strdup_printf("%" PRIu64, c->u.array.values[i]->u.integer)); + g_strdup_printf("%" PRId64, c->u.array.values[i]->u.integer)); } c = json_o_get(node, "next_cursor"); @@ -440,7 +440,7 @@ static void twitter_http_get_noretweets_ids(struct http_request *req) txl = g_new0(struct twitter_xml_list, 1); txl->list = td->noretweets_ids; - + // Process the retweet ids txl->type = TXL_ID; if (parsed->type == json_array) { @@ -451,7 +451,7 @@ static void twitter_http_get_noretweets_ids(struct http_request *req) continue; } txl->list = g_slist_prepend(txl->list, - g_strdup_printf("%"PRIu64, c->u.integer)); + g_strdup_printf("%" PRId64, c->u.integer)); } } @@ -749,7 +749,7 @@ static void expand_entities(char **text, const json_value *node, const json_valu const char *full = json_o_str(v->u.array.values[i], "expanded_url"); char *pos, *new; - /* Skip if a required field is missing, if the t.co URL is not in fact + /* Skip if a required field is missing, if the t.co URL is not in fact in the Tweet at all, or if the full-ish one *is* in it already (dupes appear, especially in streaming API). */ if (!kort || !disp || !(pos = strstr(*text, kort)) || strstr(*text, disp)) { @@ -977,9 +977,9 @@ static void twitter_status_show(struct im_connection *ic, struct twitter_xml_sta if (status->user == NULL || status->text == NULL) { return; } - + /* Check this is not a tweet that should be muted */ - uid_str = g_strdup_printf("%" PRIu64, status->user->uid); + uid_str = g_strdup_printf("%" G_GUINT64_FORMAT, status->user->uid); if (g_slist_find_custom(td->mutes_ids, uid_str, (GCompareFunc)strcmp)) { g_free(uid_str); @@ -1169,21 +1169,21 @@ static gboolean twitter_stream_handle_event(struct im_connection *ic, json_value GSList *found; char *uid_str; ut = twitter_xt_get_user(target); - uid_str = g_strdup_printf("%" PRIu64, ut->uid); + uid_str = g_strdup_printf("%" G_GUINT64_FORMAT, ut->uid); if (!(found = g_slist_find_custom(td->mutes_ids, uid_str, (GCompareFunc)strcmp))) { td->mutes_ids = g_slist_prepend(td->mutes_ids, uid_str); } twitter_log(ic, "Muted user %s", ut->screen_name); if (getenv("BITLBEE_DEBUG")) { - fprintf(stderr, "New mute: %s %"PRIu64"\n", + fprintf(stderr, "New mute: %s %"G_GUINT64_FORMAT"\n", ut->screen_name, ut->uid); } } else if (strcmp(type, "unmute") == 0) { GSList *found; char *uid_str; ut = twitter_xt_get_user(target); - uid_str = g_strdup_printf("%" PRIu64, ut->uid); + uid_str = g_strdup_printf("%" G_GUINT64_FORMAT, ut->uid); if ((found = g_slist_find_custom(td->mutes_ids, uid_str, (GCompareFunc)strcmp))) { char *found_str = found->data; @@ -1193,7 +1193,7 @@ static gboolean twitter_stream_handle_event(struct im_connection *ic, json_value g_free(uid_str); twitter_log(ic, "Unmuted user %s", ut->screen_name); if (getenv("BITLBEE_DEBUG")) { - fprintf(stderr, "New unmute: %s %"PRIu64"\n", + fprintf(stderr, "New unmute: %s %"G_GUINT64_FORMAT"\n", ut->screen_name, ut->uid); } } -- cgit v1.2.3