mirror of
https://github.com/profanity-im/profanity.git
synced 2024-09-01 19:24:15 -04:00
Renamed contact property jid->barejid
This commit is contained in:
parent
da5104f857
commit
facb2a653b
@ -1243,7 +1243,7 @@ _cmd_sub(gchar **args, struct cmd_help_t help)
|
|||||||
while (contacts != NULL) {
|
while (contacts != NULL) {
|
||||||
PContact contact = (PContact) contacts->data;
|
PContact contact = (PContact) contacts->data;
|
||||||
if (p_contact_pending_out(contact)) {
|
if (p_contact_pending_out(contact)) {
|
||||||
cons_show(p_contact_jid(contact));
|
cons_show(p_contact_barejid(contact));
|
||||||
}
|
}
|
||||||
contacts = g_slist_next(contacts);
|
contacts = g_slist_next(contacts);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
struct p_contact_t {
|
struct p_contact_t {
|
||||||
char *jid;
|
char *barejid;
|
||||||
char *name;
|
char *name;
|
||||||
char *presence;
|
char *presence;
|
||||||
char *status;
|
char *status;
|
||||||
@ -41,13 +41,13 @@ struct p_contact_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PContact
|
PContact
|
||||||
p_contact_new(const char * const jid, const char * const name,
|
p_contact_new(const char * const barejid, const char * const name,
|
||||||
const char * const presence, const char * const status,
|
const char * const presence, const char * const status,
|
||||||
const char * const subscription, gboolean pending_out,
|
const char * const subscription, gboolean pending_out,
|
||||||
const char * const caps_str)
|
const char * const caps_str)
|
||||||
{
|
{
|
||||||
PContact contact = malloc(sizeof(struct p_contact_t));
|
PContact contact = malloc(sizeof(struct p_contact_t));
|
||||||
contact->jid = strdup(jid);
|
contact->barejid = strdup(barejid);
|
||||||
|
|
||||||
if (name != NULL) {
|
if (name != NULL) {
|
||||||
contact->name = strdup(name);
|
contact->name = strdup(name);
|
||||||
@ -84,7 +84,7 @@ p_contact_new(const char * const jid, const char * const name,
|
|||||||
void
|
void
|
||||||
p_contact_free(PContact contact)
|
p_contact_free(PContact contact)
|
||||||
{
|
{
|
||||||
FREE_SET_NULL(contact->jid);
|
FREE_SET_NULL(contact->barejid);
|
||||||
FREE_SET_NULL(contact->name);
|
FREE_SET_NULL(contact->name);
|
||||||
FREE_SET_NULL(contact->presence);
|
FREE_SET_NULL(contact->presence);
|
||||||
FREE_SET_NULL(contact->status);
|
FREE_SET_NULL(contact->status);
|
||||||
@ -99,9 +99,9 @@ p_contact_free(PContact contact)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
p_contact_jid(const PContact contact)
|
p_contact_barejid(const PContact contact)
|
||||||
{
|
{
|
||||||
return contact->jid;
|
return contact->barejid;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
@ -25,12 +25,12 @@
|
|||||||
|
|
||||||
typedef struct p_contact_t *PContact;
|
typedef struct p_contact_t *PContact;
|
||||||
|
|
||||||
PContact p_contact_new(const char * const jid, const char * const name,
|
PContact p_contact_new(const char * const barejid, const char * const name,
|
||||||
const char * const presence, const char * const status,
|
const char * const presence, const char * const status,
|
||||||
const char * const subscription, gboolean pending_out,
|
const char * const subscription, gboolean pending_out,
|
||||||
const char * const caps_str);
|
const char * const caps_str);
|
||||||
void p_contact_free(PContact contact);
|
void p_contact_free(PContact contact);
|
||||||
const char* p_contact_jid(PContact contact);
|
const char* p_contact_barejid(PContact contact);
|
||||||
const char* p_contact_name(PContact contact);
|
const char* p_contact_name(PContact contact);
|
||||||
const char* p_contact_presence(PContact contact);
|
const char* p_contact_presence(PContact contact);
|
||||||
const char* p_contact_status(PContact contact);
|
const char* p_contact_status(PContact contact);
|
||||||
|
@ -853,11 +853,11 @@ win_show_room_roster(const char * const room, GList *roster, const char * const
|
|||||||
|
|
||||||
while (roster != NULL) {
|
while (roster != NULL) {
|
||||||
PContact member = roster->data;
|
PContact member = roster->data;
|
||||||
const char const *name = p_contact_jid(member);
|
const char const *nick = p_contact_barejid(member);
|
||||||
const char const *show = p_contact_presence(member);
|
const char const *show = p_contact_presence(member);
|
||||||
|
|
||||||
_presence_colour_on(win, show);
|
_presence_colour_on(win, show);
|
||||||
wprintw(win, "%s", name);
|
wprintw(win, "%s", nick);
|
||||||
_presence_colour_off(win, show);
|
_presence_colour_off(win, show);
|
||||||
|
|
||||||
if (roster->next != NULL) {
|
if (roster->next != NULL) {
|
||||||
@ -2239,7 +2239,7 @@ _cons_show_incoming_message(const char * const short_from, const int win_index)
|
|||||||
static void
|
static void
|
||||||
_win_show_contact(ProfWin *window, PContact contact)
|
_win_show_contact(ProfWin *window, PContact contact)
|
||||||
{
|
{
|
||||||
const char *jid = p_contact_jid(contact);
|
const char *barejid = p_contact_barejid(contact);
|
||||||
const char *name = p_contact_name(contact);
|
const char *name = p_contact_name(contact);
|
||||||
const char *presence = p_contact_presence(contact);
|
const char *presence = p_contact_presence(contact);
|
||||||
const char *status = p_contact_status(contact);
|
const char *status = p_contact_status(contact);
|
||||||
@ -2247,7 +2247,7 @@ _win_show_contact(ProfWin *window, PContact contact)
|
|||||||
|
|
||||||
_win_show_time(window->win, '-');
|
_win_show_time(window->win, '-');
|
||||||
_presence_colour_on(window->win, presence);
|
_presence_colour_on(window->win, presence);
|
||||||
wprintw(window->win, "%s", jid);
|
wprintw(window->win, "%s", barejid);
|
||||||
|
|
||||||
if (name != NULL) {
|
if (name != NULL) {
|
||||||
wprintw(window->win, " (%s)", name);
|
wprintw(window->win, " (%s)", name);
|
||||||
@ -2417,7 +2417,7 @@ _win_show_history(WINDOW *win, int win_index, const char * const contact)
|
|||||||
static void
|
static void
|
||||||
_win_show_info(WINDOW *win, PContact pcontact)
|
_win_show_info(WINDOW *win, PContact pcontact)
|
||||||
{
|
{
|
||||||
const char *jid = p_contact_jid(pcontact);
|
const char *barejid = p_contact_barejid(pcontact);
|
||||||
const char *name = p_contact_name(pcontact);
|
const char *name = p_contact_name(pcontact);
|
||||||
const char *presence = p_contact_presence(pcontact);
|
const char *presence = p_contact_presence(pcontact);
|
||||||
const char *status = p_contact_status(pcontact);
|
const char *status = p_contact_status(pcontact);
|
||||||
@ -2429,7 +2429,7 @@ _win_show_info(WINDOW *win, PContact pcontact)
|
|||||||
wprintw(win, "\n");
|
wprintw(win, "\n");
|
||||||
_win_show_time(win, '-');
|
_win_show_time(win, '-');
|
||||||
_presence_colour_on(win, presence);
|
_presence_colour_on(win, presence);
|
||||||
wprintw(win, "%s", jid);
|
wprintw(win, "%s", barejid);
|
||||||
if (name != NULL) {
|
if (name != NULL) {
|
||||||
wprintw(win, " (%s)", name);
|
wprintw(win, " (%s)", name);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ static void first_element_correct(void)
|
|||||||
GSList *list = get_contact_list();
|
GSList *list = get_contact_list();
|
||||||
PContact james = list->data;
|
PContact james = list->data;
|
||||||
|
|
||||||
assert_string_equals("James", p_contact_jid(james));
|
assert_string_equals("James", p_contact_barejid(james));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void contains_two_elements(void)
|
static void contains_two_elements(void)
|
||||||
@ -63,8 +63,8 @@ static void first_and_second_elements_correct(void)
|
|||||||
PContact first = list->data;
|
PContact first = list->data;
|
||||||
PContact second = (g_slist_next(list))->data;
|
PContact second = (g_slist_next(list))->data;
|
||||||
|
|
||||||
assert_string_equals("James", p_contact_jid(first));
|
assert_string_equals("James", p_contact_barejid(first));
|
||||||
assert_string_equals("Dave", p_contact_jid(second));
|
assert_string_equals("Dave", p_contact_barejid(second));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void contains_three_elements(void)
|
static void contains_three_elements(void)
|
||||||
@ -87,9 +87,9 @@ static void first_three_elements_correct(void)
|
|||||||
PContact dave = (g_slist_next(list))->data;
|
PContact dave = (g_slist_next(list))->data;
|
||||||
PContact james = (g_slist_next(g_slist_next(list)))->data;
|
PContact james = (g_slist_next(g_slist_next(list)))->data;
|
||||||
|
|
||||||
assert_string_equals("James", p_contact_jid(james));
|
assert_string_equals("James", p_contact_barejid(james));
|
||||||
assert_string_equals("Dave", p_contact_jid(dave));
|
assert_string_equals("Dave", p_contact_barejid(dave));
|
||||||
assert_string_equals("Bob", p_contact_jid(bob));
|
assert_string_equals("Bob", p_contact_barejid(bob));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_twice_at_beginning_adds_once(void)
|
static void add_twice_at_beginning_adds_once(void)
|
||||||
@ -104,9 +104,9 @@ static void add_twice_at_beginning_adds_once(void)
|
|||||||
PContact third = (g_slist_next(g_slist_next(list)))->data;
|
PContact third = (g_slist_next(g_slist_next(list)))->data;
|
||||||
|
|
||||||
assert_int_equals(3, g_slist_length(list));
|
assert_int_equals(3, g_slist_length(list));
|
||||||
assert_string_equals("James", p_contact_jid(first));
|
assert_string_equals("James", p_contact_barejid(first));
|
||||||
assert_string_equals("Dave", p_contact_jid(second));
|
assert_string_equals("Dave", p_contact_barejid(second));
|
||||||
assert_string_equals("Bob", p_contact_jid(third));
|
assert_string_equals("Bob", p_contact_barejid(third));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_twice_in_middle_adds_once(void)
|
static void add_twice_in_middle_adds_once(void)
|
||||||
@ -121,9 +121,9 @@ static void add_twice_in_middle_adds_once(void)
|
|||||||
PContact third = (g_slist_next(g_slist_next(list)))->data;
|
PContact third = (g_slist_next(g_slist_next(list)))->data;
|
||||||
|
|
||||||
assert_int_equals(3, g_slist_length(list));
|
assert_int_equals(3, g_slist_length(list));
|
||||||
assert_string_equals("James", p_contact_jid(first));
|
assert_string_equals("James", p_contact_barejid(first));
|
||||||
assert_string_equals("Dave", p_contact_jid(second));
|
assert_string_equals("Dave", p_contact_barejid(second));
|
||||||
assert_string_equals("Bob", p_contact_jid(third));
|
assert_string_equals("Bob", p_contact_barejid(third));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_twice_at_end_adds_once(void)
|
static void add_twice_at_end_adds_once(void)
|
||||||
@ -138,9 +138,9 @@ static void add_twice_at_end_adds_once(void)
|
|||||||
PContact third = (g_slist_next(g_slist_next(list)))->data;
|
PContact third = (g_slist_next(g_slist_next(list)))->data;
|
||||||
|
|
||||||
assert_int_equals(3, g_slist_length(list));
|
assert_int_equals(3, g_slist_length(list));
|
||||||
assert_string_equals("James", p_contact_jid(first));
|
assert_string_equals("James", p_contact_barejid(first));
|
||||||
assert_string_equals("Dave", p_contact_jid(second));
|
assert_string_equals("Dave", p_contact_barejid(second));
|
||||||
assert_string_equals("Bob", p_contact_jid(third));
|
assert_string_equals("Bob", p_contact_barejid(third));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_show_when_value(void)
|
static void test_show_when_value(void)
|
||||||
@ -196,7 +196,7 @@ static void update_show(void)
|
|||||||
|
|
||||||
assert_int_equals(1, g_slist_length(list));
|
assert_int_equals(1, g_slist_length(list));
|
||||||
PContact first = list->data;
|
PContact first = list->data;
|
||||||
assert_string_equals("James", p_contact_jid(first));
|
assert_string_equals("James", p_contact_barejid(first));
|
||||||
assert_string_equals("dnd", p_contact_presence(first));
|
assert_string_equals("dnd", p_contact_presence(first));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ static void set_show_to_null(void)
|
|||||||
|
|
||||||
assert_int_equals(1, g_slist_length(list));
|
assert_int_equals(1, g_slist_length(list));
|
||||||
PContact james = list->data;
|
PContact james = list->data;
|
||||||
assert_string_equals("James", p_contact_jid(james));
|
assert_string_equals("James", p_contact_barejid(james));
|
||||||
assert_is_null(p_contact_presence(james));
|
assert_is_null(p_contact_presence(james));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ static void update_status(void)
|
|||||||
|
|
||||||
assert_int_equals(1, g_slist_length(list));
|
assert_int_equals(1, g_slist_length(list));
|
||||||
PContact james = list->data;
|
PContact james = list->data;
|
||||||
assert_string_equals("James", p_contact_jid(james));
|
assert_string_equals("James", p_contact_barejid(james));
|
||||||
assert_string_equals("Gone to lunch", p_contact_status(james));
|
assert_string_equals("Gone to lunch", p_contact_status(james));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ static void set_status_to_null(void)
|
|||||||
|
|
||||||
assert_int_equals(1, g_slist_length(list));
|
assert_int_equals(1, g_slist_length(list));
|
||||||
PContact james = list->data;
|
PContact james = list->data;
|
||||||
assert_string_equals("James", p_contact_jid(james));
|
assert_string_equals("James", p_contact_barejid(james));
|
||||||
assert_is_null(p_contact_status(james));
|
assert_is_null(p_contact_status(james));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user