Mercurial > pidgin
diff libpurple/conversation.c @ 18058:4ca97b26a8fb
Mark the return type const for the following functions. I noticed this
while fixing some DBus stuff which I'll commit shortly.
* purple_accounts_get_all
* purple_connections_get_all
* purple_connections_get_connecting
* purple_conv_chat_get_ignored
* purple_conv_chat_get_users
* purple_get_chats
* purple_get_conversations
* purple_get_ims
* purple_notify_user_info_get_entries
References #1344
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Thu, 07 Jun 2007 04:22:42 +0000 |
parents | 627f9d40ca1b |
children | 926ccb104da0 97b735ca9d7a |
line wrap: on
line diff
--- a/libpurple/conversation.c Thu Jun 07 03:13:02 2007 +0000 +++ b/libpurple/conversation.c Thu Jun 07 04:22:42 2007 +0000 @@ -631,7 +631,7 @@ purple_conversation_foreach(void (*func)(PurpleConversation *conv)) { PurpleConversation *conv; - GList *l; + const GList *l; g_return_if_fail(func != NULL); @@ -732,19 +732,19 @@ return g_hash_table_lookup(conv->data, key); } -GList * +const GList * purple_get_conversations(void) { return conversations; } -GList * +const GList * purple_get_ims(void) { return ims; } -GList * +const GList * purple_get_chats(void) { return chats; @@ -759,7 +759,7 @@ PurpleConversation *c = NULL; gchar *name1; const gchar *name2; - GList *cnv; + const GList *cnv; g_return_val_if_fail(name != NULL, NULL); @@ -819,7 +819,7 @@ return; if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && - !g_list_find(purple_get_conversations(), conv)) + !g_list_find((GList *)purple_get_conversations(), conv)) return; displayed = g_strdup(message); @@ -1250,7 +1250,7 @@ return users; } -GList * +const GList * purple_conv_chat_get_users(const PurpleConvChat *chat) { g_return_val_if_fail(chat != NULL, NULL); @@ -1269,7 +1269,7 @@ return; purple_conv_chat_set_ignored(chat, - g_list_append(purple_conv_chat_get_ignored(chat), g_strdup(name))); + g_list_append(chat->ignored, g_strdup(name))); } void @@ -1284,11 +1284,11 @@ if (!purple_conv_chat_is_user_ignored(chat, name)) return; - item = g_list_find(purple_conv_chat_get_ignored(chat), + item = g_list_find((GList *)purple_conv_chat_get_ignored(chat), purple_conv_chat_get_ignored_user(chat, name)); purple_conv_chat_set_ignored(chat, - g_list_remove_link(purple_conv_chat_get_ignored(chat), item)); + g_list_remove_link(chat->ignored, item)); g_free(item->data); g_list_free_1(item); @@ -1304,7 +1304,7 @@ return ignored; } -GList * +const GList * purple_conv_chat_get_ignored(const PurpleConvChat *chat) { g_return_val_if_fail(chat != NULL, NULL); @@ -1315,7 +1315,7 @@ const char * purple_conv_chat_get_ignored_user(const PurpleConvChat *chat, const char *user) { - GList *ignored; + const GList *ignored; g_return_val_if_fail(chat != NULL, NULL); g_return_val_if_fail(user != NULL, NULL); @@ -1565,7 +1565,7 @@ cbuddy = purple_conv_chat_cb_new(user, alias, flag); /* This seems dumb. Why should we set users thousands of times? */ purple_conv_chat_set_users(chat, - g_list_prepend(purple_conv_chat_get_users(chat), cbuddy)); + g_list_prepend(chat->in_room, cbuddy)); cbuddies = g_list_prepend(cbuddies, cbuddy); @@ -1634,7 +1634,7 @@ flags = purple_conv_chat_user_get_flags(chat, old_user); cb = purple_conv_chat_cb_new(new_user, NULL, flags); purple_conv_chat_set_users(chat, - g_list_prepend(purple_conv_chat_get_users(chat), cb)); + g_list_prepend(chat->in_room, cb)); if (!strcmp(chat->nick, purple_normalize(conv->account, old_user))) { const char *alias; @@ -1666,7 +1666,7 @@ if (cb) { purple_conv_chat_set_users(chat, - g_list_remove(purple_conv_chat_get_users(chat), cb)); + g_list_remove(chat->in_room, cb)); purple_conv_chat_cb_destroy(cb); } @@ -1760,7 +1760,7 @@ if (cb) { purple_conv_chat_set_users(chat, - g_list_remove(purple_conv_chat_get_users(chat), cb)); + g_list_remove(chat->in_room, cb)); purple_conv_chat_cb_destroy(cb); } @@ -1809,14 +1809,15 @@ { PurpleConversation *conv; PurpleConversationUiOps *ops; - GList *users, *names = NULL; - GList *l; + GList *users; + const GList *l; + GList *names = NULL; g_return_if_fail(chat != NULL); conv = purple_conv_chat_get_conversation(chat); ops = purple_conversation_get_ui_ops(conv); - users = purple_conv_chat_get_users(chat); + users = chat->in_room; if (ops != NULL && ops->chat_remove_users != NULL) { for (l = users; l; l = l->next) { @@ -1918,7 +1919,7 @@ PurpleConversation * purple_find_chat(const PurpleConnection *gc, int id) { - GList *l; + const GList *l; PurpleConversation *conv; for (l = purple_get_chats(); l != NULL; l = l->next) { @@ -1967,7 +1968,7 @@ PurpleConvChatBuddy * purple_conv_chat_cb_find(PurpleConvChat *chat, const char *name) { - GList *l; + const GList *l; PurpleConvChatBuddy *cb = NULL; g_return_val_if_fail(chat != NULL, NULL);