comparison src/conversation.c @ 5205:fefad67de2c7

[gaim-migrate @ 5573] I had a damn good commit message, but it was eaten. Let's try it again. Announcing, Gaim Plugin API version 2.0, or GPAPIV2.0 for short. There are lots'a cool thingies here. Okay now, this isn't as cool as the previous message, but: 1) There's now a single entry function for all plugin types. It returns a detailed information structure on the plugin. This removes a lot of the ugliness from old plugins. Oh yeah, libicq wasn't converted to this, so if you use it, well, you shouldn't have used it anyway, but now you can't! bwahahaha. Use AIM/ICQ. 2) There are now 3 types of plugins: Standard, Loader, and Protocol plugins. Standard plugins are, well, standard, compiled plugins. Loader plugins load other plugins. For example, the perl support is now a loader plugin. It loads perl scripts. In the future, we'll have Ruby and Python loader plugins. Protocol plugins are, well, protocol plugins... yeah... 3) Plugins have unique IDs, so they can be referred to or automatically updated from a plugin database in the future. Neat, huh? 4) Plugins will have dependency support in the future, and can be hidden, so if you have, say, a logging core plugin, it won't have to show up, but then you load the GTK+ logging plugin and it'll auto-load the core plugin. Core/UI split plugins! 5) There will eventually be custom plugin signals and RPC of some sort, for the core/ui split plugins. So, okay, back up .gaimrc. I'd like to thank my parents for their support, javabsp for helping convert a bunch of protocol plugins, and Etan for helping convert a bunch of standard plugins. Have fun. If you have any problems, please let me know, but you probably won't have anything major happen. You will have to convert your plugins, though, and I'm not guaranteeing that all perl scripts will still work. I'll end up changing the perl script API eventually, so I know they won't down the road. Don't worry, though. It'll be mass cool. faceprint wants me to just commit the damn code already. So, here we go!!! .. .. I need a massage. From a young, cute girl. Are there any young, cute girls in the audience? IM me plz k thx. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 25 Apr 2003 06:47:33 +0000
parents d0182ae31ab8
children 1cf4eb75e3ee
comparison
equal deleted inserted replaced
5204:44de70702205 5205:fefad67de2c7
215 if (gc->flags & OPT_CONN_HTML && convo_options & OPT_CONVO_SEND_LINKS) 215 if (gc->flags & OPT_CONN_HTML && convo_options & OPT_CONVO_SEND_LINKS)
216 buffy =linkify_text(buf); 216 buffy =linkify_text(buf);
217 else 217 else
218 buffy = g_strdup(buf); 218 buffy = g_strdup(buf);
219 219
220 plugin_return = plugin_event( 220 plugin_return = gaim_event_broadcast(
221 (type == GAIM_CONV_IM ? event_im_send : event_chat_send), 221 (type == GAIM_CONV_IM ? event_im_send : event_chat_send),
222 gc, 222 gc,
223 (type == GAIM_CONV_IM 223 (type == GAIM_CONV_IM
224 ? gaim_conversation_get_name(conv) 224 ? gaim_conversation_get_name(conv)
225 : (void *)gaim_chat_get_id(GAIM_CHAT(conv))), 225 : (void *)gaim_chat_get_id(GAIM_CHAT(conv))),
243 243
244 if (type == GAIM_CONV_IM) { 244 if (type == GAIM_CONV_IM) {
245 struct gaim_im *im = GAIM_IM(conv); 245 struct gaim_im *im = GAIM_IM(conv);
246 246
247 buffy = g_strdup(buf); 247 buffy = g_strdup(buf);
248 plugin_event(event_im_displayed_sent, gc, 248 gaim_event_broadcast(event_im_displayed_sent, gc,
249 gaim_conversation_get_name(conv), &buffy); 249 gaim_conversation_get_name(conv), &buffy);
250 250
251 if (buffy != NULL) { 251 if (buffy != NULL) {
252 int imflags = 0; 252 int imflags = 0;
253 253
916 gaim_conv_placement_set_active(0); 916 gaim_conv_placement_set_active(0);
917 917
918 place_conv(conv); 918 place_conv(conv);
919 } 919 }
920 920
921 plugin_event(event_new_conversation, name); 921 gaim_event_broadcast(event_new_conversation, name);
922 922
923 return conv; 923 return conv;
924 } 924 }
925 925
926 void 926 void
927 gaim_conversation_destroy(struct gaim_conversation *conv) 927 gaim_conversation_destroy(struct gaim_conversation *conv)
928 { 928 {
929 GaimPluginProtocolInfo *prpl_info = NULL;
929 struct gaim_window *win; 930 struct gaim_window *win;
930 struct gaim_conversation_ui_ops *ops; 931 struct gaim_conversation_ui_ops *ops;
931 struct gaim_connection *gc; 932 struct gaim_connection *gc;
932 const char *name; 933 const char *name;
933 GList *node; 934 GList *node;
938 win = gaim_conversation_get_window(conv); 939 win = gaim_conversation_get_window(conv);
939 ops = gaim_conversation_get_ui_ops(conv); 940 ops = gaim_conversation_get_ui_ops(conv);
940 gc = gaim_conversation_get_gc(conv); 941 gc = gaim_conversation_get_gc(conv);
941 name = gaim_conversation_get_name(conv); 942 name = gaim_conversation_get_name(conv);
942 943
944 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
945
943 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { 946 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
944 if (!(misc_options & OPT_MISC_STEALTH_TYPING)) 947 if (!(misc_options & OPT_MISC_STEALTH_TYPING))
945 serv_send_typing(gc, (char *)name, NOT_TYPING); 948 serv_send_typing(gc, (char *)name, NOT_TYPING);
946 949
947 if (gc && gc->prpl->convo_closed != NULL) 950 if (gc && prpl_info->convo_closed != NULL)
948 gc->prpl->convo_closed(gc, (char *)name); 951 prpl_info->convo_closed(gc, (char *)name);
949 } 952 }
950 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { 953 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) {
951 /* 954 /*
952 * This is unfortunately necessary, because calling serv_chat_leave() 955 * This is unfortunately necessary, because calling serv_chat_leave()
953 * calls this gaim_conversation_destroy(), which leads to two calls 956 * calls this gaim_conversation_destroy(), which leads to two calls
970 973
971 return; 974 return;
972 } 975 }
973 } 976 }
974 977
975 plugin_event(event_del_conversation, conv); 978 gaim_event_broadcast(event_del_conversation, conv);
976 979
977 if (conv->name != NULL) g_free(conv->name); 980 if (conv->name != NULL) g_free(conv->name);
978 if (conv->title != NULL) g_free(conv->title); 981 if (conv->title != NULL) g_free(conv->title);
979 982
980 for (node = g_list_first(conv->send_history); 983 for (node = g_list_first(conv->send_history);
1401 void 1404 void
1402 gaim_conversation_write(struct gaim_conversation *conv, const char *who, 1405 gaim_conversation_write(struct gaim_conversation *conv, const char *who,
1403 const char *message, size_t length, int flags, 1406 const char *message, size_t length, int flags,
1404 time_t mtime) 1407 time_t mtime)
1405 { 1408 {
1409 GaimPluginProtocolInfo *prpl_info = NULL;
1406 struct gaim_account *account; 1410 struct gaim_account *account;
1407 struct gaim_conversation_ui_ops *ops; 1411 struct gaim_conversation_ui_ops *ops;
1408 struct gaim_window *win; 1412 struct gaim_window *win;
1409 struct buddy *b; 1413 struct buddy *b;
1410 GaimUnseenState unseen; 1414 GaimUnseenState unseen;
1426 1430
1427 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM && 1431 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM &&
1428 !g_list_find(gaim_get_conversations(), conv)) 1432 !g_list_find(gaim_get_conversations(), conv))
1429 return; 1433 return;
1430 1434
1435 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
1436
1431 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM || 1437 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM ||
1432 !(account->gc->prpl->options & OPT_PROTO_UNIQUE_CHATNAME)) { 1438 !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
1433 1439
1434 if (who == NULL) { 1440 if (who == NULL) {
1435 if (flags & WFLAG_SEND) { 1441 if (flags & WFLAG_SEND) {
1436 b = gaim_find_buddy(account, account->gc->username); 1442 b = gaim_find_buddy(account, account->gc->username);
1437 if (b != NULL && strcmp(b->name, gaim_get_buddy_alias(b))) 1443 if (b != NULL && strcmp(b->name, gaim_get_buddy_alias(b)))
1937 1943
1938 gaim_chat_set_users(chat, 1944 gaim_chat_set_users(chat,
1939 g_list_insert_sorted(gaim_chat_get_users(chat), g_strdup(user), 1945 g_list_insert_sorted(gaim_chat_get_users(chat), g_strdup(user),
1940 insertname_compare)); 1946 insertname_compare));
1941 1947
1942 plugin_event(event_chat_buddy_join, 1948 gaim_event_broadcast(event_chat_buddy_join,
1943 gaim_conversation_get_gc(conv), gaim_chat_get_id(chat), 1949 gaim_conversation_get_gc(conv), gaim_chat_get_id(chat),
1944 user); 1950 user);
1945 1951
1946 if (ops != NULL && ops->chat_add_user != NULL) 1952 if (ops != NULL && ops->chat_add_user != NULL)
1947 ops->chat_add_user(conv, user); 1953 ops->chat_add_user(conv, user);
2019 return; 2025 return;
2020 2026
2021 conv = gaim_chat_get_conversation(chat); 2027 conv = gaim_chat_get_conversation(chat);
2022 ops = gaim_conversation_get_ui_ops(conv); 2028 ops = gaim_conversation_get_ui_ops(conv);
2023 2029
2024 plugin_event(event_chat_buddy_leave, gaim_conversation_get_gc(conv), 2030 gaim_event_broadcast(event_chat_buddy_leave, gaim_conversation_get_gc(conv),
2025 gaim_chat_get_id(chat), user); 2031 gaim_chat_get_id(chat), user);
2026 2032
2027 if (ops != NULL && ops->chat_remove_user != NULL) 2033 if (ops != NULL && ops->chat_remove_user != NULL)
2028 ops->chat_remove_user(conv, user); 2034 ops->chat_remove_user(conv, user);
2029 2035