This commit is contained in:
Håvard Pettersson 2014-09-02 20:24:47 +02:00
parent 926b6951f6
commit 5a630d6a23
5 changed files with 31 additions and 23 deletions

View file

@ -3,6 +3,7 @@
#include <string.h>
#include <stdio.h>
#include <weechat/weechat-plugin.h>
#include <tox/tox.h>
#include "tox-weechat.h"
@ -58,6 +59,14 @@ tox_weechat_get_name_nt(int32_t friend_number)
uint8_t name[length];
tox_get_name(tox, friend_number, name);
// if no name, return client ID instead
if (weechat_utf8_strlen((char *)name) == 0)
{
uint8_t client_id[TOX_CLIENT_ID_SIZE];
tox_get_client_id(tox, friend_number, client_id);
return tox_weechat_bin2hex(client_id, TOX_CLIENT_ID_SIZE);
}
return tox_weechat_null_terminate(name, length);
}