Exemplo n.º 1
0
/* deactivates delete friend popup and deletes friend if instructed */
static void del_friend_deactivate(ToxWindow *self, Tox *m, wint_t key)
{
    if (key == 'y') {
        if (blocklist_view == 0) {
            delete_friend(m, PendingDelete.num);
            sort_friendlist_index();
        } else {
            delete_blocked_friend(PendingDelete.num);
            sort_blocklist_index();
        }
    }

    delwin(PendingDelete.popup);
    memset(&PendingDelete, 0, sizeof(PendingDelete));
    clear();
    refresh();
}
Exemplo n.º 2
0
/* removes friend from blocklist, puts back in friendlist */
static void unblock_friend(Tox *m, int32_t bnum)
{
    if (Blocked.num_blocked <= 0)
        return;

    int32_t friendnum = tox_add_friend_norequest(m, (uint8_t *) Blocked.list[bnum].pub_key);

    if (friendnum == -1) {
        line_info_add(prompt, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to unblock friend");
        return;
    }

    friendlist_add_blocked(m, friendnum, bnum);
    delete_blocked_friend(bnum);
    sort_blocklist_index();
    sort_friendlist_index();
}
Exemplo n.º 3
0
/* removes friend from blocklist, puts back in friendlist */
static void unblock_friend(Tox *m, uint32_t bnum)
{
    if (Blocked.num_blocked <= 0)
        return;

    TOX_ERR_FRIEND_ADD err;
    uint32_t friendnum = tox_friend_add_norequest(m, (uint8_t *) Blocked.list[bnum].pub_key, &err);

    if (err != TOX_ERR_FRIEND_ADD_OK) {
        line_info_add(prompt, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to unblock friend (error %d)", err);
        return;
    }

    friendlist_add_blocked(m, friendnum, bnum);
    delete_blocked_friend(bnum);
    sort_blocklist_index();
    sort_friendlist_index();
}