void contact_string_when_default_resource(void **state) { PContact contact = p_contact_new("*****@*****.**", "bob", NULL, "both", "is offline", FALSE); char *str = p_contact_create_display_string(contact, "__prof_default"); assert_string_equal("bob", str); p_contact_free(contact); free(str); }
void chatwin_contact_offline(ProfChatWin *chatwin, char *resource, char *status) { assert(chatwin != NULL); PContact contact = roster_get_contact(chatwin->barejid); char *display_str = p_contact_create_display_string(contact, resource); win_show_status_string((ProfWin*)chatwin, display_str, "offline", status, NULL, "--", "offline"); free(display_str); }
void contact_string_when_name_not_exists(void **state) { PContact contact = p_contact_new("*****@*****.**", NULL, NULL, "both", "is offline", FALSE); char *str = p_contact_create_display_string(contact, "laptop"); assert_string_equal("[email protected] (laptop)", str); p_contact_free(contact); free(str); }
void chatwin_contact_online(ProfChatWin *chatwin, Resource *resource, GDateTime *last_activity) { assert(chatwin != NULL); const char *show = string_from_resource_presence(resource->presence); PContact contact = roster_get_contact(chatwin->barejid); char *display_str = p_contact_create_display_string(contact, resource->name); win_show_status_string((ProfWin*)chatwin, display_str, show, resource->status, last_activity, "++", "online"); free(display_str); }