mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Tidied muc module
This commit is contained in:
parent
41b49cb5d6
commit
d25d6b4502
@ -1356,7 +1356,7 @@ void
|
||||
cmd_reset_autocomplete()
|
||||
{
|
||||
roster_reset_search_attempts();
|
||||
muc_reset_invites_ac();
|
||||
muc_invites_reset_ac();
|
||||
accounts_reset_all_search();
|
||||
accounts_reset_enabled_search();
|
||||
prefs_reset_boolean_choice();
|
||||
@ -1370,7 +1370,7 @@ cmd_reset_autocomplete()
|
||||
|
||||
if (ui_current_win_type() == WIN_MUC) {
|
||||
char *recipient = ui_current_recipient();
|
||||
muc_reset_autocomplete(recipient);
|
||||
muc_autocomplete_reset(recipient);
|
||||
}
|
||||
|
||||
autocomplete_reset(who_ac);
|
||||
@ -1605,7 +1605,7 @@ _cmd_complete_parameters(char *input, int *size)
|
||||
// autocomplete nickname in chat rooms
|
||||
if (ui_current_win_type() == WIN_MUC) {
|
||||
char *recipient = ui_current_recipient();
|
||||
Autocomplete nick_ac = muc_get_roster_ac(recipient);
|
||||
Autocomplete nick_ac = muc_roster_ac(recipient);
|
||||
if (nick_ac != NULL) {
|
||||
gchar *nick_choices[] = { "/msg", "/info", "/caps", "/status", "/software" } ;
|
||||
|
||||
@ -1655,7 +1655,7 @@ _cmd_complete_parameters(char *input, int *size)
|
||||
gchar *invite_choices[] = { "/decline", "/join" };
|
||||
for (i = 0; i < ARRAY_SIZE(invite_choices); i++) {
|
||||
result = autocomplete_param_with_func(input, size, invite_choices[i],
|
||||
muc_find_invite);
|
||||
muc_invites_find);
|
||||
if (result != NULL) {
|
||||
ui_replace_input(input, result, size);
|
||||
g_free(result);
|
||||
|
@ -476,7 +476,7 @@ cmd_disconnect(gchar **args, struct cmd_help_t help)
|
||||
cons_show("%s logged out successfully.", jid);
|
||||
jabber_disconnect();
|
||||
roster_clear();
|
||||
muc_clear_invites();
|
||||
muc_invites_clear();
|
||||
chat_sessions_clear();
|
||||
ui_disconnected();
|
||||
free(jid);
|
||||
@ -726,7 +726,7 @@ static void
|
||||
_who_room(const char * const presence)
|
||||
{
|
||||
char *room = ui_current_recipient();
|
||||
GList *list = muc_get_roster(room);
|
||||
GList *list = muc_roster(room);
|
||||
|
||||
// no arg, show all contacts
|
||||
if ((presence == NULL) || (g_strcmp0(presence, "any") == 0)) {
|
||||
@ -1048,7 +1048,7 @@ cmd_msg(gchar **args, struct cmd_help_t help)
|
||||
|
||||
if (win_type == WIN_MUC) {
|
||||
char *room_name = ui_current_recipient();
|
||||
if (muc_nick_in_roster(room_name, usr)) {
|
||||
if (muc_roster_contains_nick(room_name, usr)) {
|
||||
GString *full_jid = g_string_new(room_name);
|
||||
g_string_append(full_jid, "/");
|
||||
g_string_append(full_jid, usr);
|
||||
@ -1533,7 +1533,7 @@ cmd_caps(gchar **args, struct cmd_help_t help)
|
||||
case WIN_MUC:
|
||||
if (args[0] != NULL) {
|
||||
char *room = ui_current_recipient();
|
||||
pcontact = muc_get_participant(room, args[0]);
|
||||
pcontact = muc_roster_item(room, args[0]);
|
||||
if (pcontact != NULL) {
|
||||
Jid *jidp = jid_create_from_bare_and_resource(room, args[0]);
|
||||
Resource *resource = p_contact_get_resource(pcontact, args[0]);
|
||||
@ -1578,7 +1578,7 @@ cmd_caps(gchar **args, struct cmd_help_t help)
|
||||
char *recipient = ui_current_recipient();
|
||||
Jid *jid = jid_create(recipient);
|
||||
if (jid) {
|
||||
pcontact = muc_get_participant(jid->barejid, jid->resourcepart);
|
||||
pcontact = muc_roster_item(jid->barejid, jid->resourcepart);
|
||||
Resource *resource = p_contact_get_resource(pcontact, jid->resourcepart);
|
||||
cons_show_caps(jid->resourcepart, resource);
|
||||
jid_destroy(jid);
|
||||
@ -1611,7 +1611,7 @@ cmd_software(gchar **args, struct cmd_help_t help)
|
||||
case WIN_MUC:
|
||||
if (args[0] != NULL) {
|
||||
recipient = ui_current_recipient();
|
||||
pcontact = muc_get_participant(recipient, args[0]);
|
||||
pcontact = muc_roster_item(recipient, args[0]);
|
||||
if (pcontact != NULL) {
|
||||
Jid *jid = jid_create_from_bare_and_resource(recipient, args[0]);
|
||||
iq_send_software_version(jid->fulljid);
|
||||
@ -1715,10 +1715,10 @@ cmd_join(gchar **args, struct cmd_help_t help)
|
||||
nick = account->muc_nick;
|
||||
}
|
||||
|
||||
if (!muc_room_is_active(room)) {
|
||||
if (!muc_active(room)) {
|
||||
presence_join_room(room, nick, passwd);
|
||||
muc_join_room(room, nick, passwd, FALSE);
|
||||
} else if (muc_get_roster_received(room)) {
|
||||
muc_join(room, nick, passwd, FALSE);
|
||||
} else if (muc_roster_complete(room)) {
|
||||
ui_room_join(room, TRUE);
|
||||
}
|
||||
|
||||
@ -1767,7 +1767,7 @@ cmd_invite(gchar **args, struct cmd_help_t help)
|
||||
gboolean
|
||||
cmd_invites(gchar **args, struct cmd_help_t help)
|
||||
{
|
||||
GSList *invites = muc_get_invites();
|
||||
GSList *invites = muc_invites();
|
||||
cons_show_room_invites(invites);
|
||||
g_slist_free_full(invites, g_free);
|
||||
return TRUE;
|
||||
@ -1776,10 +1776,10 @@ cmd_invites(gchar **args, struct cmd_help_t help)
|
||||
gboolean
|
||||
cmd_decline(gchar **args, struct cmd_help_t help)
|
||||
{
|
||||
if (!muc_invites_include(args[0])) {
|
||||
if (!muc_invites_contain(args[0])) {
|
||||
cons_show("No such invite exists.");
|
||||
} else {
|
||||
muc_remove_invite(args[0]);
|
||||
muc_invites_remove(args[0]);
|
||||
cons_show("Declined invite to %s.", args[0]);
|
||||
}
|
||||
|
||||
@ -2099,8 +2099,8 @@ cmd_room(gchar **args, struct cmd_help_t help)
|
||||
}
|
||||
|
||||
if (g_strcmp0(args[0], "info") == 0) {
|
||||
char *role = muc_get_role_str(room);
|
||||
char *affiliation = muc_get_affiliation_str(room);
|
||||
char *role = muc_role_str(room);
|
||||
char *affiliation = muc_affiliation_str(room);
|
||||
ui_current_print_line("Affiliation: %s, Role: %s", affiliation, role);
|
||||
return TRUE;
|
||||
}
|
||||
@ -2179,8 +2179,8 @@ cmd_bookmark(gchar **args, struct cmd_help_t help)
|
||||
// default to current nickname, password, and autojoin "on"
|
||||
if (cmd == NULL) {
|
||||
char *jid = ui_current_recipient();
|
||||
char *nick = muc_get_room_nick(jid);
|
||||
char *password = muc_get_room_password(jid);
|
||||
char *nick = muc_nick(jid);
|
||||
char *password = muc_password(jid);
|
||||
gboolean added = bookmark_add(jid, nick, password, "on");
|
||||
if (added) {
|
||||
ui_current_print_formatted_line('!', 0, "Bookmark added for %s.", jid);
|
||||
|
72
src/muc.c
72
src/muc.c
@ -102,31 +102,31 @@ muc_close(void)
|
||||
}
|
||||
|
||||
void
|
||||
muc_add_invite(char *room)
|
||||
muc_invites_add(char *room)
|
||||
{
|
||||
autocomplete_add(invite_ac, room);
|
||||
}
|
||||
|
||||
void
|
||||
muc_remove_invite(char *room)
|
||||
muc_invites_remove(char *room)
|
||||
{
|
||||
autocomplete_remove(invite_ac, room);
|
||||
}
|
||||
|
||||
gint
|
||||
muc_invite_count(void)
|
||||
muc_invites_count(void)
|
||||
{
|
||||
return autocomplete_length(invite_ac);
|
||||
}
|
||||
|
||||
GSList *
|
||||
muc_get_invites(void)
|
||||
muc_invites(void)
|
||||
{
|
||||
return autocomplete_create_list(invite_ac);
|
||||
}
|
||||
|
||||
gboolean
|
||||
muc_invites_include(const char * const room)
|
||||
muc_invites_contain(const char * const room)
|
||||
{
|
||||
GSList *invites = autocomplete_create_list(invite_ac);
|
||||
GSList *curr = invites;
|
||||
@ -144,25 +144,25 @@ muc_invites_include(const char * const room)
|
||||
}
|
||||
|
||||
void
|
||||
muc_reset_invites_ac(void)
|
||||
muc_invites_reset_ac(void)
|
||||
{
|
||||
autocomplete_reset(invite_ac);
|
||||
}
|
||||
|
||||
char *
|
||||
muc_find_invite(char *search_str)
|
||||
muc_invites_find(char *search_str)
|
||||
{
|
||||
return autocomplete_complete(invite_ac, search_str, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
muc_clear_invites(void)
|
||||
muc_invites_clear(void)
|
||||
{
|
||||
autocomplete_clear(invite_ac);
|
||||
}
|
||||
|
||||
void
|
||||
muc_join_room(const char * const room, const char * const nick,
|
||||
muc_join(const char * const room, const char * const nick,
|
||||
const char * const password, gboolean autojoin)
|
||||
{
|
||||
ChatRoom *new_room = malloc(sizeof(ChatRoom));
|
||||
@ -192,7 +192,7 @@ muc_join_room(const char * const room, const char * const nick,
|
||||
}
|
||||
|
||||
void
|
||||
muc_leave_room(const char * const room)
|
||||
muc_leave(const char * const room)
|
||||
{
|
||||
g_hash_table_remove(rooms, room);
|
||||
}
|
||||
@ -222,14 +222,14 @@ muc_set_requires_config(const char * const room, gboolean val)
|
||||
* Returns TRUE if the user is currently in the room
|
||||
*/
|
||||
gboolean
|
||||
muc_room_is_active(const char * const room)
|
||||
muc_active(const char * const room)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
return (chat_room != NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
muc_room_is_autojoin(const char * const room)
|
||||
muc_autojoin(const char * const room)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room) {
|
||||
@ -250,7 +250,7 @@ muc_set_subject(const char * const room, const char * const subject)
|
||||
}
|
||||
|
||||
char *
|
||||
muc_get_subject(const char * const room)
|
||||
muc_subject(const char * const room)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room) {
|
||||
@ -261,7 +261,7 @@ muc_get_subject(const char * const room)
|
||||
}
|
||||
|
||||
void
|
||||
muc_add_pending_broadcast(const char * const room, const char * const message)
|
||||
muc_pending_broadcasts_add(const char * const room, const char * const message)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room) {
|
||||
@ -270,7 +270,7 @@ muc_add_pending_broadcast(const char * const room, const char * const message)
|
||||
}
|
||||
|
||||
GList *
|
||||
muc_get_pending_broadcasts(const char * const room)
|
||||
muc_pending_broadcasts(const char * const room)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room) {
|
||||
@ -281,7 +281,7 @@ muc_get_pending_broadcasts(const char * const room)
|
||||
}
|
||||
|
||||
char *
|
||||
muc_get_old_nick(const char * const room, const char * const new_nick)
|
||||
muc_old_nick(const char * const room, const char * const new_nick)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room && chat_room->pending_nick_change) {
|
||||
@ -296,7 +296,7 @@ muc_get_old_nick(const char * const room, const char * const new_nick)
|
||||
* and is awaiting the response
|
||||
*/
|
||||
void
|
||||
muc_set_room_pending_nick_change(const char * const room, const char * const new_nick)
|
||||
muc_nick_change_start(const char * const room, const char * const new_nick)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room) {
|
||||
@ -310,7 +310,7 @@ muc_set_room_pending_nick_change(const char * const room, const char * const new
|
||||
* nick change
|
||||
*/
|
||||
gboolean
|
||||
muc_is_room_pending_nick_change(const char * const room)
|
||||
muc_nick_change_pending(const char * const room)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room) {
|
||||
@ -325,7 +325,7 @@ muc_is_room_pending_nick_change(const char * const room)
|
||||
* the service has responded
|
||||
*/
|
||||
void
|
||||
muc_complete_room_nick_change(const char * const room, const char * const nick)
|
||||
muc_nick_change_complete(const char * const room, const char * const nick)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room) {
|
||||
@ -342,7 +342,7 @@ muc_complete_room_nick_change(const char * const room, const char * const nick)
|
||||
* modified or freed.
|
||||
*/
|
||||
GList *
|
||||
muc_get_active_room_list(void)
|
||||
muc_rooms(void)
|
||||
{
|
||||
return g_hash_table_get_keys(rooms);
|
||||
}
|
||||
@ -352,7 +352,7 @@ muc_get_active_room_list(void)
|
||||
* The nickname is owned by the chat room and should not be modified or freed
|
||||
*/
|
||||
char *
|
||||
muc_get_room_nick(const char * const room)
|
||||
muc_nick(const char * const room)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room) {
|
||||
@ -367,7 +367,7 @@ muc_get_room_nick(const char * const room)
|
||||
* The password is owned by the chat room and should not be modified or freed
|
||||
*/
|
||||
char *
|
||||
muc_get_room_password(const char * const room)
|
||||
muc_password(const char * const room)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room) {
|
||||
@ -381,7 +381,7 @@ muc_get_room_password(const char * const room)
|
||||
* Returns TRUE if the specified nick exists in the room's roster
|
||||
*/
|
||||
gboolean
|
||||
muc_nick_in_roster(const char * const room, const char * const nick)
|
||||
muc_roster_contains_nick(const char * const room, const char * const nick)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room) {
|
||||
@ -396,7 +396,7 @@ muc_nick_in_roster(const char * const room, const char * const nick)
|
||||
* Add a new chat room member to the room's roster
|
||||
*/
|
||||
gboolean
|
||||
muc_add_to_roster(const char * const room, const char * const nick,
|
||||
muc_roster_add(const char * const room, const char * const nick,
|
||||
const char * const show, const char * const status)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
@ -427,7 +427,7 @@ muc_add_to_roster(const char * const room, const char * const nick,
|
||||
* Remove a room member from the room's roster
|
||||
*/
|
||||
void
|
||||
muc_remove_from_roster(const char * const room, const char * const nick)
|
||||
muc_roster_remove(const char * const room, const char * const nick)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room) {
|
||||
@ -437,7 +437,7 @@ muc_remove_from_roster(const char * const room, const char * const nick)
|
||||
}
|
||||
|
||||
PContact
|
||||
muc_get_participant(const char * const room, const char * const nick)
|
||||
muc_roster_item(const char * const room, const char * const nick)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room) {
|
||||
@ -453,7 +453,7 @@ muc_get_participant(const char * const room, const char * const nick)
|
||||
* The list is owned by the room and must not be mofified or freed
|
||||
*/
|
||||
GList *
|
||||
muc_get_roster(const char * const room)
|
||||
muc_roster(const char * const room)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room) {
|
||||
@ -477,7 +477,7 @@ muc_get_roster(const char * const room)
|
||||
* Return a Autocomplete representing the room member's in the roster
|
||||
*/
|
||||
Autocomplete
|
||||
muc_get_roster_ac(const char * const room)
|
||||
muc_roster_ac(const char * const room)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room) {
|
||||
@ -491,7 +491,7 @@ muc_get_roster_ac(const char * const room)
|
||||
* Set to TRUE when the rooms roster has been fully received
|
||||
*/
|
||||
void
|
||||
muc_set_roster_received(const char * const room)
|
||||
muc_roster_set_complete(const char * const room)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room) {
|
||||
@ -503,7 +503,7 @@ muc_set_roster_received(const char * const room)
|
||||
* Returns TRUE id the rooms roster has been fully received
|
||||
*/
|
||||
gboolean
|
||||
muc_get_roster_received(const char * const room)
|
||||
muc_roster_complete(const char * const room)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room) {
|
||||
@ -518,13 +518,13 @@ muc_get_roster_received(const char * const room)
|
||||
* is in progress
|
||||
*/
|
||||
void
|
||||
muc_set_roster_pending_nick_change(const char * const room,
|
||||
muc_roster_nick_change_start(const char * const room,
|
||||
const char * const new_nick, const char * const old_nick)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room) {
|
||||
g_hash_table_insert(chat_room->nick_changes, strdup(new_nick), strdup(old_nick));
|
||||
muc_remove_from_roster(room, old_nick);
|
||||
muc_roster_remove(room, old_nick);
|
||||
}
|
||||
}
|
||||
|
||||
@ -535,7 +535,7 @@ muc_set_roster_pending_nick_change(const char * const room,
|
||||
* the caller
|
||||
*/
|
||||
char *
|
||||
muc_complete_roster_nick_change(const char * const room,
|
||||
muc_roster_nick_change_complete(const char * const room,
|
||||
const char * const nick)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
@ -590,7 +590,7 @@ muc_autocomplete(char *input, int *size)
|
||||
}
|
||||
|
||||
void
|
||||
muc_reset_autocomplete(const char * const room)
|
||||
muc_autocomplete_reset(const char * const room)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room) {
|
||||
@ -606,7 +606,7 @@ muc_reset_autocomplete(const char * const room)
|
||||
}
|
||||
|
||||
char *
|
||||
muc_get_role_str(const char * const room)
|
||||
muc_role_str(const char * const room)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room) {
|
||||
@ -626,7 +626,7 @@ muc_set_role(const char * const room, const char * const role)
|
||||
}
|
||||
|
||||
char *
|
||||
muc_get_affiliation_str(const char * const room)
|
||||
muc_affiliation_str(const char * const room)
|
||||
{
|
||||
ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
|
||||
if (chat_room) {
|
||||
|
81
src/muc.h
81
src/muc.h
@ -43,59 +43,60 @@
|
||||
|
||||
void muc_init(void);
|
||||
void muc_close(void);
|
||||
void muc_join_room(const char * const room, const char * const nick,
|
||||
const char * const password, gboolean autojoin);
|
||||
void muc_leave_room(const char * const room);
|
||||
gboolean muc_room_is_active(const char * const room);
|
||||
gboolean muc_room_is_autojoin(const char * const room);
|
||||
GList* muc_get_active_room_list(void);
|
||||
char* muc_get_room_nick(const char * const room);
|
||||
char* muc_get_room_password(const char * const room);
|
||||
|
||||
void muc_set_room_pending_nick_change(const char * const room, const char * const new_nick);
|
||||
gboolean muc_is_room_pending_nick_change(const char * const room);
|
||||
void muc_complete_room_nick_change(const char * const room,
|
||||
const char * const nick);
|
||||
char * muc_get_old_nick(const char * const room, const char * const new_nick);
|
||||
void muc_join(const char * const room, const char * const nick, const char * const password, gboolean autojoin);
|
||||
void muc_leave(const char * const room);
|
||||
|
||||
gboolean muc_add_to_roster(const char * const room, const char * const nick,
|
||||
const char * const show, const char * const status);
|
||||
void muc_remove_from_roster(const char * const room, const char * const nick);
|
||||
GList * muc_get_roster(const char * const room);
|
||||
Autocomplete muc_get_roster_ac(const char * const room);
|
||||
gboolean muc_nick_in_roster(const char * const room, const char * const nick);
|
||||
PContact muc_get_participant(const char * const room, const char * const nick);
|
||||
void muc_set_roster_received(const char * const room);
|
||||
gboolean muc_get_roster_received(const char * const room);
|
||||
gboolean muc_active(const char * const room);
|
||||
gboolean muc_autojoin(const char * const room);
|
||||
|
||||
void muc_set_roster_pending_nick_change(const char * const room,
|
||||
const char * const new_nick, const char * const old_nick);
|
||||
char* muc_complete_roster_nick_change(const char * const room,
|
||||
const char * const nick);
|
||||
GList* muc_rooms(void);
|
||||
|
||||
void muc_add_invite(const char *room);
|
||||
void muc_remove_invite(const char * const room);
|
||||
gint muc_invite_count(void);
|
||||
GSList* muc_get_invites(void);
|
||||
gboolean muc_invites_include(const char * const room);
|
||||
void muc_reset_invites_ac(void);
|
||||
char* muc_find_invite(char *search_str);
|
||||
void muc_clear_invites(void);
|
||||
char* muc_nick(const char * const room);
|
||||
char* muc_password(const char * const room);
|
||||
|
||||
void muc_nick_change_start(const char * const room, const char * const new_nick);
|
||||
void muc_nick_change_complete(const char * const room, const char * const nick);
|
||||
gboolean muc_nick_change_pending(const char * const room);
|
||||
char* muc_old_nick(const char * const room, const char * const new_nick);
|
||||
|
||||
gboolean muc_roster_contains_nick(const char * const room, const char * const nick);
|
||||
gboolean muc_roster_complete(const char * const room);
|
||||
gboolean muc_roster_add(const char * const room, const char * const nick, const char * const show,
|
||||
const char * const status);
|
||||
void muc_roster_remove(const char * const room, const char * const nick);
|
||||
void muc_roster_set_complete(const char * const room);
|
||||
GList * muc_roster(const char * const room);
|
||||
Autocomplete muc_roster_ac(const char * const room);
|
||||
PContact muc_roster_item(const char * const room, const char * const nick);
|
||||
|
||||
void muc_roster_nick_change_start(const char * const room, const char * const new_nick, const char * const old_nick);
|
||||
char* muc_roster_nick_change_complete(const char * const room, const char * const nick);
|
||||
|
||||
void muc_invites_add(const char *room);
|
||||
void muc_invites_remove(const char * const room);
|
||||
gint muc_invites_count(void);
|
||||
GSList* muc_invites(void);
|
||||
gboolean muc_invites_contain(const char * const room);
|
||||
void muc_invites_reset_ac(void);
|
||||
char* muc_invites_find(char *search_str);
|
||||
void muc_invites_clear(void);
|
||||
|
||||
void muc_set_subject(const char * const room, const char * const subject);
|
||||
char * muc_get_subject(const char * const room);
|
||||
void muc_add_pending_broadcast(const char * const room, const char * const message);
|
||||
GList * muc_get_pending_broadcasts(const char * const room);
|
||||
char* muc_subject(const char * const room);
|
||||
|
||||
void muc_pending_broadcasts_add(const char * const room, const char * const message);
|
||||
GList * muc_pending_broadcasts(const char * const room);
|
||||
|
||||
void muc_autocomplete(char *input, int *size);
|
||||
void muc_reset_autocomplete(const char * const room);
|
||||
void muc_autocomplete_reset(const char * const room);
|
||||
|
||||
gboolean muc_requires_config(const char * const room);
|
||||
void muc_set_requires_config(const char * const room, gboolean val);
|
||||
|
||||
void muc_set_role(const char * const room, const char * const role);
|
||||
void muc_set_affiliation(const char * const room, const char * const affiliation);
|
||||
char *muc_get_role_str(const char * const room);
|
||||
char *muc_get_affiliation_str(const char * const room);
|
||||
char *muc_role_str(const char * const room);
|
||||
char *muc_affiliation_str(const char * const room);
|
||||
|
||||
#endif
|
||||
|
@ -54,8 +54,8 @@
|
||||
void
|
||||
handle_room_join_error(const char * const room, const char * const err)
|
||||
{
|
||||
if (muc_room_is_active(room)) {
|
||||
muc_leave_room(room);
|
||||
if (muc_active(room)) {
|
||||
muc_leave(room);
|
||||
}
|
||||
ui_handle_room_join_error(room, err);
|
||||
}
|
||||
@ -109,11 +109,11 @@ handle_login_account_success(char *account_name)
|
||||
ui_handle_login_account_success(account);
|
||||
|
||||
// attempt to rejoin rooms with passwords
|
||||
GList *curr = muc_get_active_room_list();
|
||||
GList *curr = muc_rooms();
|
||||
while (curr != NULL) {
|
||||
char *password = muc_get_room_password(curr->data);
|
||||
char *password = muc_password(curr->data);
|
||||
if (password != NULL) {
|
||||
char *nick = muc_get_room_nick(curr->data);
|
||||
char *nick = muc_nick(curr->data);
|
||||
presence_join_room(curr->data, nick, password);
|
||||
}
|
||||
curr = g_list_next(curr);
|
||||
@ -129,7 +129,7 @@ handle_lost_connection(void)
|
||||
{
|
||||
cons_show_error("Lost connection.");
|
||||
roster_clear();
|
||||
muc_clear_invites();
|
||||
muc_invites_clear();
|
||||
chat_sessions_clear();
|
||||
ui_disconnected();
|
||||
}
|
||||
@ -181,9 +181,9 @@ handle_room_invite(jabber_invite_t invite_type,
|
||||
const char * const invitor, const char * const room,
|
||||
const char * const reason)
|
||||
{
|
||||
if (!muc_room_is_active(room) && !muc_invites_include(room)) {
|
||||
if (!muc_active(room) && !muc_invites_contain(room)) {
|
||||
cons_show_room_invite(invitor, room, reason);
|
||||
muc_add_invite(room);
|
||||
muc_invites_add(room);
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,10 +191,10 @@ void
|
||||
handle_room_broadcast(const char *const room_jid,
|
||||
const char * const message)
|
||||
{
|
||||
if (muc_get_roster_received(room_jid)) {
|
||||
if (muc_roster_complete(room_jid)) {
|
||||
ui_room_broadcast(room_jid, message);
|
||||
} else {
|
||||
muc_add_pending_broadcast(room_jid, message);
|
||||
muc_pending_broadcasts_add(room_jid, message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ void
|
||||
handle_room_subject(const char * const room_jid, const char * const subject)
|
||||
{
|
||||
muc_set_subject(room_jid, subject);
|
||||
if (muc_get_roster_received(room_jid)) {
|
||||
if (muc_roster_complete(room_jid)) {
|
||||
ui_room_subject(room_jid, subject);
|
||||
}
|
||||
}
|
||||
@ -449,14 +449,14 @@ handle_contact_online(char *barejid, Resource *resource,
|
||||
void
|
||||
handle_leave_room(const char * const room)
|
||||
{
|
||||
muc_leave_room(room);
|
||||
muc_leave(room);
|
||||
}
|
||||
|
||||
void
|
||||
handle_room_nick_change(const char * const room,
|
||||
const char * const nick)
|
||||
{
|
||||
muc_complete_room_nick_change(room, nick);
|
||||
muc_nick_change_complete(room, nick);
|
||||
ui_room_nick_change(room, nick);
|
||||
}
|
||||
|
||||
@ -470,7 +470,7 @@ handle_room_requires_config(const char * const room)
|
||||
void
|
||||
handle_room_destroy(const char * const room)
|
||||
{
|
||||
muc_leave_room(room);
|
||||
muc_leave(room);
|
||||
ui_room_destroyed(room);
|
||||
}
|
||||
|
||||
@ -501,22 +501,22 @@ handle_room_config_submit_result_error(const char * const room, const char * con
|
||||
void
|
||||
handle_room_roster_complete(const char * const room)
|
||||
{
|
||||
if (muc_room_is_autojoin(room)) {
|
||||
if (muc_autojoin(room)) {
|
||||
ui_room_join(room, FALSE);
|
||||
} else {
|
||||
ui_room_join(room, TRUE);
|
||||
}
|
||||
muc_remove_invite(room);
|
||||
muc_set_roster_received(room);
|
||||
GList *roster = muc_get_roster(room);
|
||||
muc_invites_remove(room);
|
||||
muc_roster_set_complete(room);
|
||||
GList *roster = muc_roster(room);
|
||||
ui_room_roster(room, roster, NULL);
|
||||
|
||||
char *subject = muc_get_subject(room);
|
||||
char *subject = muc_subject(room);
|
||||
if (subject != NULL) {
|
||||
ui_room_subject(room, subject);
|
||||
}
|
||||
|
||||
GList *pending_broadcasts = muc_get_pending_broadcasts(room);
|
||||
GList *pending_broadcasts = muc_pending_broadcasts(room);
|
||||
if (pending_broadcasts != NULL) {
|
||||
GList *curr = pending_broadcasts;
|
||||
while (curr != NULL) {
|
||||
@ -531,7 +531,7 @@ handle_room_member_presence(const char * const room,
|
||||
const char * const nick, const char * const show,
|
||||
const char * const status)
|
||||
{
|
||||
gboolean updated = muc_add_to_roster(room, nick, show, status);
|
||||
gboolean updated = muc_roster_add(room, nick, show, status);
|
||||
|
||||
if (updated) {
|
||||
char *muc_status_pref = prefs_get_string(PREF_STATUSES_MUC);
|
||||
@ -546,7 +546,7 @@ void
|
||||
handle_room_member_online(const char * const room, const char * const nick,
|
||||
const char * const show, const char * const status)
|
||||
{
|
||||
muc_add_to_roster(room, nick, show, status);
|
||||
muc_roster_add(room, nick, show, status);
|
||||
|
||||
char *muc_status_pref = prefs_get_string(PREF_STATUSES_MUC);
|
||||
if (g_strcmp0(muc_status_pref, "none") != 0) {
|
||||
@ -559,7 +559,7 @@ void
|
||||
handle_room_member_offline(const char * const room, const char * const nick,
|
||||
const char * const show, const char * const status)
|
||||
{
|
||||
muc_remove_from_roster(room, nick);
|
||||
muc_roster_remove(room, nick);
|
||||
|
||||
char *muc_status_pref = prefs_get_string(PREF_STATUSES_MUC);
|
||||
if (g_strcmp0(muc_status_pref, "none") != 0) {
|
||||
|
@ -454,7 +454,7 @@ _cons_show_bookmarks(const GList *list)
|
||||
|
||||
int presence_colour = 0;
|
||||
|
||||
if (muc_room_is_active(item->jid)) {
|
||||
if (muc_active(item->jid)) {
|
||||
presence_colour = COLOUR_ONLINE;
|
||||
}
|
||||
win_save_vprint(console, '-', NULL, NO_EOL, presence_colour, "", " %s", item->jid);
|
||||
@ -467,7 +467,7 @@ _cons_show_bookmarks(const GList *list)
|
||||
if (item->password != NULL) {
|
||||
win_save_print(console, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " (private)");
|
||||
}
|
||||
if (muc_room_is_active(item->jid)) {
|
||||
if (muc_active(item->jid)) {
|
||||
ProfWin *roomwin = wins_get_by_recipient(item->jid);
|
||||
if (roomwin != NULL) {
|
||||
int num = wins_get_num(roomwin);
|
||||
|
@ -1207,7 +1207,7 @@ _ui_new_chat_win(const char * const to)
|
||||
if (window == NULL) {
|
||||
Jid *jid = jid_create(to);
|
||||
|
||||
if (muc_room_is_active(jid->barejid)) {
|
||||
if (muc_active(jid->barejid)) {
|
||||
window = wins_new(to, WIN_PRIVATE);
|
||||
} else {
|
||||
window = wins_new(to, WIN_CHAT);
|
||||
@ -1324,7 +1324,7 @@ _ui_outgoing_msg(const char * const from, const char * const to,
|
||||
if (window == NULL) {
|
||||
Jid *jid = jid_create(to);
|
||||
|
||||
if (muc_room_is_active(jid->barejid)) {
|
||||
if (muc_active(jid->barejid)) {
|
||||
window = wins_new(to, WIN_PRIVATE);
|
||||
} else {
|
||||
window = wins_new(to, WIN_CHAT);
|
||||
@ -1377,7 +1377,7 @@ _ui_room_join(const char * const room, gboolean focus)
|
||||
} else {
|
||||
status_bar_active(num);
|
||||
ProfWin *console = wins_get_console();
|
||||
char *nick = muc_get_room_nick(room);
|
||||
char *nick = muc_nick(room);
|
||||
win_save_vprint(console, '!', NULL, 0, COLOUR_TYPING, "", "-> Autojoined %s as %s (%d).", room, nick, num);
|
||||
}
|
||||
}
|
||||
@ -1400,7 +1400,7 @@ _ui_room_roster(const char * const room, GList *roster, const char * const prese
|
||||
if (presence == NULL) {
|
||||
length++;
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "%d participants: ", length);
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ONLINE, "", "%s", muc_get_room_nick(room));
|
||||
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ONLINE, "", "%s", muc_nick(room));
|
||||
win_save_print(window, '!', NULL, NO_DATE | NO_EOL, 0, "", ", ");
|
||||
} else {
|
||||
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "%d %s: ", length, presence);
|
||||
@ -1531,7 +1531,7 @@ _ui_room_message(const char * const room_jid, const char * const nick,
|
||||
log_error("Room message received from %s, but no window open for %s", nick, room_jid);
|
||||
} else {
|
||||
int num = wins_get_num(window);
|
||||
char *my_nick = muc_get_room_nick(room_jid);
|
||||
char *my_nick = muc_nick(room_jid);
|
||||
|
||||
if (strcmp(nick, my_nick) != 0) {
|
||||
if (g_strrstr(message, my_nick) != NULL) {
|
||||
@ -1566,7 +1566,7 @@ _ui_room_message(const char * const room_jid, const char * const nick,
|
||||
ui_index = 0;
|
||||
}
|
||||
|
||||
if (strcmp(nick, muc_get_room_nick(room_jid)) != 0) {
|
||||
if (strcmp(nick, muc_nick(room_jid)) != 0) {
|
||||
if (prefs_get_boolean(PREF_BEEP)) {
|
||||
beep();
|
||||
}
|
||||
@ -1731,7 +1731,7 @@ static void
|
||||
_ui_status_private(void)
|
||||
{
|
||||
Jid *jid = jid_create(ui_current_recipient());
|
||||
PContact pcontact = muc_get_participant(jid->barejid, jid->resourcepart);
|
||||
PContact pcontact = muc_roster_item(jid->barejid, jid->resourcepart);
|
||||
ProfWin *window = wins_get_current();
|
||||
|
||||
if (pcontact != NULL) {
|
||||
@ -1747,7 +1747,7 @@ static void
|
||||
_ui_info_private(void)
|
||||
{
|
||||
Jid *jid = jid_create(ui_current_recipient());
|
||||
PContact pcontact = muc_get_participant(jid->barejid, jid->resourcepart);
|
||||
PContact pcontact = muc_roster_item(jid->barejid, jid->resourcepart);
|
||||
ProfWin *window = wins_get_current();
|
||||
|
||||
if (pcontact != NULL) {
|
||||
@ -1762,7 +1762,7 @@ _ui_info_private(void)
|
||||
static void
|
||||
_ui_status_room(const char * const contact)
|
||||
{
|
||||
PContact pcontact = muc_get_participant(ui_current_recipient(), contact);
|
||||
PContact pcontact = muc_roster_item(ui_current_recipient(), contact);
|
||||
ProfWin *current = wins_get_current();
|
||||
|
||||
if (pcontact != NULL) {
|
||||
@ -1775,7 +1775,7 @@ _ui_status_room(const char * const contact)
|
||||
static void
|
||||
_ui_info_room(const char * const contact)
|
||||
{
|
||||
PContact pcontact = muc_get_participant(ui_current_recipient(), contact);
|
||||
PContact pcontact = muc_roster_item(ui_current_recipient(), contact);
|
||||
ProfWin *current = wins_get_current();
|
||||
|
||||
if (pcontact != NULL) {
|
||||
|
@ -129,7 +129,7 @@ static void
|
||||
_notify_remind(void)
|
||||
{
|
||||
gint unread = ui_unread();
|
||||
gint open = muc_invite_count();
|
||||
gint open = muc_invites_count();
|
||||
gint subs = presence_sub_request_count();
|
||||
|
||||
GString *text = g_string_new("");
|
||||
|
@ -178,15 +178,15 @@ _bookmark_join(const char *jid)
|
||||
char *account_name = jabber_get_account_name();
|
||||
ProfAccount *account = accounts_get_account(account_name);
|
||||
Bookmark *item = found->data;
|
||||
if (!muc_room_is_active(item->jid)) {
|
||||
if (!muc_active(item->jid)) {
|
||||
char *nick = item->nick;
|
||||
if (nick == NULL) {
|
||||
nick = account->muc_nick;
|
||||
}
|
||||
presence_join_room(item->jid, nick, item->password);
|
||||
muc_join_room(item->jid, nick, item->password, FALSE);
|
||||
muc_join(item->jid, nick, item->password, FALSE);
|
||||
account_free(account);
|
||||
} else if (muc_get_roster_received(item->jid)) {
|
||||
} else if (muc_roster_complete(item->jid)) {
|
||||
ui_room_join(item->jid, TRUE);
|
||||
}
|
||||
return TRUE;
|
||||
@ -343,9 +343,9 @@ _bookmark_handle_result(xmpp_conn_t * const conn,
|
||||
|
||||
log_debug("Autojoin %s with nick=%s", jid, name);
|
||||
room_jid = jid_create_from_bare_and_resource(jid, name);
|
||||
if (!muc_room_is_active(room_jid->barejid)) {
|
||||
if (!muc_active(room_jid->barejid)) {
|
||||
presence_join_room(jid, name, password);
|
||||
muc_join_room(jid, name, password, TRUE);
|
||||
muc_join(jid, name, password, TRUE);
|
||||
}
|
||||
jid_destroy(room_jid);
|
||||
account_free(account);
|
||||
|
@ -495,8 +495,8 @@ _version_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
|
||||
|
||||
PContact contact;
|
||||
Jid *jidp = jid_create(jid);
|
||||
if (muc_room_is_active(jidp->barejid)) {
|
||||
contact = muc_get_participant(jidp->barejid, jidp->resourcepart);
|
||||
if (muc_active(jidp->barejid)) {
|
||||
contact = muc_roster_item(jidp->barejid, jidp->resourcepart);
|
||||
} else {
|
||||
contact = roster_get_contact(jidp->barejid);
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ _groupchat_handler(xmpp_conn_t * const conn,
|
||||
}
|
||||
|
||||
// room not active in profanity
|
||||
if (!muc_room_is_active(jid->barejid)) {
|
||||
if (!muc_active(jid->barejid)) {
|
||||
log_error("Message received for inactive chat room: %s", jid->str);
|
||||
jid_destroy(jid);
|
||||
return 1;
|
||||
@ -444,7 +444,7 @@ _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
|
||||
return 1;
|
||||
|
||||
// private message from chat room use full jid (room/nick)
|
||||
} else if (muc_room_is_active(jid->barejid)) {
|
||||
} else if (muc_active(jid->barejid)) {
|
||||
// determine if the notifications happened whilst offline
|
||||
GTimeVal tv_stamp;
|
||||
gboolean delayed = stanza_get_delay(stanza, &tv_stamp);
|
||||
|
@ -242,12 +242,12 @@ _presence_update(const resource_presence_t presence_type, const char * const msg
|
||||
static void
|
||||
_send_room_presence(xmpp_conn_t *conn, xmpp_stanza_t *presence)
|
||||
{
|
||||
GList *rooms_p = muc_get_active_room_list();
|
||||
GList *rooms_p = muc_rooms();
|
||||
GList *rooms = rooms_p;
|
||||
|
||||
while (rooms != NULL) {
|
||||
const char *room = rooms->data;
|
||||
const char *nick = muc_get_room_nick(room);
|
||||
const char *nick = muc_nick(room);
|
||||
|
||||
if (nick != NULL) {
|
||||
char *full_room_jid = create_fulljid(room, nick);
|
||||
@ -331,7 +331,7 @@ _presence_leave_chat_room(const char * const room_jid)
|
||||
log_debug("Sending room leave presence to: %s", room_jid);
|
||||
xmpp_ctx_t *ctx = connection_get_ctx();
|
||||
xmpp_conn_t *conn = connection_get_conn();
|
||||
char *nick = muc_get_room_nick(room_jid);
|
||||
char *nick = muc_nick(room_jid);
|
||||
|
||||
if (nick != NULL) {
|
||||
xmpp_stanza_t *presence = stanza_create_room_leave_presence(ctx, room_jid,
|
||||
@ -702,7 +702,7 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
|
||||
|
||||
// leave room if not self nick change
|
||||
if (new_nick != NULL) {
|
||||
muc_set_room_pending_nick_change(from_room, new_nick);
|
||||
muc_nick_change_start(from_room, new_nick);
|
||||
} else {
|
||||
handle_leave_room(from_room);
|
||||
}
|
||||
@ -711,11 +711,11 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
|
||||
} else {
|
||||
|
||||
// handle self nick change
|
||||
if (muc_is_room_pending_nick_change(from_room)) {
|
||||
if (muc_nick_change_pending(from_room)) {
|
||||
handle_room_nick_change(from_room, from_nick);
|
||||
|
||||
// handle roster complete
|
||||
} else if (!muc_get_roster_received(from_room)) {
|
||||
} else if (!muc_roster_complete(from_room)) {
|
||||
handle_room_roster_complete(from_room);
|
||||
|
||||
// room configuration required
|
||||
@ -752,7 +752,7 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
|
||||
if (stanza_is_room_nick_change(stanza)) {
|
||||
char *new_nick = stanza_get_new_nick(stanza);
|
||||
if (new_nick != NULL) {
|
||||
muc_set_roster_pending_nick_change(from_room, new_nick, from_nick);
|
||||
muc_roster_nick_change_start(from_room, new_nick, from_nick);
|
||||
free(new_nick);
|
||||
}
|
||||
} else {
|
||||
@ -766,17 +766,17 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
|
||||
}
|
||||
|
||||
char *show_str = stanza_get_show(stanza, "online");
|
||||
if (!muc_get_roster_received(from_room)) {
|
||||
muc_add_to_roster(from_room, from_nick, show_str, status_str);
|
||||
if (!muc_roster_complete(from_room)) {
|
||||
muc_roster_add(from_room, from_nick, show_str, status_str);
|
||||
} else {
|
||||
char *old_nick = muc_complete_roster_nick_change(from_room, from_nick);
|
||||
char *old_nick = muc_roster_nick_change_complete(from_room, from_nick);
|
||||
|
||||
if (old_nick != NULL) {
|
||||
muc_add_to_roster(from_room, from_nick, show_str, status_str);
|
||||
muc_roster_add(from_room, from_nick, show_str, status_str);
|
||||
handle_room_member_nick_change(from_room, old_nick, from_nick);
|
||||
free(old_nick);
|
||||
} else {
|
||||
if (!muc_nick_in_roster(from_room, from_nick)) {
|
||||
if (!muc_roster_contains_nick(from_room, from_nick)) {
|
||||
handle_room_member_online(from_room, from_nick, show_str, status_str);
|
||||
} else {
|
||||
handle_room_member_presence(from_room, from_nick, show_str, status_str);
|
||||
|
@ -851,19 +851,19 @@ stanza_is_muc_self_presence(xmpp_stanza_t * const stanza,
|
||||
char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
|
||||
if (from) {
|
||||
Jid *from_jid = jid_create(from);
|
||||
if (muc_room_is_active(from_jid->barejid)) {
|
||||
char *nick = muc_get_room_nick(from_jid->barejid);
|
||||
if (muc_active(from_jid->barejid)) {
|
||||
char *nick = muc_nick(from_jid->barejid);
|
||||
if (g_strcmp0(from_jid->resourcepart, nick) == 0) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// check if a new nickname maps to a pending nick change for this user
|
||||
if (muc_is_room_pending_nick_change(from_jid->barejid)) {
|
||||
if (muc_nick_change_pending(from_jid->barejid)) {
|
||||
char *new_nick = from_jid->resourcepart;
|
||||
if (new_nick) {
|
||||
char *nick = muc_get_room_nick(from_jid->barejid);
|
||||
char *old_nick = muc_get_old_nick(from_jid->barejid, new_nick);
|
||||
char *nick = muc_nick(from_jid->barejid);
|
||||
char *old_nick = muc_old_nick(from_jid->barejid, new_nick);
|
||||
if (g_strcmp0(old_nick, nick) == 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -16,12 +16,12 @@ void muc_after_test(void **state)
|
||||
muc_close();
|
||||
}
|
||||
|
||||
void test_muc_add_invite(void **state)
|
||||
void test_muc_invites_add(void **state)
|
||||
{
|
||||
char *room = "room@conf.server";
|
||||
muc_add_invite(room);
|
||||
muc_invites_add(room);
|
||||
|
||||
gboolean invite_exists = muc_invites_include(room);
|
||||
gboolean invite_exists = muc_invites_contain(room);
|
||||
|
||||
assert_true(invite_exists);
|
||||
}
|
||||
@ -29,30 +29,30 @@ void test_muc_add_invite(void **state)
|
||||
void test_muc_remove_invite(void **state)
|
||||
{
|
||||
char *room = "room@conf.server";
|
||||
muc_add_invite(room);
|
||||
muc_remove_invite(room);
|
||||
muc_invites_add(room);
|
||||
muc_invites_remove(room);
|
||||
|
||||
gboolean invite_exists = muc_invites_include(room);
|
||||
gboolean invite_exists = muc_invites_contain(room);
|
||||
|
||||
assert_false(invite_exists);
|
||||
}
|
||||
|
||||
void test_muc_invite_count_0(void **state)
|
||||
void test_muc_invites_count_0(void **state)
|
||||
{
|
||||
int invite_count = muc_invite_count();
|
||||
int invite_count = muc_invites_count();
|
||||
|
||||
assert_true(invite_count == 0);
|
||||
}
|
||||
|
||||
void test_muc_invite_count_5(void **state)
|
||||
void test_muc_invites_count_5(void **state)
|
||||
{
|
||||
muc_add_invite("room1@conf.server");
|
||||
muc_add_invite("room2@conf.server");
|
||||
muc_add_invite("room3@conf.server");
|
||||
muc_add_invite("room4@conf.server");
|
||||
muc_add_invite("room5@conf.server");
|
||||
muc_invites_add("room1@conf.server");
|
||||
muc_invites_add("room2@conf.server");
|
||||
muc_invites_add("room3@conf.server");
|
||||
muc_invites_add("room4@conf.server");
|
||||
muc_invites_add("room5@conf.server");
|
||||
|
||||
int invite_count = muc_invite_count();
|
||||
int invite_count = muc_invites_count();
|
||||
|
||||
assert_true(invite_count == 5);
|
||||
}
|
||||
@ -61,18 +61,18 @@ void test_muc_room_is_not_active(void **state)
|
||||
{
|
||||
char *room = "room@server.org";
|
||||
|
||||
gboolean room_is_active = muc_room_is_active(room);
|
||||
gboolean room_is_active = muc_active(room);
|
||||
|
||||
assert_false(room_is_active);
|
||||
}
|
||||
|
||||
void test_muc_room_is_active(void **state)
|
||||
void test_muc_active(void **state)
|
||||
{
|
||||
char *room = "room@server.org";
|
||||
char *nick = "bob";
|
||||
muc_join_room(room, nick, NULL, FALSE);
|
||||
muc_join(room, nick, NULL, FALSE);
|
||||
|
||||
gboolean room_is_active = muc_room_is_active(room);
|
||||
gboolean room_is_active = muc_active(room);
|
||||
|
||||
assert_true(room_is_active);
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
void muc_before_test(void **state);
|
||||
void muc_after_test(void **state);
|
||||
|
||||
void test_muc_add_invite(void **state);
|
||||
void test_muc_invites_add(void **state);
|
||||
void test_muc_remove_invite(void **state);
|
||||
void test_muc_invite_count_0(void **state);
|
||||
void test_muc_invite_count_5(void **state);
|
||||
void test_muc_invites_count_0(void **state);
|
||||
void test_muc_invites_count_5(void **state);
|
||||
void test_muc_room_is_not_active(void **state);
|
||||
void test_muc_room_is_active(void **state);
|
||||
void test_muc_active(void **state);
|
||||
|
@ -419,12 +419,12 @@ int main(int argc, char* argv[]) {
|
||||
load_preferences,
|
||||
close_preferences),
|
||||
|
||||
unit_test_setup_teardown(test_muc_add_invite, muc_before_test, muc_after_test),
|
||||
unit_test_setup_teardown(test_muc_invites_add, muc_before_test, muc_after_test),
|
||||
unit_test_setup_teardown(test_muc_remove_invite, muc_before_test, muc_after_test),
|
||||
unit_test_setup_teardown(test_muc_invite_count_0, muc_before_test, muc_after_test),
|
||||
unit_test_setup_teardown(test_muc_invite_count_5, muc_before_test, muc_after_test),
|
||||
unit_test_setup_teardown(test_muc_invites_count_0, muc_before_test, muc_after_test),
|
||||
unit_test_setup_teardown(test_muc_invites_count_5, muc_before_test, muc_after_test),
|
||||
unit_test_setup_teardown(test_muc_room_is_not_active, muc_before_test, muc_after_test),
|
||||
unit_test_setup_teardown(test_muc_room_is_active, muc_before_test, muc_after_test),
|
||||
unit_test_setup_teardown(test_muc_active, muc_before_test, muc_after_test),
|
||||
|
||||
unit_test(cmd_bookmark_shows_message_when_disconnected),
|
||||
unit_test(cmd_bookmark_shows_message_when_disconnecting),
|
||||
|
Loading…
Reference in New Issue
Block a user