From e11d82b25cb4abe06199021e81116f5c684046cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Pettersson?= Date: Thu, 20 Nov 2014 11:17:16 +0100 Subject: [PATCH] Added some debug messages. --- CMakeLists.txt | 1 + src/twc-tox-callbacks.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fbc1be..fa1743d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,7 @@ add_library(tox MODULE src/twc-utils.c ) +set(CMAKE_C_FLAGS_DEBUG "-DTWC_DEBUG") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Wextra -Wno-unused-parameter") target_link_libraries(tox toxcore) diff --git a/src/twc-tox-callbacks.c b/src/twc-tox-callbacks.c index ed8944a..4707bd8 100644 --- a/src/twc-tox-callbacks.c +++ b/src/twc-tox-callbacks.c @@ -339,6 +339,14 @@ twc_group_namelist_change_callback(Tox *tox, weechat_nicklist_remove_nick(chat->buffer, nick); weechat_hashtable_remove(chat->nicks, &peer_number); } + else + { +#ifdef TWC_DEBUG + weechat_printf(chat->buffer, "warning: could not find nick %s (%d) for %s", + name, peer_number, + change_type == TOX_CHAT_CHANGE_PEER_DEL ? "deleting" : "updating"); +#endif // TWC_DEBUG + } } if (change_type == TOX_CHAT_CHANGE_PEER_ADD @@ -354,18 +362,33 @@ twc_group_namelist_change_callback(Tox *tox, { case TOX_CHAT_CHANGE_PEER_NAME: if (prev_name && name) +#ifdef TWC_DEBUG + weechat_printf(chat->buffer, "%s%s [%d] is now known as %s", + weechat_prefix("network"), prev_name, peer_number, name); +#else weechat_printf(chat->buffer, "%s%s is now known as %s", weechat_prefix("network"), prev_name, name); +#endif // TWC_DEBUG break; case TOX_CHAT_CHANGE_PEER_ADD: if (name) +#ifdef TWC_DEBUG + weechat_printf(chat->buffer, "%s%s [%d] just joined the group chat", + weechat_prefix("join"), name, peer_number); +#else weechat_printf(chat->buffer, "%s%s just joined the group chat", weechat_prefix("join"), name); +#endif // TWC_DEBUG break; case TOX_CHAT_CHANGE_PEER_DEL: if (prev_name) +#ifdef TWC_DEBUG + weechat_printf(chat->buffer, "%s%s [%d] just left the group chat", + weechat_prefix("quit"), prev_name, peer_number); +#else weechat_printf(chat->buffer, "%s%s just left the group chat", weechat_prefix("quit"), prev_name); +#endif // TWC_DEBUG break; }