Added some debug messages.

This commit is contained in:
Håvard Pettersson 2014-11-20 11:17:16 +01:00
parent bdc0000cce
commit e11d82b25c
2 changed files with 24 additions and 0 deletions

View File

@ -42,6 +42,7 @@ add_library(tox MODULE
src/twc-utils.c 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") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Wextra -Wno-unused-parameter")
target_link_libraries(tox toxcore) target_link_libraries(tox toxcore)

View File

@ -339,6 +339,14 @@ twc_group_namelist_change_callback(Tox *tox,
weechat_nicklist_remove_nick(chat->buffer, nick); weechat_nicklist_remove_nick(chat->buffer, nick);
weechat_hashtable_remove(chat->nicks, &peer_number); 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 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: case TOX_CHAT_CHANGE_PEER_NAME:
if (prev_name && 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_printf(chat->buffer, "%s%s is now known as %s",
weechat_prefix("network"), prev_name, name); weechat_prefix("network"), prev_name, name);
#endif // TWC_DEBUG
break; break;
case TOX_CHAT_CHANGE_PEER_ADD: case TOX_CHAT_CHANGE_PEER_ADD:
if (name) 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_printf(chat->buffer, "%s%s just joined the group chat",
weechat_prefix("join"), name); weechat_prefix("join"), name);
#endif // TWC_DEBUG
break; break;
case TOX_CHAT_CHANGE_PEER_DEL: case TOX_CHAT_CHANGE_PEER_DEL:
if (prev_name) 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_printf(chat->buffer, "%s%s just left the group chat",
weechat_prefix("quit"), prev_name); weechat_prefix("quit"), prev_name);
#endif // TWC_DEBUG
break; break;
} }