Changes in protocols/purple/purple.c [b38f655:ba7618d]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/purple/purple.c
rb38f655 rba7618d 113 113 servers anyway! */ 114 114 if (!dir_fixed) { 115 PurpleCertificatePool *pool; 115 116 irc_t *irc = acc->bee->ui_data; 116 117 char *dir; … … 122 123 purple_blist_load(); 123 124 purple_prefs_load(); 125 126 if (proxytype == PROXY_SOCKS4A) { 127 /* do this here after loading prefs. yes, i know, it sucks */ 128 purple_prefs_set_bool("/purple/proxy/socks4_remotedns", TRUE); 129 } 130 131 /* re-create the certificate cache directory */ 132 pool = purple_certificate_find_pool("x509", "tls_peers"); 133 dir = purple_certificate_pool_mkpath(pool, NULL); 134 purple_build_dir(dir, 0700); 135 g_free(dir); 136 124 137 dir_fixed = TRUE; 125 138 } … … 347 360 if (!pd) { 348 361 return; 362 } 363 364 while (ic->groupchats) { 365 imcb_chat_free(ic->groupchats->data); 349 366 } 350 367 … … 634 651 /* Call the fucker. */ 635 652 callback = (void *) mi->callback; 636 callback(&pb->node, m enu->data);653 callback(&pb->node, mi->data); 637 654 638 655 return NULL; … … 702 719 g_hash_table_replace(chat_hash, "passwd", g_strdup(password)); 703 720 } 704 } 721 722 g_free(pce); 723 } 724 725 g_list_free(info); 705 726 706 727 serv_join_chat(purple_account_get_connection(pd->account), chat_hash); 707 728 708 return NULL; 729 g_hash_table_destroy(chat_hash); 730 731 return imcb_chat_new(ic, room); 709 732 } 710 733 … … 728 751 static PurpleCoreUiOps bee_core_uiops = 729 752 { 730 NULL, 731 NULL, 732 purple_ui_init, 733 NULL, 734 prplcb_ui_info, 753 NULL, /* ui_prefs_init */ 754 NULL, /* debug_ui_init */ 755 purple_ui_init, /* ui_init */ 756 NULL, /* quit */ 757 prplcb_ui_info, /* get_ui_info */ 735 758 }; 736 759 … … 759 782 purple_gg_buddylist_import(gc); 760 783 761 if (gc->flags & PURPLE_CONNECTION_HTML) { 762 ic->flags |= OPT_DOES_HTML; 763 } 784 ic->flags |= OPT_DOES_HTML; 764 785 } 765 786 … … 795 816 static PurpleConnectionUiOps bee_conn_uiops = 796 817 { 797 prplcb_conn_progress, 798 prplcb_conn_connected, 799 prplcb_conn_disconnected, 800 prplcb_conn_notice, 801 NULL, 802 NULL, 803 NULL, 804 prplcb_conn_report_disconnect_reason, 818 prplcb_conn_progress, /* connect_progress */ 819 prplcb_conn_connected, /* connected */ 820 prplcb_conn_disconnected, /* disconnected */ 821 prplcb_conn_notice, /* notice */ 822 NULL, /* report_disconnect */ 823 NULL, /* network_connected */ 824 NULL, /* network_disconnected */ 825 prplcb_conn_report_disconnect_reason, /* report_disconnect_reason */ 805 826 }; 806 827 … … 877 898 static PurpleBlistUiOps bee_blist_uiops = 878 899 { 879 NULL, 880 prplcb_blist_new, 881 NULL, 882 prplcb_blist_update, 883 prplcb_blist_remove, 900 NULL, /* new_list */ 901 prplcb_blist_new, /* new_node */ 902 NULL, /* show */ 903 prplcb_blist_update, /* update */ 904 prplcb_blist_remove, /* remove */ 884 905 }; 885 906 … … 890 911 struct groupchat *gc; 891 912 892 gc = imcb_chat_new(ic, conv->name); 893 if (conv->title != NULL) { 894 imcb_chat_name_hint(gc, conv->title); 913 gc = bee_chat_by_title(ic->bee, ic, conv->name); 914 915 if (!gc) { 916 gc = imcb_chat_new(ic, conv->name); 917 if (conv->title != NULL) { 918 imcb_chat_name_hint(gc, conv->title); 919 } 920 } 921 922 /* don't set the topic if it's just the name */ 923 if (conv->title != NULL && strcmp(conv->name, conv->title) != 0) { 895 924 imcb_chat_topic(gc, NULL, conv->title, 0); 896 925 } … … 935 964 } 936 965 937 void prplcb_conv_chat_msg(PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, 938 time_t mtime) 939 { 966 /* Generic handler for IM or chat messages, covers write_chat, write_im and write_conv */ 967 static void handle_conv_msg(PurpleConversation *conv, const char *who, const char *message, guint32 bee_flags, time_t mtime) 968 { 969 struct im_connection *ic = purple_ic_by_pa(conv->account); 940 970 struct groupchat *gc = conv->ui_data; 941 971 PurpleBuddy *buddy; 942 943 /* ..._SEND means it's an outgoing message, no need to echo those. */944 if (flags & PURPLE_MESSAGE_SEND) {945 return;946 }947 972 948 973 buddy = purple_find_buddy(conv->account, who); … … 951 976 } 952 977 953 imcb_chat_msg(gc, who, (char *) message, 0, mtime); 954 } 955 956 static void prplcb_conv_im(PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, 957 time_t mtime) 958 { 959 struct im_connection *ic = purple_ic_by_pa(conv->account); 960 PurpleBuddy *buddy; 961 962 /* ..._SEND means it's an outgoing message, no need to echo those. */ 978 if (conv->type == PURPLE_CONV_TYPE_IM) { 979 imcb_buddy_msg(ic, (char *) who, (char *) message, bee_flags, mtime); 980 } else if (gc) { 981 imcb_chat_msg(gc, who, (char *) message, bee_flags, mtime); 982 } 983 } 984 985 /* Handles write_im and write_chat. Removes echoes of locally sent messages */ 986 static void prplcb_conv_msg(PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, time_t mtime) 987 { 988 if (!(flags & PURPLE_MESSAGE_SEND)) { 989 handle_conv_msg(conv, who, message, 0, mtime); 990 } 991 } 992 993 /* Handles write_conv. Only passes self messages from other locations through. 994 * That is, only writes of PURPLE_MESSAGE_SEND. 995 * There are more events which might be handled in the future, but some are tricky. 996 * (images look like <img id="123">, what do i do with that?) */ 997 static void prplcb_conv_write(PurpleConversation *conv, const char *who, const char *alias, const char *message, 998 PurpleMessageFlags flags, time_t mtime) 999 { 963 1000 if (flags & PURPLE_MESSAGE_SEND) { 964 return; 965 } 966 967 buddy = purple_find_buddy(conv->account, who); 968 if (buddy != NULL) { 969 who = purple_buddy_get_name(buddy); 970 } 971 972 imcb_buddy_msg(ic, (char *) who, (char *) message, 0, mtime); 1001 handle_conv_msg(conv, who, message, OPT_SELFMESSAGE, mtime); 1002 } 973 1003 } 974 1004 … … 1003 1033 prplcb_conv_new, /* create_conversation */ 1004 1034 prplcb_conv_free, /* destroy_conversation */ 1005 prplcb_conv_ chat_msg,/* write_chat */1006 prplcb_conv_ im,/* write_im */1007 NULL,/* write_conv */1035 prplcb_conv_msg, /* write_chat */ 1036 prplcb_conv_msg, /* write_im */ 1037 prplcb_conv_write, /* write_conv */ 1008 1038 prplcb_conv_add_users, /* chat_add_users */ 1009 1039 NULL, /* chat_rename_user */ … … 1170 1200 static PurpleRequestUiOps bee_request_uiops = 1171 1201 { 1172 prplcb_request_input, 1173 NULL, 1174 prplcb_request_action, 1175 NULL, 1176 NULL, 1177 prplcb_close_request, 1178 NULL, 1202 prplcb_request_input, /* request_input */ 1203 NULL, /* request_choice */ 1204 prplcb_request_action, /* request_action */ 1205 NULL, /* request_fields */ 1206 NULL, /* request_file */ 1207 prplcb_close_request, /* close_request */ 1208 NULL, /* request_folder */ 1179 1209 }; 1180 1210 … … 1217 1247 static PurplePrivacyUiOps bee_privacy_uiops = 1218 1248 { 1219 prplcb_privacy_permit_added, 1220 prplcb_privacy_permit_removed, 1221 prplcb_privacy_deny_added, 1222 prplcb_privacy_deny_removed, 1249 prplcb_privacy_permit_added, /* permit_added */ 1250 prplcb_privacy_permit_removed, /* permit_removed */ 1251 prplcb_privacy_deny_added, /* deny_added */ 1252 prplcb_privacy_deny_removed, /* deny_removed */ 1223 1253 }; 1224 1254 … … 1230 1260 static PurpleDebugUiOps bee_debug_uiops = 1231 1261 { 1232 prplcb_debug_print, 1262 prplcb_debug_print, /* print */ 1233 1263 }; 1234 1264 … … 1251 1281 static PurpleEventLoopUiOps glib_eventloops = 1252 1282 { 1253 prplcb_ev_timeout_add, 1254 prplcb_ev_remove, 1255 prplcb_ev_input_add, 1256 prplcb_ev_remove, 1283 prplcb_ev_timeout_add, /* timeout_add */ 1284 prplcb_ev_remove, /* timeout_remove */ 1285 prplcb_ev_input_add, /* input_add */ 1286 prplcb_ev_remove, /* input_remove */ 1257 1287 }; 1288 1289 /* Absolutely no connection context at all. Thanks purple! brb crying */ 1290 static void *prplcb_notify_message(PurpleNotifyMsgType type, const char *title, 1291 const char *primary, const char *secondary) 1292 { 1293 char *text = g_strdup_printf("%s%s - %s%s%s", 1294 (type == PURPLE_NOTIFY_MSG_ERROR) ? "Error: " : "", 1295 title, 1296 primary ?: "", 1297 (primary && secondary) ? " - " : "", 1298 secondary ?: "" 1299 ); 1300 1301 if (local_bee->ui->log) { 1302 local_bee->ui->log(local_bee, "purple", text); 1303 } 1304 1305 g_free(text); 1306 1307 return NULL; 1308 } 1258 1309 1259 1310 static void *prplcb_notify_email(PurpleConnection *gc, const char *subject, const char *from, … … 1317 1368 static PurpleNotifyUiOps bee_notify_uiops = 1318 1369 { 1319 NULL,1320 prplcb_notify_email, 1321 NULL, 1322 NULL, 1323 NULL, 1324 NULL, 1325 prplcb_notify_userinfo, 1370 prplcb_notify_message, /* notify_message */ 1371 prplcb_notify_email, /* notify_email */ 1372 NULL, /* notify_emails */ 1373 NULL, /* notify_formatted */ 1374 NULL, /* notify_searchresults */ 1375 NULL, /* notify_searchresults_new_rows */ 1376 prplcb_notify_userinfo, /* notify_userinfo */ 1326 1377 }; 1327 1378 … … 1350 1401 static PurpleAccountUiOps bee_account_uiops = 1351 1402 { 1352 NULL, 1353 NULL, 1354 NULL, 1355 prplcb_account_request_authorize, 1356 NULL, 1403 NULL, /* notify_added */ 1404 NULL, /* status_changed */ 1405 NULL, /* request_add */ 1406 prplcb_account_request_authorize, /* request_authorize */ 1407 NULL, /* close_account_request */ 1357 1408 }; 1358 1409 … … 1382 1433 char *dir; 1383 1434 1384 if (B_EV_IO_READ != PURPLE_INPUT_READ || 1385 B_EV_IO_WRITE != PURPLE_INPUT_WRITE) { 1386 /* FIXME FIXME FIXME FIXME FIXME :-) */ 1387 exit(1); 1388 } 1435 g_assert((int) B_EV_IO_READ == (int) PURPLE_INPUT_READ); 1436 g_assert((int) B_EV_IO_WRITE == (int) PURPLE_INPUT_WRITE); 1389 1437 1390 1438 dir = g_strdup_printf("%s/purple", global.conf->configdir); … … 1404 1452 PurpleProxyInfo *pi = purple_global_proxy_get_info(); 1405 1453 switch (proxytype) { 1454 case PROXY_SOCKS4A: 1406 1455 case PROXY_SOCKS4: 1407 1456 purple_proxy_info_set_type(pi, PURPLE_PROXY_SOCKS4);
Note: See TracChangeset
for help on using the changeset viewer.