Mercurial > pidgin.yaz
comparison libpurple/conversation.c @ 31822:6c660dc7cb6a
Moved the conversation attributes API and the IRC periodic WHO updates to i.p.p.next.minor, where they belong.
applied changes from 3de680fff7ddd1b00149657afb7f6cd833000a90
through 7ee5e1d431651ed2b1a54bc942d63f35580af55c
applied changes from e7c103fdfbc59bb2ca41a3c8813c4ff2847a673f
through 22937ab220c41cd0c4a3f9e21e3db687db80da75
applied changes from 22937ab220c41cd0c4a3f9e21e3db687db80da75
through cba010d1c097d4e6599f08276ed9d894710c1074
applied changes from a694289accbec14c593b3636ef1f626fd8279805
through 8a43e3ddd7adacb208afe2d7ee3ea983c95901be
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Mon, 21 Feb 2011 23:08:47 +0000 |
parents | a8cc50c2279f |
children | d72d728226dc |
comparison
equal
deleted
inserted
replaced
31821:17a4b32f4d46 | 31822:6c660dc7cb6a |
---|---|
2135 | 2135 |
2136 cb = g_new0(PurpleConvChatBuddy, 1); | 2136 cb = g_new0(PurpleConvChatBuddy, 1); |
2137 cb->name = g_strdup(name); | 2137 cb->name = g_strdup(name); |
2138 cb->flags = flags; | 2138 cb->flags = flags; |
2139 cb->alias = g_strdup(alias); | 2139 cb->alias = g_strdup(alias); |
2140 cb->attributes = g_hash_table_new_full(g_str_hash, g_str_equal, | |
2141 g_free, g_free); | |
2140 | 2142 |
2141 PURPLE_DBUS_REGISTER_POINTER(cb, PurpleConvChatBuddy); | 2143 PURPLE_DBUS_REGISTER_POINTER(cb, PurpleConvChatBuddy); |
2142 return cb; | 2144 return cb; |
2143 } | 2145 } |
2144 | 2146 |
2167 return; | 2169 return; |
2168 | 2170 |
2169 g_free(cb->alias); | 2171 g_free(cb->alias); |
2170 g_free(cb->alias_key); | 2172 g_free(cb->alias_key); |
2171 g_free(cb->name); | 2173 g_free(cb->name); |
2174 g_hash_table_destroy(cb->attributes); | |
2172 | 2175 |
2173 PURPLE_DBUS_UNREGISTER_POINTER(cb); | 2176 PURPLE_DBUS_UNREGISTER_POINTER(cb); |
2174 g_free(cb); | 2177 g_free(cb); |
2175 } | 2178 } |
2176 | 2179 |
2178 purple_conv_chat_cb_get_name(PurpleConvChatBuddy *cb) | 2181 purple_conv_chat_cb_get_name(PurpleConvChatBuddy *cb) |
2179 { | 2182 { |
2180 g_return_val_if_fail(cb != NULL, NULL); | 2183 g_return_val_if_fail(cb != NULL, NULL); |
2181 | 2184 |
2182 return cb->name; | 2185 return cb->name; |
2186 } | |
2187 | |
2188 const char * | |
2189 purple_conv_chat_cb_get_attribute(PurpleConvChatBuddy *cb, const char *key) | |
2190 { | |
2191 g_return_val_if_fail(cb != NULL, NULL); | |
2192 g_return_val_if_fail(key != NULL, NULL); | |
2193 | |
2194 return g_hash_table_lookup(cb->attributes, key); | |
2195 } | |
2196 | |
2197 static void | |
2198 append_attribute_key(gpointer key, gpointer value, gpointer user_data) | |
2199 { | |
2200 GList **list = user_data; | |
2201 *list = g_list_prepend(*list, key); | |
2202 } | |
2203 | |
2204 GList * | |
2205 purple_conv_chat_cb_get_attribute_keys(PurpleConvChatBuddy *cb) | |
2206 { | |
2207 GList *keys = NULL; | |
2208 | |
2209 g_return_val_if_fail(cb != NULL, NULL); | |
2210 | |
2211 g_hash_table_foreach(cb->attributes, (GHFunc)append_attribute_key, &keys); | |
2212 | |
2213 return keys; | |
2214 } | |
2215 | |
2216 void | |
2217 purple_conv_chat_cb_set_attribute(PurpleConvChat *chat, PurpleConvChatBuddy *cb, const char *key, const char *value) | |
2218 { | |
2219 PurpleConversation *conv; | |
2220 PurpleConversationUiOps *ops; | |
2221 | |
2222 g_return_if_fail(cb != NULL); | |
2223 g_return_if_fail(key != NULL); | |
2224 g_return_if_fail(value != NULL); | |
2225 | |
2226 g_hash_table_replace(cb->attributes, g_strdup(key), g_strdup(value)); | |
2227 | |
2228 conv = purple_conv_chat_get_conversation(chat); | |
2229 ops = purple_conversation_get_ui_ops(conv); | |
2230 | |
2231 if (ops != NULL && ops->chat_update_user != NULL) | |
2232 ops->chat_update_user(conv, cb->name); | |
2233 } | |
2234 | |
2235 void | |
2236 purple_conv_chat_cb_set_attributes(PurpleConvChat *chat, PurpleConvChatBuddy *cb, GList *keys, GList *values) | |
2237 { | |
2238 PurpleConversation *conv; | |
2239 PurpleConversationUiOps *ops; | |
2240 | |
2241 g_return_if_fail(cb != NULL); | |
2242 g_return_if_fail(keys != NULL); | |
2243 g_return_if_fail(values != NULL); | |
2244 | |
2245 while (keys != NULL && values != NULL) { | |
2246 g_hash_table_replace(cb->attributes, g_strdup(keys->data), g_strdup(values->data)); | |
2247 keys = g_list_next(keys); | |
2248 values = g_list_next(values); | |
2249 } | |
2250 | |
2251 conv = purple_conv_chat_get_conversation(chat); | |
2252 ops = purple_conversation_get_ui_ops(conv); | |
2253 | |
2254 if (ops != NULL && ops->chat_update_user != NULL) | |
2255 ops->chat_update_user(conv, cb->name); | |
2183 } | 2256 } |
2184 | 2257 |
2185 GList * | 2258 GList * |
2186 purple_conversation_get_extended_menu(PurpleConversation *conv) | 2259 purple_conversation_get_extended_menu(PurpleConversation *conv) |
2187 { | 2260 { |