1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Renamed chat room type

This commit is contained in:
James Booth 2013-01-13 00:08:45 +00:00
parent 1cc33cc491
commit 6607b99872

View File

@ -38,11 +38,11 @@ typedef struct _muc_room_t {
PAutocomplete nick_ac; PAutocomplete nick_ac;
GHashTable *nick_changes; GHashTable *nick_changes;
gboolean roster_received; gboolean roster_received;
} muc_room; } ChatRoom;
GHashTable *rooms = NULL; GHashTable *rooms = NULL;
static void _free_room(muc_room *room); static void _free_room(ChatRoom *room);
/* /*
* Join the chat room with the specified nickname * Join the chat room with the specified nickname
@ -55,7 +55,7 @@ muc_join_room(const char * const room, const char * const nick)
(GDestroyNotify)_free_room); (GDestroyNotify)_free_room);
} }
muc_room *new_room = malloc(sizeof(muc_room)); ChatRoom *new_room = malloc(sizeof(ChatRoom));
new_room->room = strdup(room); new_room->room = strdup(room);
new_room->nick = strdup(nick); new_room->nick = strdup(nick);
new_room->roster = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, new_room->roster = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
@ -88,7 +88,7 @@ muc_room_is_active(const char * const full_room_jid)
char *room_part = tokens[0]; char *room_part = tokens[0];
if (rooms != NULL) { if (rooms != NULL) {
muc_room *chat_room = g_hash_table_lookup(rooms, room_part); ChatRoom *chat_room = g_hash_table_lookup(rooms, room_part);
if (chat_room != NULL) { if (chat_room != NULL) {
return TRUE; return TRUE;
@ -107,7 +107,7 @@ muc_room_is_active(const char * const full_room_jid)
void void
muc_set_room_pending_nick_change(const char * const room) muc_set_room_pending_nick_change(const char * const room)
{ {
muc_room *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room != NULL) { if (chat_room != NULL) {
chat_room->pending_nick_change = TRUE; chat_room->pending_nick_change = TRUE;
@ -121,7 +121,7 @@ muc_set_room_pending_nick_change(const char * const room)
gboolean gboolean
muc_is_room_pending_nick_change(const char * const room) muc_is_room_pending_nick_change(const char * const room)
{ {
muc_room *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room != NULL) { if (chat_room != NULL) {
return chat_room->pending_nick_change; return chat_room->pending_nick_change;
@ -137,7 +137,7 @@ muc_is_room_pending_nick_change(const char * const room)
void void
muc_complete_room_nick_change(const char * const room, const char * const nick) muc_complete_room_nick_change(const char * const room, const char * const nick)
{ {
muc_room *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room != NULL) { if (chat_room != NULL) {
free(chat_room->nick); free(chat_room->nick);
@ -169,7 +169,7 @@ char *
muc_get_room_nick(const char * const room) muc_get_room_nick(const char * const room)
{ {
if (rooms != NULL) { if (rooms != NULL) {
muc_room *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room != NULL) { if (chat_room != NULL) {
return chat_room->nick; return chat_room->nick;
@ -187,7 +187,7 @@ muc_get_room_nick(const char * const room)
gboolean gboolean
muc_nick_in_roster(const char * const room, const char * const nick) muc_nick_in_roster(const char * const room, const char * const nick)
{ {
muc_room *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room != NULL) { if (chat_room != NULL) {
PContact contact = g_hash_table_lookup(chat_room->roster, nick); PContact contact = g_hash_table_lookup(chat_room->roster, nick);
@ -208,7 +208,7 @@ gboolean
muc_add_to_roster(const char * const room, const char * const nick, muc_add_to_roster(const char * const room, const char * const nick,
const char * const show, const char * const status) const char * const show, const char * const status)
{ {
muc_room *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
gboolean updated = FALSE; gboolean updated = FALSE;
if (chat_room != NULL) { if (chat_room != NULL) {
@ -235,7 +235,7 @@ muc_add_to_roster(const char * const room, const char * const nick,
void void
muc_remove_from_roster(const char * const room, const char * const nick) muc_remove_from_roster(const char * const room, const char * const nick)
{ {
muc_room *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room != NULL) { if (chat_room != NULL) {
g_hash_table_remove(chat_room->roster, nick); g_hash_table_remove(chat_room->roster, nick);
@ -250,7 +250,7 @@ muc_remove_from_roster(const char * const room, const char * const nick)
GList * GList *
muc_get_roster(const char * const room) muc_get_roster(const char * const room)
{ {
muc_room *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room != NULL) { if (chat_room != NULL) {
return g_hash_table_get_values(chat_room->roster); return g_hash_table_get_values(chat_room->roster);
@ -265,7 +265,7 @@ muc_get_roster(const char * const room)
PAutocomplete PAutocomplete
muc_get_roster_ac(const char * const room) muc_get_roster_ac(const char * const room)
{ {
muc_room *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room != NULL) { if (chat_room != NULL) {
return chat_room->nick_ac; return chat_room->nick_ac;
@ -280,7 +280,7 @@ muc_get_roster_ac(const char * const room)
void void
muc_set_roster_received(const char * const room) muc_set_roster_received(const char * const room)
{ {
muc_room *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room != NULL) { if (chat_room != NULL) {
chat_room->roster_received = TRUE; chat_room->roster_received = TRUE;
@ -293,7 +293,7 @@ muc_set_roster_received(const char * const room)
gboolean gboolean
muc_get_roster_received(const char * const room) muc_get_roster_received(const char * const room)
{ {
muc_room *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room != NULL) { if (chat_room != NULL) {
return chat_room->roster_received; return chat_room->roster_received;
@ -310,7 +310,7 @@ void
muc_set_roster_pending_nick_change(const char * const room, muc_set_roster_pending_nick_change(const char * const room,
const char * const new_nick, const char * const old_nick) const char * const new_nick, const char * const old_nick)
{ {
muc_room *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room != NULL) { if (chat_room != NULL) {
g_hash_table_insert(chat_room->nick_changes, strdup(new_nick), strdup(old_nick)); g_hash_table_insert(chat_room->nick_changes, strdup(new_nick), strdup(old_nick));
@ -328,7 +328,7 @@ char *
muc_complete_roster_nick_change(const char * const room, muc_complete_roster_nick_change(const char * const room,
const char * const nick) const char * const nick)
{ {
muc_room *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room != NULL) { if (chat_room != NULL) {
char *old_nick = g_hash_table_lookup(chat_room->nick_changes, nick); char *old_nick = g_hash_table_lookup(chat_room->nick_changes, nick);
@ -346,7 +346,7 @@ muc_complete_roster_nick_change(const char * const room,
} }
static void static void
_free_room(muc_room *room) _free_room(ChatRoom *room)
{ {
if (room != NULL) { if (room != NULL) {
if (room->room != NULL) { if (room->room != NULL) {