Changes in protocols/purple/purple.c [ba7618d:b38f655]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/purple/purple.c
rba7618d rb38f655 113 113 servers anyway! */ 114 114 if (!dir_fixed) { 115 PurpleCertificatePool *pool;116 115 irc_t *irc = acc->bee->ui_data; 117 116 char *dir; … … 123 122 purple_blist_load(); 124 123 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 137 124 dir_fixed = TRUE; 138 125 } … … 360 347 if (!pd) { 361 348 return; 362 }363 364 while (ic->groupchats) {365 imcb_chat_free(ic->groupchats->data);366 349 } 367 350 … … 651 634 /* Call the fucker. */ 652 635 callback = (void *) mi->callback; 653 callback(&pb->node, m i->data);636 callback(&pb->node, menu->data); 654 637 655 638 return NULL; … … 719 702 g_hash_table_replace(chat_hash, "passwd", g_strdup(password)); 720 703 } 721 722 g_free(pce); 723 } 724 725 g_list_free(info); 704 } 726 705 727 706 serv_join_chat(purple_account_get_connection(pd->account), chat_hash); 728 707 729 g_hash_table_destroy(chat_hash); 730 731 return imcb_chat_new(ic, room); 708 return NULL; 732 709 } 733 710 … … 751 728 static PurpleCoreUiOps bee_core_uiops = 752 729 { 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 */730 NULL, 731 NULL, 732 purple_ui_init, 733 NULL, 734 prplcb_ui_info, 758 735 }; 759 736 … … 782 759 purple_gg_buddylist_import(gc); 783 760 784 ic->flags |= OPT_DOES_HTML; 761 if (gc->flags & PURPLE_CONNECTION_HTML) { 762 ic->flags |= OPT_DOES_HTML; 763 } 785 764 } 786 765 … … 816 795 static PurpleConnectionUiOps bee_conn_uiops = 817 796 { 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 */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, 826 805 }; 827 806 … … 898 877 static PurpleBlistUiOps bee_blist_uiops = 899 878 { 900 NULL, /* new_list */901 prplcb_blist_new, /* new_node */902 NULL, /* show */903 prplcb_blist_update, /* update */904 prplcb_blist_remove, /* remove */879 NULL, 880 prplcb_blist_new, 881 NULL, 882 prplcb_blist_update, 883 prplcb_blist_remove, 905 884 }; 906 885 … … 911 890 struct groupchat *gc; 912 891 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) { 892 gc = imcb_chat_new(ic, conv->name); 893 if (conv->title != NULL) { 894 imcb_chat_name_hint(gc, conv->title); 924 895 imcb_chat_topic(gc, NULL, conv->title, 0); 925 896 } … … 964 935 } 965 936 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); 937 void prplcb_conv_chat_msg(PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, 938 time_t mtime) 939 { 970 940 struct groupchat *gc = conv->ui_data; 971 941 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 } 972 947 973 948 buddy = purple_find_buddy(conv->account, who); … … 976 951 } 977 952 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 { 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. */ 1000 963 if (flags & PURPLE_MESSAGE_SEND) { 1001 handle_conv_msg(conv, who, message, OPT_SELFMESSAGE, mtime); 1002 } 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); 1003 973 } 1004 974 … … 1033 1003 prplcb_conv_new, /* create_conversation */ 1034 1004 prplcb_conv_free, /* destroy_conversation */ 1035 prplcb_conv_ msg,/* write_chat */1036 prplcb_conv_ msg,/* write_im */1037 prplcb_conv_write,/* write_conv */1005 prplcb_conv_chat_msg, /* write_chat */ 1006 prplcb_conv_im, /* write_im */ 1007 NULL, /* write_conv */ 1038 1008 prplcb_conv_add_users, /* chat_add_users */ 1039 1009 NULL, /* chat_rename_user */ … … 1200 1170 static PurpleRequestUiOps bee_request_uiops = 1201 1171 { 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 */1172 prplcb_request_input, 1173 NULL, 1174 prplcb_request_action, 1175 NULL, 1176 NULL, 1177 prplcb_close_request, 1178 NULL, 1209 1179 }; 1210 1180 … … 1247 1217 static PurplePrivacyUiOps bee_privacy_uiops = 1248 1218 { 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 */1219 prplcb_privacy_permit_added, 1220 prplcb_privacy_permit_removed, 1221 prplcb_privacy_deny_added, 1222 prplcb_privacy_deny_removed, 1253 1223 }; 1254 1224 … … 1260 1230 static PurpleDebugUiOps bee_debug_uiops = 1261 1231 { 1262 prplcb_debug_print, /* print */1232 prplcb_debug_print, 1263 1233 }; 1264 1234 … … 1281 1251 static PurpleEventLoopUiOps glib_eventloops = 1282 1252 { 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 */1253 prplcb_ev_timeout_add, 1254 prplcb_ev_remove, 1255 prplcb_ev_input_add, 1256 prplcb_ev_remove, 1287 1257 }; 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 }1309 1258 1310 1259 static void *prplcb_notify_email(PurpleConnection *gc, const char *subject, const char *from, … … 1368 1317 static PurpleNotifyUiOps bee_notify_uiops = 1369 1318 { 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 */1319 NULL, 1320 prplcb_notify_email, 1321 NULL, 1322 NULL, 1323 NULL, 1324 NULL, 1325 prplcb_notify_userinfo, 1377 1326 }; 1378 1327 … … 1401 1350 static PurpleAccountUiOps bee_account_uiops = 1402 1351 { 1403 NULL, /* notify_added */1404 NULL, /* status_changed */1405 NULL, /* request_add */1406 prplcb_account_request_authorize, /* request_authorize */1407 NULL, /* close_account_request */1352 NULL, 1353 NULL, 1354 NULL, 1355 prplcb_account_request_authorize, 1356 NULL, 1408 1357 }; 1409 1358 … … 1433 1382 char *dir; 1434 1383 1435 g_assert((int) B_EV_IO_READ == (int) PURPLE_INPUT_READ); 1436 g_assert((int) B_EV_IO_WRITE == (int) PURPLE_INPUT_WRITE); 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 } 1437 1389 1438 1390 dir = g_strdup_printf("%s/purple", global.conf->configdir); … … 1452 1404 PurpleProxyInfo *pi = purple_global_proxy_get_info(); 1453 1405 switch (proxytype) { 1454 case PROXY_SOCKS4A:1455 1406 case PROXY_SOCKS4: 1456 1407 purple_proxy_info_set_type(pi, PURPLE_PROXY_SOCKS4);
Note: See TracChangeset
for help on using the changeset viewer.