akronix: diff-current-to-2.10.11.patch
File diff-current-to-2.10.11.patch, 151.4 KB (added by , 9 years ago) |
---|
-
libpurple/account.c
Only in libpurple: Makefile.in diff -ru extract/pidgin-2.10.11/libpurple/account.c libpurple/account.c
old new 30 30 #include "debug.h" 31 31 #include "network.h" 32 32 #include "notify.h" 33 #include "pounce.h"34 33 #include "prefs.h" 35 34 #include "privacy.h" 36 35 #include "prpl.h" … … 41 40 #include "util.h" 42 41 #include "xmlnode.h" 43 42 43 #define schedule_accounts_save() 44 44 45 typedef struct 45 46 { 46 47 PurpleConnectionErrorInfo *current_error; … … 103 104 static gboolean 104 105 _purple_account_is_password_encrypted(PurpleAccount *account); 105 106 107 #if 0 106 108 /********************************************************************* 107 109 * Writing to disk * 108 110 *********************************************************************/ … … 1015 1017 1016 1018 return ret; 1017 1019 } 1020 #endif 1018 1021 1019 1022 static void 1020 1023 load_accounts(void) … … 1023 1026 1024 1027 accounts_loaded = TRUE; 1025 1028 1029 #if 0 1026 1030 node = purple_util_read_xml_from_file("accounts.xml", _("accounts")); 1027 1031 1028 1032 if (node == NULL) … … 1039 1043 xmlnode_free(node); 1040 1044 1041 1045 _purple_buddy_icons_account_loaded_cb(); 1046 #endif 1042 1047 } 1043 1048 1044 1049 … … 1151 1156 1152 1157 purple_presence_destroy(account->presence); 1153 1158 1159 #if 0 1154 1160 if(account->system_log) 1155 1161 purple_log_free(account->system_log); 1162 #endif 1156 1163 1157 1164 while (account->deny) { 1158 1165 g_free(account->deny->data); … … 1341 1348 1342 1349 gc = purple_account_get_connection(account); 1343 1350 _purple_connection_destroy(gc); 1351 1352 /* 1353 XXXFlo: disable this until the UI for requesting a password 1354 from the user works in Instantbird 1344 1355 if (!purple_account_get_remember_password(account)) 1345 1356 purple_account_set_password(account, NULL); 1357 */ 1346 1358 purple_account_set_connection(account, NULL); 1347 1359 1348 1360 account->disconnecting = FALSE; … … 2036 2048 purple_account_set_int(PurpleAccount *account, const char *name, int value) 2037 2049 { 2038 2050 PurpleAccountSetting *setting; 2051 PurpleAccountUiOps *ui_ops; 2039 2052 2040 2053 g_return_if_fail(account != NULL); 2041 2054 g_return_if_fail(name != NULL); … … 2047 2060 2048 2061 g_hash_table_insert(account->settings, g_strdup(name), setting); 2049 2062 2063 ui_ops = purple_accounts_get_ui_ops(); 2064 2065 if (ui_ops != NULL && ui_ops->set_int != NULL) 2066 ui_ops->set_int(account, name, value); 2067 2050 2068 schedule_accounts_save(); 2051 2069 } 2052 2070 … … 2055 2073 const char *value) 2056 2074 { 2057 2075 PurpleAccountSetting *setting; 2076 PurpleAccountUiOps *ui_ops; 2058 2077 2059 2078 g_return_if_fail(account != NULL); 2060 2079 g_return_if_fail(name != NULL); … … 2066 2085 2067 2086 g_hash_table_insert(account->settings, g_strdup(name), setting); 2068 2087 2088 ui_ops = purple_accounts_get_ui_ops(); 2089 2090 if (ui_ops != NULL && ui_ops->set_string != NULL) 2091 ui_ops->set_string(account, name, value); 2092 2069 2093 schedule_accounts_save(); 2070 2094 } 2071 2095 … … 2073 2097 purple_account_set_bool(PurpleAccount *account, const char *name, gboolean value) 2074 2098 { 2075 2099 PurpleAccountSetting *setting; 2100 PurpleAccountUiOps *ui_ops; 2076 2101 2077 2102 g_return_if_fail(account != NULL); 2078 2103 g_return_if_fail(name != NULL); … … 2084 2109 2085 2110 g_hash_table_insert(account->settings, g_strdup(name), setting); 2086 2111 2112 ui_ops = purple_accounts_get_ui_ops(); 2113 2114 if (ui_ops != NULL && ui_ops->set_bool != NULL) 2115 ui_ops->set_bool(account, name, value); 2116 2087 2117 schedule_accounts_save(); 2088 2118 } 2089 2119 … … 2263 2293 2264 2294 p = purple_find_prpl(purple_account_get_protocol_id(account)); 2265 2295 2266 return ((p && p->info->name) ? _(p->info->name): _("Unknown"));2296 return ((p && p->info->name) ? p->info->name : _("Unknown")); 2267 2297 } 2268 2298 2269 2299 PurpleConnection * … … 2455 2485 const char *default_value) 2456 2486 { 2457 2487 PurpleAccountSetting *setting; 2488 const char *value; 2458 2489 2459 2490 g_return_val_if_fail(account != NULL, default_value); 2460 2491 g_return_val_if_fail(name != NULL, default_value); … … 2466 2497 2467 2498 g_return_val_if_fail(setting->type == PURPLE_PREF_STRING, default_value); 2468 2499 2469 return setting->value.string; 2500 value = setting->value.string; 2501 if (value == NULL || !*value) 2502 return default_value; 2503 2504 return value; 2470 2505 } 2471 2506 2472 2507 gboolean … … 2554 2589 return setting->value.boolean; 2555 2590 } 2556 2591 2592 #if 0 2557 2593 PurpleLog * 2558 2594 purple_account_get_log(PurpleAccount *account, gboolean create) 2559 2595 { … … 2584 2620 account->system_log = NULL; 2585 2621 } 2586 2622 } 2623 #endif 2587 2624 2588 2625 void 2589 2626 purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy) … … 3022 3059 purple_conversation_destroy(conv); 3023 3060 } 3024 3061 3025 /* Remove this account's pounces */3026 purple_pounce_destroy_all_by_account(account);3027 3028 3062 /* This will cause the deletion of an old buddy icon. */ 3029 3063 purple_buddy_icons_set_account_icon(account, NULL, 0); 3030 3064 … … 3207 3241 purple_marshal_VOID__POINTER, NULL, 1, 3208 3242 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT)); 3209 3243 3244 purple_signal_register(handle, "account-status-changing", 3245 purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, 3246 purple_value_new(PURPLE_TYPE_SUBTYPE, 3247 PURPLE_SUBTYPE_ACCOUNT), 3248 purple_value_new(PURPLE_TYPE_SUBTYPE, 3249 PURPLE_SUBTYPE_STATUS), 3250 purple_value_new(PURPLE_TYPE_SUBTYPE, 3251 PURPLE_SUBTYPE_STATUS)); 3252 3210 3253 purple_signal_register(handle, "account-status-changed", 3211 3254 purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, 3212 3255 purple_value_new(PURPLE_TYPE_SUBTYPE, … … 3292 3335 purple_accounts_uninit(void) 3293 3336 { 3294 3337 gpointer handle = purple_accounts_get_handle(); 3338 #if 0 3295 3339 if (save_timer != 0) 3296 3340 { 3297 3341 purple_timeout_remove(save_timer); 3298 3342 save_timer = 0; 3299 3343 sync_accounts(); 3300 3344 } 3301 3345 #endif 3302 3346 for (; accounts; accounts = g_list_delete_link(accounts, accounts)) 3303 3347 purple_account_destroy(accounts->data); 3304 3348 -
libpurple/account.h
diff -ru extract/pidgin-2.10.11/libpurple/account.h libpurple/account.h
old new 115 115 */ 116 116 void (*close_account_request)(void *ui_handle); 117 117 118 void (*set_int)(PurpleAccount *account, const char *name, int value); 119 void (*set_string)(PurpleAccount *account, const char *name, const char *value); 120 void (*set_bool)(PurpleAccount *account, const char *name, gboolean value); 121 118 122 void (*_purple_reserved1)(void); 119 123 void (*_purple_reserved2)(void); 120 124 void (*_purple_reserved3)(void); … … 944 948 * if the log has already been closed, which not all loggers deal 945 949 * with appropriately. 946 950 */ 947 PurpleLog *purple_account_get_log(PurpleAccount *account, gboolean create); 951 /* PurpleLog *purple_account_get_log(PurpleAccount *account, gboolean create); */ 948 952 949 953 /** 950 954 * Frees the system log of an account 951 955 * 952 956 * @param account The account. 953 957 */ 954 void purple_account_destroy_log(PurpleAccount *account); 958 /* void purple_account_destroy_log(PurpleAccount *account); */ 955 959 956 960 /** 957 961 * Adds a buddy to the server-side buddy list for the specified account. -
libpurple/blist.c
diff -ru extract/pidgin-2.10.11/libpurple/blist.c libpurple/blist.c
old new 28 28 #include "dbus-maybe.h" 29 29 #include "debug.h" 30 30 #include "notify.h" 31 #include "pounce.h"32 31 #include "prefs.h" 33 32 #include "privacy.h" 34 33 #include "prpl.h" … … 126 125 } 127 126 128 127 128 #if 0 129 129 /********************************************************************* 130 130 * Writing to disk * 131 131 *********************************************************************/ … … 601 601 parse_chat(group, cnode); 602 602 } 603 603 } 604 #endif 604 605 605 606 /* TODO: Make static and rename to load_blist */ 606 607 void 607 608 purple_blist_load() 608 609 { 610 #if 0 609 611 xmlnode *purple, *blist, *privacy; 612 #endif 610 613 611 614 blist_loaded = TRUE; 612 615 616 #if 0 613 617 purple = purple_util_read_xml_from_file("blist.xml", _("buddy list")); 614 618 615 619 if (purple == NULL) … … 671 675 672 676 /* This tells the buddy icon code to do its thing. */ 673 677 _purple_buddy_icons_blist_loaded_cb(); 678 #endif 674 679 } 675 680 676 681 … … 1624 1629 ((PurpleContact*)bnode->parent)->totalsize--; 1625 1630 /* the group totalsize will be taken care of by remove_contact below */ 1626 1631 1627 if (bnode->parent->parent != (PurpleBlistNode*)g) 1632 if (bnode->parent->parent != (PurpleBlistNode*)g) { 1633 purple_signal_emit(purple_blist_get_handle(), "buddy-removed-from-group", buddy); 1628 1634 serv_move_buddy(buddy, (PurpleGroup *)bnode->parent->parent, g); 1635 } 1629 1636 1630 1637 if (bnode->next) 1631 1638 bnode->next->prev = bnode->prev; … … 2186 2193 if (ops && ops->remove_node) 2187 2194 ops->remove_node(node); 2188 2195 2189 /* Remove this buddy's pounces */2190 purple_pounce_destroy_all_by_buddy(buddy);2191 2192 2196 /* Signal that the buddy has been removed before freeing the memory for it */ 2193 2197 purple_signal_emit(purple_blist_get_handle(), "buddy-removed", buddy); 2194 2198 … … 3092 3096 3093 3097 if (!ops) 3094 3098 return; 3095 3099 #if 0 3096 3100 if (!ops->save_node) { 3097 3101 ops->save_node = purple_blist_save_node; 3098 3102 overrode = TRUE; … … 3112 3116 purple_debug_warning("blist", "Only some of the blist saving UI ops " 3113 3117 "were overridden. This probably is not what you want!\n"); 3114 3118 } 3119 #endif 3115 3120 } 3116 3121 3117 3122 PurpleBlistUiOps * … … 3193 3198 purple_value_new(PURPLE_TYPE_SUBTYPE, 3194 3199 PURPLE_SUBTYPE_BLIST_BUDDY)); 3195 3200 3201 purple_signal_register(handle, "buddy-removed-from-group", 3202 purple_marshal_VOID__POINTER, NULL, 1, 3203 purple_value_new(PURPLE_TYPE_SUBTYPE, 3204 PURPLE_SUBTYPE_BLIST_BUDDY)); 3205 3196 3206 purple_signal_register(handle, "buddy-icon-changed", 3197 3207 purple_marshal_VOID__POINTER, NULL, 1, 3198 3208 purple_value_new(PURPLE_TYPE_SUBTYPE, … … 3239 3249 if (purplebuddylist == NULL) 3240 3250 return; 3241 3251 3252 #if 0 3242 3253 if (save_timer != 0) { 3243 3254 purple_timeout_remove(save_timer); 3244 3255 save_timer = 0; 3245 3256 purple_blist_sync(); 3246 3257 } 3258 #endif 3247 3259 3248 3260 purple_blist_destroy(); 3249 3261 -
libpurple/blist.h
diff -ru extract/pidgin-2.10.11/libpurple/blist.h libpurple/blist.h
old new 106 106 */ 107 107 #define PURPLE_CHAT(obj) ((PurpleChat *)(obj)) 108 108 109 #if 0 110 #include "media.h" 111 #else 112 /** extracted from media.h */ 113 /** Media caps */ 114 typedef enum { 115 PURPLE_MEDIA_CAPS_NONE = 0, 116 PURPLE_MEDIA_CAPS_AUDIO = 1, 117 PURPLE_MEDIA_CAPS_AUDIO_SINGLE_DIRECTION = 1 << 1, 118 PURPLE_MEDIA_CAPS_VIDEO = 1 << 2, 119 PURPLE_MEDIA_CAPS_VIDEO_SINGLE_DIRECTION = 1 << 3, 120 PURPLE_MEDIA_CAPS_AUDIO_VIDEO = 1 << 4, 121 PURPLE_MEDIA_CAPS_MODIFY_SESSION = 1 << 5, 122 PURPLE_MEDIA_CAPS_CHANGE_DIRECTION = 1 << 6 123 } PurpleMediaCaps; 124 125 /** Media session types */ 126 typedef enum { 127 PURPLE_MEDIA_NONE = 0, 128 PURPLE_MEDIA_RECV_AUDIO = 1 << 0, 129 PURPLE_MEDIA_SEND_AUDIO = 1 << 1, 130 PURPLE_MEDIA_RECV_VIDEO = 1 << 2, 131 PURPLE_MEDIA_SEND_VIDEO = 1 << 3, 132 PURPLE_MEDIA_AUDIO = PURPLE_MEDIA_RECV_AUDIO | PURPLE_MEDIA_SEND_AUDIO, 133 PURPLE_MEDIA_VIDEO = PURPLE_MEDIA_RECV_VIDEO | PURPLE_MEDIA_SEND_VIDEO 134 } PurpleMediaSessionType; 135 #endif 109 136 #include "account.h" 110 137 #include "buddyicon.h" 111 #include "media.h"112 138 #include "status.h" 113 139 114 140 /**************************************************************************/ … … 1088 1114 * the buddy list is saved automatically, so you should not need to 1089 1115 * call this. 1090 1116 */ 1091 void purple_blist_schedule_save(void); 1117 /* void purple_blist_schedule_save(void); */ 1092 1118 1093 1119 /** 1094 1120 * Requests from the user information needed to add a buddy to the -
libpurple/buddyicon.c
diff -ru extract/pidgin-2.10.11/libpurple/buddyicon.c libpurple/buddyicon.c
old new 187 187 188 188 g_return_if_fail(filename != NULL); 189 189 190 if (!purple_buddy_icons_is_caching()) 191 return; 192 190 193 /* It's possible that there are other references to this icon 191 194 * cache file that are not currently loaded into memory. */ 192 195 if (GPOINTER_TO_INT(g_hash_table_lookup(icon_file_cache, filename))) … … 1123 1126 } 1124 1127 1125 1128 void 1126 _purple_buddy_icons_account_loaded_cb()1129 purple_buddy_icons_account_loaded(PurpleAccount *account) 1127 1130 { 1128 const char *dirname = purple_buddy_icons_get_cache_dir(); 1129 GList *cur; 1131 const char *account_icon_file = purple_account_get_string(account, "buddy_icon", NULL); 1130 1132 1131 for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next)1133 if (account_icon_file != NULL) 1132 1134 { 1133 PurpleAccount *account = cur->data; 1134 const char *account_icon_file = purple_account_get_string(account, "buddy_icon", NULL); 1135 1136 if (account_icon_file != NULL) 1135 const char *dirname = purple_buddy_icons_get_cache_dir(); 1136 char *path = g_build_filename(dirname, account_icon_file, NULL); 1137 if (!g_file_test(path, G_FILE_TEST_EXISTS)) 1137 1138 { 1138 char *path = g_build_filename(dirname, account_icon_file, NULL); 1139 if (!g_file_test(path, G_FILE_TEST_EXISTS)) 1140 { 1141 purple_account_set_string(account, "buddy_icon", NULL); 1142 } else { 1143 ref_filename(account_icon_file); 1144 } 1145 g_free(path); 1139 purple_account_set_string(account, "buddy_icon", NULL); 1140 } else { 1141 ref_filename(account_icon_file); 1146 1142 } 1143 g_free(path); 1147 1144 } 1148 1145 } 1149 1146 1150 1147 void 1148 _purple_buddy_icons_account_loaded_cb() 1149 { 1150 GList *cur; 1151 1152 for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next) 1153 purple_buddy_icons_account_loaded(cur->data); 1154 } 1155 1156 void 1151 1157 _purple_buddy_icons_blist_loaded_cb() 1152 1158 { 1153 1159 PurpleBlistNode *node = purple_blist_get_root(); -
libpurple/buddyicon.h
diff -ru extract/pidgin-2.10.11/libpurple/buddyicon.h libpurple/buddyicon.h
old new 270 270 purple_buddy_icons_get_account_icon_timestamp(PurpleAccount *account); 271 271 272 272 /** 273 * References the current icon of the loaded account. 274 * 275 * UIs should call this after loading an account, if the accounts 276 * aren't stored in the accounts.xml libpurple file. 277 * 278 * @param account The account 279 */ 280 void 281 purple_buddy_icons_account_loaded(PurpleAccount *account); 282 283 /** 273 284 * Returns a boolean indicating if a given blist node has a custom buddy icon. 274 285 * 275 286 * @param node The blist node. -
libpurple/cmds.c
diff -ru extract/pidgin-2.10.11/libpurple/cmds.c libpurple/cmds.c
old new 27 27 #include "util.h" 28 28 #include "cmds.h" 29 29 30 static PurpleCommandsUiOps *cmds_ui_ops = NULL; 30 31 static GList *cmds = NULL; 31 32 static guint next_id = 1; 32 33 33 typedefstruct _PurpleCmd {34 struct _PurpleCmd { 34 35 PurpleCmdId id; 35 36 gchar *cmd; 36 37 gchar *args; … … 40 41 PurpleCmdFunc func; 41 42 gchar *help; 42 43 void *data; 43 } PurpleCmd;44 }; 44 45 45 46 46 47 static gint cmds_compare_func(const PurpleCmd *a, const PurpleCmd *b) … … 59 60 { 60 61 PurpleCmdId id; 61 62 PurpleCmd *c; 63 PurpleCommandsUiOps *ops; 62 64 63 65 g_return_val_if_fail(cmd != NULL && *cmd != '\0', 0); 64 66 g_return_val_if_fail(args != NULL, 0); … … 79 81 80 82 cmds = g_list_insert_sorted(cmds, c, (GCompareFunc)cmds_compare_func); 81 83 84 ops = purple_cmds_get_ui_ops(); 85 if (ops && ops->register_command) 86 ops->register_command(cmd, p, f, prpl_id, helpstr, c); 87 82 88 purple_signal_emit(purple_cmds_get_handle(), "cmd-added", cmd, p, f); 83 89 84 90 return id; … … 102 108 c = l->data; 103 109 104 110 if (c->id == id) { 111 PurpleCommandsUiOps *ops = purple_cmds_get_ui_ops(); 112 if (ops && ops->unregister_command) 113 ops->unregister_command(c->cmd, c->prpl_id); 114 105 115 cmds = g_list_remove(cmds, c); 106 116 purple_signal_emit(purple_cmds_get_handle(), "cmd-removed", c->cmd); 107 117 purple_cmd_free(c); … … 301 311 302 312 } 303 313 314 gboolean purple_cmd_execute(PurpleCmd *c, PurpleConversation *conv, 315 const gchar *cmdline) 316 { 317 gchar *err = NULL; 318 gchar **args = NULL; 319 PurpleCmdRet ret = PURPLE_CMD_RET_CONTINUE; 320 321 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { 322 if (!(c->flags & PURPLE_CMD_FLAG_IM)) 323 return FALSE; 324 } 325 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { 326 if (!(c->flags & PURPLE_CMD_FLAG_CHAT)) 327 return FALSE; 328 } 329 else 330 return FALSE; 331 332 /* XXX: Don't worry much about the markup version of the command 333 line, there's not a single use case... */ 334 /* this checks the allow bad args flag for us */ 335 if (!purple_cmd_parse_args(c, cmdline, cmdline, &args)) { 336 g_strfreev(args); 337 return FALSE; 338 } 339 340 ret = c->func(conv, c->cmd, args, &err, c->data); 341 342 g_free(err); 343 g_strfreev(args); 344 345 return ret == PURPLE_CMD_RET_OK; 346 } 304 347 305 348 GList *purple_cmd_list(PurpleConversation *conv) 306 349 { … … 368 411 return &handle; 369 412 } 370 413 414 void 415 purple_cmds_set_ui_ops(PurpleCommandsUiOps *ops) 416 { 417 cmds_ui_ops = ops; 418 } 419 420 PurpleCommandsUiOps * 421 purple_cmds_get_ui_ops(void) 422 { 423 /* It is perfectly acceptable for cmds_ui_ops to be NULL; this just 424 * means that the default libpurple implementation will be used. 425 */ 426 return cmds_ui_ops; 427 } 428 371 429 void purple_cmds_init(void) 372 430 { 373 431 gpointer handle = purple_cmds_get_handle(); -
libpurple/cmds.h
diff -ru extract/pidgin-2.10.11/libpurple/cmds.h libpurple/cmds.h
old new 31 31 /**************************************************************************/ 32 32 /*@{*/ 33 33 34 typedef struct _PurpleCmd PurpleCmd; 35 34 36 /** The possible results of running a command with purple_cmd_do_command(). */ 35 37 typedef enum _PurpleCmdStatus { 36 38 PURPLE_CMD_STATUS_OK, … … 96 98 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS = 0x08 97 99 } PurpleCmdFlag; 98 100 101 /** 102 * Command UI operations; UIs should implement this if they want to handle 103 * commands themselves, rather than relying on the core. 104 * 105 * @see @ref ui-ops 106 */ 107 typedef struct 108 { 109 /** If implemented, the UI is responsible for handling commands. */ 110 /* @see purple_cmd_register for the argument values. */ 111 void (*register_command)(const gchar *name, PurpleCmdPriority p, 112 PurpleCmdFlag f, const gchar *prpl_id, 113 const gchar *helpstr, PurpleCmd *cmd); 114 115 /** Should be implemented if register_command is implemented. 116 * name and prpl_id should have the same value that were used 117 * for the register_command call. 118 */ 119 void (*unregister_command)(const gchar *name, const gchar *prpl_id); 120 121 void (*_purple_reserved1)(void); 122 void (*_purple_reserved2)(void); 123 void (*_purple_reserved3)(void); 124 void (*_purple_reserved4)(void); 125 } PurpleCommandsUiOps; 99 126 100 127 /*@}*/ 101 128 … … 194 221 const gchar *markup, gchar **errormsg); 195 222 196 223 /** 224 * Execute a specific command. 225 * 226 * The UI calls this to execute a command, after parsing the 227 * command name. 228 * 229 * @param c The command to execute. 230 * @param conv The conversation the command was typed in. 231 * @param cmdline The command the user typed (only the arguments). 232 * The caller should remove the prefix and the command name. 233 * It should not contain any formatting, and should be 234 * in plain text (no html entities). 235 * @return TRUE if the command handled the cmdline, FALSE otherwise. 236 */ 237 gboolean purple_cmd_execute(PurpleCmd *c, PurpleConversation *conv, 238 const gchar *cmdline); 239 240 /** 197 241 * List registered commands. 198 242 * 199 243 * Returns a <tt>GList</tt> (which must be freed by the caller) of all commands … … 230 274 gpointer purple_cmds_get_handle(void); 231 275 232 276 /** 277 * Sets the UI operations structure to be used when registering and 278 * unregistering commands. The UI operations need only be set if the 279 * UI wants to handle the commands itself; otherwise, leave it as NULL. 280 * 281 * @param ops The UI operations structure. 282 */ 283 void purple_cmds_set_ui_ops(PurpleCommandsUiOps *ops); 284 285 /** 286 * Returns the UI operations structure to be used when registering and 287 * unregistering commands. 288 * 289 * @return The UI operations structure. 290 */ 291 PurpleCommandsUiOps *purple_cmds_get_ui_ops(void); 292 293 /** 233 294 * Initialize the commands subsystem. 234 295 * @since 2.5.0 235 296 */ -
libpurple/connection.c
Only in libpurple: config.h diff -ru extract/pidgin-2.10.11/libpurple/connection.c libpurple/connection.c
old new 350 350 /* Set the time the account came online */ 351 351 purple_presence_set_login_time(presence, time(NULL)); 352 352 353 #if 0 353 354 if (purple_prefs_get_bool("/purple/logging/log_system")) 354 355 { 355 356 PurpleLog *log = purple_account_get_log(account, TRUE); … … 365 366 g_free(msg); 366 367 } 367 368 } 369 #endif 368 370 369 371 if (ops != NULL && ops->connected != NULL) 370 372 ops->connected(gc); … … 381 383 else if (gc->state == PURPLE_DISCONNECTED) { 382 384 PurpleAccount *account = purple_connection_get_account(gc); 383 385 386 #if 0 384 387 if (purple_prefs_get_bool("/purple/logging/log_system")) 385 388 { 386 389 PurpleLog *log = purple_account_get_log(account, FALSE); … … 397 400 } 398 401 399 402 purple_account_destroy_log(account); 403 #endif 400 404 401 405 if (ops != NULL && ops->disconnected != NULL) 402 406 ops->disconnected(gc); -
libpurple/conversation.c
diff -ru extract/pidgin-2.10.11/libpurple/conversation.c libpurple/conversation.c
old new 153 153 154 154 type = purple_conversation_get_type(conv); 155 155 156 #if 0 156 157 /* Always linkfy the text for display, unless we're 157 158 * explicitly asked to do otheriwse*/ 158 159 if (!(msgflags & PURPLE_MESSAGE_INVISIBLE)) { … … 167 168 sent = g_strdup(displayed); 168 169 } else 169 170 sent = g_strdup(message); 171 #else 172 /* send and display as is, linkification has already been 173 handled by the conversation binding */ 174 displayed = g_strdup(message); 175 sent = g_strdup(message); 176 #endif 170 177 171 178 msgflags |= PURPLE_MESSAGE_SEND; 172 179 … … 238 245 g_free(sent); 239 246 } 240 247 248 #if 0 241 249 static void 242 250 open_log(PurpleConversation *conv) 243 251 { … … 245 253 PURPLE_LOG_IM, conv->name, conv->account, 246 254 conv, time(NULL), NULL)); 247 255 } 256 #endif 248 257 249 258 /* Functions that deal with PurpleConvMessage */ 250 259 … … 307 316 308 317 account = purple_conversation_get_account(conv); 309 318 319 #if 0 310 320 purple_conversation_close_logs(conv); 311 321 open_log(conv); 322 #endif 312 323 313 324 gc = purple_account_get_connection(account); 314 325 … … 398 409 purple_buddy_icon_unref(icon); 399 410 } 400 411 412 #if 0 401 413 if (purple_prefs_get_bool("/purple/logging/log_ims")) 402 414 { 403 415 purple_conversation_set_logging(conv, TRUE); 404 416 open_log(conv); 405 417 } 418 #endif 406 419 } 407 420 else if (type == PURPLE_CONV_TYPE_CHAT) 408 421 { … … 422 435 purple_conv_chat_set_nick(conv->u.chat, 423 436 purple_account_get_username(account)); 424 437 438 #if 0 425 439 if (purple_prefs_get_bool("/purple/logging/log_chats")) 426 440 { 427 441 purple_conversation_set_logging(conv, TRUE); 428 442 open_log(conv); 429 443 } 444 #endif 430 445 } 431 446 432 447 conversations = g_list_prepend(conversations, conv); … … 598 613 ops->destroy_conversation(conv); 599 614 conv->ui_data = NULL; 600 615 616 #if 0 601 617 purple_conversation_close_logs(conv); 618 #endif 602 619 603 620 purple_conversation_clear_message_history(conv); 604 621 … … 800 817 return conv->name; 801 818 } 802 819 820 #if 0 803 821 void 804 822 purple_conversation_set_logging(PurpleConversation *conv, gboolean log) 805 823 { … … 829 847 g_list_free(conv->logs); 830 848 conv->logs = NULL; 831 849 } 850 #endif 832 851 833 852 PurpleConvIm * 834 853 purple_conversation_get_im_data(const PurpleConversation *conv) … … 1008 1027 } 1009 1028 } 1010 1029 1030 #if 0 1011 1031 if (!(flags & PURPLE_MESSAGE_NO_LOG) && purple_conversation_is_logging(conv)) { 1012 1032 GList *log; 1013 1033 … … 1020 1040 log = log->next; 1021 1041 } 1022 1042 } 1043 #endif 1023 1044 1024 1045 if (ops && ops->write_conv) 1025 1046 ops->write_conv(conv, who, alias, displayed, flags, mtime); … … 1242 1263 1243 1264 if ((flags & PURPLE_MESSAGE_RECV) == PURPLE_MESSAGE_RECV) { 1244 1265 purple_conv_im_set_typing_state(im, PURPLE_NOT_TYPING); 1266 purple_conv_im_update_typing(im); 1245 1267 } 1246 1268 1247 1269 /* Pass this on to either the ops structure or the default write func. */ -
libpurple/conversation.h
diff -ru extract/pidgin-2.10.11/libpurple/conversation.h libpurple/conversation.h
old new 568 568 * @param conv The conversation. 569 569 * @param log @c TRUE if logging should be enabled, or @c FALSE otherwise. 570 570 */ 571 void purple_conversation_set_logging(PurpleConversation *conv, gboolean log); 571 /* void purple_conversation_set_logging(PurpleConversation *conv, gboolean log); */ 572 572 573 573 /** 574 574 * Returns whether or not logging is enabled for this conversation. … … 577 577 * 578 578 * @return @c TRUE if logging is enabled, or @c FALSE otherwise. 579 579 */ 580 gboolean purple_conversation_is_logging(const PurpleConversation *conv); 580 /* gboolean purple_conversation_is_logging(const PurpleConversation *conv); */ 581 581 582 582 /** 583 583 * Closes any open logs for this conversation. … … 588 588 * 589 589 * @param conv The conversation. 590 590 */ 591 void purple_conversation_close_logs(PurpleConversation *conv); 591 /* void purple_conversation_close_logs(PurpleConversation *conv); */ 592 592 593 593 /** 594 594 * Returns the specified conversation's IM-specific data. -
libpurple/core.c
diff -ru extract/pidgin-2.10.11/libpurple/core.c libpurple/core.c
old new 25 25 */ 26 26 #include "internal.h" 27 27 #include "cipher.h" 28 #include "certificate.h"29 28 #include "cmds.h" 30 29 #include "connection.h" 31 30 #include "conversation.h" … … 38 37 #include "network.h" 39 38 #include "notify.h" 40 39 #include "plugin.h" 41 #include "pounce.h"42 40 #include "prefs.h" 43 41 #include "privacy.h" 44 42 #include "proxy.h" 45 #include "savedstatuses.h"46 43 #include "signals.h" 47 44 #include "smiley.h" 48 #include "sound.h"49 #include "sound-theme-loader.h"50 45 #include "sslconn.h" 51 46 #include "status.h" 52 47 #include "stun.h" 53 #include "theme-manager.h"54 48 #include "util.h" 55 49 56 50 #ifdef HAVE_DBUS … … 63 57 # include "dbus-bindings.h" 64 58 #endif 65 59 60 #include <libxml/parser.h> 61 66 62 struct PurpleCore 67 63 { 68 64 char *ui; … … 73 69 static PurpleCoreUiOps *_ops = NULL; 74 70 static PurpleCore *_core = NULL; 75 71 72 #ifdef STATIC_PROTO_INIT 76 73 STATIC_PROTO_INIT 74 #endif 77 75 78 76 gboolean 79 77 purple_core_init(const char *ui) … … 120 118 * for protocol prefs to work. */ 121 119 purple_prefs_init(); 122 120 123 purple_debug_init();124 125 121 if (ops != NULL) 126 122 { 127 123 if (ops->ui_prefs_init != NULL) … … 143 139 */ 144 140 purple_plugins_init(); 145 141 142 #ifdef STATIC_PROTO_INIT 146 143 /* Initialize all static protocols. */ 147 144 static_proto_init(); 145 #endif 148 146 149 purple_plugins_probe(G_MODULE_SUFFIX); 147 if (ops != NULL && ops->register_plugins != NULL) 148 ops->register_plugins(); 150 149 151 purple_ theme_manager_init();150 purple_plugins_probe(G_MODULE_SUFFIX); 152 151 153 152 /* The buddy icon code uses the imgstore, so init it early. */ 154 153 purple_imgstore_init(); … … 161 160 purple_connections_init(); 162 161 163 162 purple_accounts_init(); 164 purple_savedstatuses_init();165 163 purple_notify_init(); 166 purple_certificate_init();167 164 purple_conversations_init(); 168 165 purple_blist_init(); 169 166 purple_log_init(); 170 167 purple_network_init(); 171 168 purple_privacy_init(); 172 purple_pounces_init();173 169 purple_proxy_init(); 174 170 purple_dnsquery_init(); 175 purple_sound_init();176 171 purple_ssl_init(); 177 172 purple_stun_init(); 178 173 purple_xfers_init(); … … 187 182 if (ops != NULL && ops->ui_init != NULL) 188 183 ops->ui_init(); 189 184 190 /* The UI may have registered some theme types, so refresh them */191 purple_theme_manager_refresh();192 193 185 return TRUE; 194 186 } 195 187 … … 207 199 /* Transmission ends */ 208 200 purple_connections_disconnect_all(); 209 201 202 #if 0 210 203 /* 211 204 * Certificates must be destroyed before the SSL plugins, because 212 205 * PurpleCertificates contain pointers to PurpleCertificateSchemes, … … 214 207 * SSL plugin is uninit. 215 208 */ 216 209 purple_certificate_uninit(); 210 #endif 217 211 218 212 /* The SSL plugins must be uninit before they're unloaded */ 219 213 purple_ssl_uninit(); … … 226 220 /* Save .xml files, remove signals, etc. */ 227 221 purple_smileys_uninit(); 228 222 purple_idle_uninit(); 229 purple_pounces_uninit();230 223 purple_blist_uninit(); 231 224 purple_ciphers_uninit(); 232 225 purple_notify_uninit(); 233 226 purple_conversations_uninit(); 234 227 purple_connections_uninit(); 235 228 purple_buddy_icons_uninit(); 236 purple_savedstatuses_uninit();237 229 purple_status_uninit(); 238 230 purple_accounts_uninit(); 239 purple_sound_uninit();240 purple_theme_manager_uninit();241 231 purple_xfers_uninit(); 242 232 purple_proxy_uninit(); 243 233 purple_dnsquery_uninit(); … … 274 264 wpurple_cleanup(); 275 265 #endif 276 266 267 xmlCleanupParser(); 268 277 269 _core = NULL; 278 270 } 279 271 … … 406 398 return TRUE; 407 399 } 408 400 401 #if 0 409 402 gboolean 410 403 purple_core_migrate(void) 411 404 { … … 753 746 g_free(status_file); 754 747 return TRUE; 755 748 } 749 #endif 756 750 757 751 GHashTable* purple_core_get_ui_info() { 758 752 PurpleCoreUiOps *ops = purple_core_get_ui_ops(); -
libpurple/core.h
diff -ru extract/pidgin-2.10.11/libpurple/core.h libpurple/core.h
old new 71 71 */ 72 72 GHashTable* (*get_ui_info)(void); 73 73 74 /** Called during the initialization of the core to give the 75 * UI a chance to register static plugins. 76 */ 77 void (*register_plugins)(void); 78 74 79 void (*_purple_reserved1)(void); 75 80 void (*_purple_reserved2)(void); 76 81 void (*_purple_reserved3)(void); … … 164 169 * @return A boolean indicating success or migration failure. On failure, 165 170 * the application must display an error to the user and then exit. 166 171 */ 167 gboolean purple_core_migrate(void); 172 /* gboolean purple_core_migrate(void); */ 168 173 169 174 /** 170 175 * Ensures that only one instance is running. If libpurple is built with D-Bus -
libpurple/debug.c
Only in extract/pidgin-2.10.11/libpurple: data diff -ru extract/pidgin-2.10.11/libpurple/debug.c libpurple/debug.c
old new 31 31 static PurpleDebugUiOps *debug_ui_ops = NULL; 32 32 33 33 /* 34 * This determines whether debug info should be written to the35 * console or not.36 *37 * It doesn't make sense to make this a normal Purple preference38 * because it's a command line option. This will always be FALSE,39 * unless the user explicitly started the UI with the -d flag.40 * It doesn't matter what this value was the last time Purple was41 * started, so it doesn't make sense to save it in prefs.42 */43 static gboolean debug_enabled = FALSE;44 45 /*46 34 * These determine whether verbose or unsafe debugging are desired. I 47 35 * don't want to make these purple preferences because their values should 48 36 * not be remembered across instances of the UI. … … 50 38 static gboolean debug_verbose = FALSE; 51 39 static gboolean debug_unsafe = FALSE; 52 40 53 static void 54 purple_debug_vargs(PurpleDebugLevel level, const char *category, 55 const char *format, va_list args) 41 void 42 purple_debug_with_location(PurpleDebugLevel level, const char *category, 43 const char *file, int line, const char *function, 44 const char *format, ...) 56 45 { 46 va_list args; 57 47 PurpleDebugUiOps *ops; 58 48 char *arg_s = NULL; 59 49 … … 61 51 g_return_if_fail(format != NULL); 62 52 63 53 ops = purple_debug_get_ui_ops(); 64 65 if (!debug_enabled && ((ops == NULL) || (ops->print == NULL) ||66 (ops->is_enabled && !ops->is_enabled(level, category))))54 if ((ops == NULL) || 55 (ops->print_with_location == NULL && ops->print == NULL) || 56 (ops->is_enabled && !ops->is_enabled(level, category))) 67 57 return; 68 58 69 arg_s = g_strdup_vprintf(format, args); 70 71 if (debug_enabled) { 72 gchar *ts_s; 73 const char *mdate; 74 time_t mtime = time(NULL); 75 76 77 mdate = purple_utf8_strftime("%H:%M:%S", localtime(&mtime)); 78 ts_s = g_strdup_printf("(%s) ", mdate); 79 80 if (category == NULL) 81 g_print("%s%s", ts_s, arg_s); 82 else 83 g_print("%s%s: %s", ts_s, category, arg_s); 84 85 g_free(ts_s); 86 } 59 va_start(args, format); 87 60 88 if (ops != NULL && ops->print != NULL) 61 arg_s = g_strdup_vprintf(format, args); 62 if (ops->print_with_location != NULL) 63 ops->print_with_location(level, category, file, line, function, arg_s); 64 else 89 65 ops->print(level, category, arg_s); 90 91 66 g_free(arg_s); 92 }93 94 void95 purple_debug(PurpleDebugLevel level, const char *category,96 const char *format, ...)97 {98 va_list args;99 100 g_return_if_fail(level != PURPLE_DEBUG_ALL);101 g_return_if_fail(format != NULL);102 103 va_start(args, format);104 purple_debug_vargs(level, category, format, args);105 va_end(args);106 }107 67 108 void109 purple_debug_misc(const char *category, const char *format, ...)110 {111 va_list args;112 113 g_return_if_fail(format != NULL);114 115 va_start(args, format);116 purple_debug_vargs(PURPLE_DEBUG_MISC, category, format, args);117 68 va_end(args); 118 69 } 119 70 120 void 121 purple_debug_info(const char *category, const char *format, ...) 122 { 123 va_list args; 71 /* This is kept for ABI compatibility only. Should be removed once we 72 * change the version number and thus can safely assume that all old 73 * plugins will be disabled. 74 * New code uses purple_debug_with_location. */ 75 #undef purple_debug 76 #undef purple_debug_misc 77 #undef purple_debug_info 78 #undef purple_debug_warning 79 #undef purple_debug_error 80 #undef purple_debug_fatal 124 81 125 g_return_if_fail(format != NULL); 126 127 va_start(args, format); 128 purple_debug_vargs(PURPLE_DEBUG_INFO, category, format, args); 129 va_end(args); 130 } 131 132 void 133 purple_debug_warning(const char *category, const char *format, ...) 82 static void 83 purple_debug_vargs(PurpleDebugLevel level, const char *category, 84 const char *format, va_list args) 134 85 { 135 va_list args; 86 PurpleDebugUiOps *ops; 87 char *arg_s = NULL; 136 88 89 g_return_if_fail(level != PURPLE_DEBUG_ALL); 137 90 g_return_if_fail(format != NULL); 138 91 139 va_start(args, format); 140 purple_debug_vargs(PURPLE_DEBUG_WARNING, category, format, args); 141 va_end(args); 142 } 143 144 void 145 purple_debug_error(const char *category, const char *format, ...) 146 { 147 va_list args; 92 ops = purple_debug_get_ui_ops(); 148 93 149 g_return_if_fail(format != NULL); 94 if ((ops == NULL) || (ops->print == NULL) || 95 (ops->is_enabled && !ops->is_enabled(level, category))) 96 return; 150 97 151 va_start(args, format);152 purple_debug_vargs(PURPLE_DEBUG_ERROR, category, format, args);153 va_end(args);98 arg_s = g_strdup_vprintf(format, args); 99 ops->print(level, category, arg_s); 100 g_free(arg_s); 154 101 } 155 102 156 103 void 157 purple_debug_fatal(const char *category, const char *format, ...) 104 purple_debug(PurpleDebugLevel level, const char *category, 105 const char *format, ...) 158 106 { 159 107 va_list args; 160 108 109 g_return_if_fail(level != PURPLE_DEBUG_ALL); 161 110 g_return_if_fail(format != NULL); 162 111 163 112 va_start(args, format); 164 purple_debug_vargs( PURPLE_DEBUG_FATAL, category, format, args);113 purple_debug_vargs(level, category, format, args); 165 114 va_end(args); 166 115 } 167 116 168 void 169 purple_debug_set_enabled(gboolean enabled) 170 { 171 debug_enabled = enabled; 172 } 173 174 gboolean 175 purple_debug_is_enabled() 176 { 177 return debug_enabled; 178 } 117 #define PURPLE_IMPL_DEBUG_HELPER(name, NAME) \ 118 void \ 119 purple_debug_##name(const char *category, const char *format, ...) \ 120 { \ 121 va_list args; \ 122 \ 123 g_return_if_fail(format != NULL); \ 124 \ 125 va_start(args, format); \ 126 purple_debug_vargs(PURPLE_DEBUG_##NAME, category, format, args); \ 127 va_end(args); \ 128 } 129 130 PURPLE_IMPL_DEBUG_HELPER(misc, MISC) 131 PURPLE_IMPL_DEBUG_HELPER(info, INFO) 132 PURPLE_IMPL_DEBUG_HELPER(warning, WARNING) 133 PURPLE_IMPL_DEBUG_HELPER(error, ERROR) 134 PURPLE_IMPL_DEBUG_HELPER(fatal, FATAL) 135 /* End of the code kept for ABI compatibility */ 179 136 180 137 void 181 138 purple_debug_set_ui_ops(PurpleDebugUiOps *ops) … … 212 169 { 213 170 return debug_ui_ops; 214 171 } 215 216 void217 purple_debug_init(void)218 {219 /* Read environment variables once per init */220 if(g_getenv("PURPLE_UNSAFE_DEBUG"))221 purple_debug_set_unsafe(TRUE);222 223 if(g_getenv("PURPLE_VERBOSE_DEBUG"))224 purple_debug_set_verbose(TRUE);225 226 purple_prefs_add_none("/purple/debug");227 228 /*229 * This pref is obsolete and no longer referenced anywhere. It only230 * survives here because it would be an API break if we removed it.231 * Remove this when we get to 3.0.0 :)232 */233 purple_prefs_add_bool("/purple/debug/timestamps", TRUE);234 }235 -
libpurple/debug.h
diff -ru extract/pidgin-2.10.11/libpurple/debug.h libpurple/debug.h
old new 50 50 { 51 51 void (*print)(PurpleDebugLevel level, const char *category, 52 52 const char *arg_s); 53 void (*print_with_location)(PurpleDebugLevel level, const char *category, 54 const char *file, int line, 55 const char *function, const char *arg_s); 53 56 gboolean (*is_enabled)(PurpleDebugLevel level, 54 57 const char *category); 55 58 … … 66 69 /**************************************************************************/ 67 70 /** @name Debug API */ 68 71 /**************************************************************************/ 72 69 73 /** 70 74 * Outputs debug information. 71 75 * 72 76 * @param level The debug level. 73 77 * @param category The category (or @c NULL). 78 * @param file The file containing the calling code. 79 * @param line The line number. 80 * @param function The calling function. 74 81 * @param format The format string. 75 82 */ 83 void purple_debug_with_location(PurpleDebugLevel level, const char *category, 84 const char *file, int line, 85 const char *function, const char *format, ...); 86 87 #ifndef _MSC_VER 88 /* The use of __VA_ARGS__ will cause gcc to annoyingly output this warning: 89 * warning: anonymous variadic macros were introduced in C99 90 * Tell it to shut up... 91 */ 92 #pragma GCC system_header 93 #endif 94 95 /** 96 * Outputs debug information. 97 * 98 * @param level The debug level. 99 * @param category The category (or @c NULL). 100 * @param format The format string. 101 */ 102 /* 76 103 void purple_debug(PurpleDebugLevel level, const char *category, 77 104 const char *format, ...) G_GNUC_PRINTF(3, 4); 105 */ 106 #define purple_debug(level, category, ...) \ 107 purple_debug_with_location(level, category, __FILE__, __LINE__, \ 108 __FUNCTION__, __VA_ARGS__) 78 109 79 110 /** 80 111 * Outputs misc. level debug information. … … 87 118 * 88 119 * @see purple_debug() 89 120 */ 121 /* 90 122 void purple_debug_misc(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3); 123 */ 124 #define purple_debug_misc(category, ...) \ 125 purple_debug(PURPLE_DEBUG_MISC, category, __VA_ARGS__) 91 126 92 127 /** 93 128 * Outputs info level debug information. … … 100 135 * 101 136 * @see purple_debug() 102 137 */ 138 /* 103 139 void purple_debug_info(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3); 140 */ 141 #define purple_debug_info(category, ...) \ 142 purple_debug(PURPLE_DEBUG_INFO, category, __VA_ARGS__) 104 143 105 144 /** 106 145 * Outputs warning level debug information. … … 113 152 * 114 153 * @see purple_debug() 115 154 */ 155 /* 116 156 void purple_debug_warning(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3); 157 */ 158 #define purple_debug_warning(category, ...) \ 159 purple_debug(PURPLE_DEBUG_WARNING, category, __VA_ARGS__) 117 160 118 161 /** 119 162 * Outputs error level debug information. … … 126 169 * 127 170 * @see purple_debug() 128 171 */ 172 /* 129 173 void purple_debug_error(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3); 174 */ 175 #define purple_debug_error(category, ...) \ 176 purple_debug(PURPLE_DEBUG_ERROR, category, __VA_ARGS__) 130 177 131 178 /** 132 179 * Outputs fatal error level debug information. 133 180 * 134 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_ ERRORas181 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_FATAL as 135 182 * the level. 136 183 * 137 184 * @param category The category (or @c NULL). … … 139 186 * 140 187 * @see purple_debug() 141 188 */ 189 /* 142 190 void purple_debug_fatal(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3); 143 144 /** 145 * Enable or disable printing debug output to the console. 146 * 147 * @param enabled TRUE to enable debug output or FALSE to disable it. 148 */ 149 void purple_debug_set_enabled(gboolean enabled); 150 151 /** 152 * Check if console debug output is enabled. 153 * 154 * @return TRUE if debugging is enabled, FALSE if it is not. 155 */ 156 gboolean purple_debug_is_enabled(void); 191 */ 192 #define purple_debug_fatal(category, ...) \ 193 purple_debug(PURPLE_DEBUG_FATAL, category, __VA_ARGS__) 157 194 158 195 /** 159 196 * Enable or disable verbose debugging. This ordinarily should only be called … … 224 261 225 262 /*@}*/ 226 263 227 /**************************************************************************/228 /** @name Debug Subsystem */229 /**************************************************************************/230 /*@{*/231 232 /**233 * Initializes the debug subsystem.234 */235 void purple_debug_init(void);236 237 /*@}*/238 239 264 #ifdef __cplusplus 240 265 } 241 266 #endif -
libpurple/dnsquery.c
diff -ru extract/pidgin-2.10.11/libpurple/dnsquery.c libpurple/dnsquery.c
old new 40 40 41 41 #define MAX_ADDR_RESPONSE_LEN 1048576 42 42 43 #if (defined(__APPLE__) || defined (__unix__)) && !defined(__osf__)44 #define PURPLE_DNSQUERY_USE_FORK45 #endif46 43 /************************************************************************** 47 44 * DNS query API 48 45 **************************************************************************/ … … 902 899 return FALSE; 903 900 } 904 901 905 if (purple_dnsquery_ui_resolve(query_data)) 906 /* The UI is handling the resolve; we're done */ 907 return FALSE; 908 909 resolve_host(query_data); 910 902 g_return_val_if_fail(purple_dnsquery_ui_resolve(query_data), FALSE); 903 /* The UI is handling the resolve; we're done */ 911 904 return FALSE; 912 905 } 913 906 -
libpurple/eventloop.c
diff -ru extract/pidgin-2.10.11/libpurple/eventloop.c libpurple/eventloop.c
old new 25 25 */ 26 26 #include "internal.h" 27 27 #include "eventloop.h" 28 #include "debug.h" 28 29 29 30 static PurpleEventLoopUiOps *eventloop_ui_ops = NULL; 30 31 … … 56 57 } 57 58 58 59 guint 59 purple_input_add(int source, PurpleInputCondition condition, PurpleInputFunction func, gpointer user_data) 60 purple_input_add_with_location(int source, PurpleInputCondition condition, 61 PurpleInputFunction func, gpointer user_data, 62 const char *file, int line, const char *function) 60 63 { 61 64 PurpleEventLoopUiOps *ops = purple_eventloop_get_ui_ops(); 62 65 66 purple_debug_with_location(PURPLE_DEBUG_MISC, "eventloop", 67 file, line, function, 68 "purple_input_add, fd = %i", source); 63 69 return ops->input_add(source, condition, func, user_data); 64 70 } 65 71 72 73 66 74 gboolean 67 purple_input_remove(guint tag) 75 purple_input_remove_with_location(guint tag, const char *file, int line, 76 const char *function) 68 77 { 69 78 PurpleEventLoopUiOps *ops = purple_eventloop_get_ui_ops(); 70 79 80 purple_debug_with_location(PURPLE_DEBUG_MISC, "eventloop", 81 file, line, function, 82 "purple_input_remove, handle = %i", tag); 83 71 84 return ops->input_remove(tag); 72 85 } 73 86 -
libpurple/eventloop.h
diff -ru extract/pidgin-2.10.11/libpurple/eventloop.h libpurple/eventloop.h
old new 217 217 * @return The resulting handle (will be greater than 0). 218 218 * @see g_io_add_watch_full 219 219 */ 220 guint purple_input_add(int fd, PurpleInputCondition cond, 221 PurpleInputFunction func, gpointer user_data); 220 /* guint purple_input_add(int fd, PurpleInputCondition cond, 221 PurpleInputFunction func, gpointer user_data); */ 222 guint purple_input_add_with_location(int fd, PurpleInputCondition cond, 223 PurpleInputFunction func, 224 gpointer user_data, 225 const char *file, int line, 226 const char *function); 227 228 #define purple_input_add(fd, cond, func, user_data) \ 229 purple_input_add_with_location(fd, cond, func, user_data, __FILE__, \ 230 __LINE__, __FUNCTION__) 222 231 223 232 /** 224 233 * Removes an input handler. … … 226 235 * @param handle The handle of the input handler. Note that this is the return 227 236 * value from purple_input_add(), <i>not</i> the file descriptor. 228 237 */ 229 gboolean purple_input_remove(guint handle); 238 /* gboolean purple_input_remove(guint handle); */ 239 gboolean purple_input_remove_with_location(guint handle, const char *file, 240 int line, const char *function); 241 242 #define purple_input_remove(handle) \ 243 purple_input_remove_with_location(handle, __FILE__, __LINE__, __FUNCTION__) 230 244 231 245 /** 232 246 * Get the current error status for an input. -
libpurple/ft.c
diff -ru extract/pidgin-2.10.11/libpurple/ft.c libpurple/ft.c
old new 279 279 const char *message, gboolean is_error, gboolean print_thumbnail) 280 280 { 281 281 PurpleConversation *conv = NULL; 282 PurpleMessageFlags flags = PURPLE_MESSAGE_SYSTEM ;282 PurpleMessageFlags flags = PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY; 283 283 char *escaped; 284 284 gconstpointer thumbnail_data; 285 285 gsize size; -
libpurple/idle.c
Only in libpurple: gettext.c Only in libpurple: gettext.h diff -ru extract/pidgin-2.10.11/libpurple/idle.c libpurple/idle.c
old new 24 24 25 25 #include "connection.h" 26 26 #include "debug.h" 27 #include "eventloop.h"28 27 #include "idle.h" 29 #include "log.h"30 #include "prefs.h"31 #include "savedstatuses.h"32 28 #include "signals.h" 33 29 34 typedef enum35 {36 PURPLE_IDLE_NOT_AWAY = 0,37 PURPLE_IDLE_AUTO_AWAY,38 PURPLE_IDLE_AWAY_BUT_NOT_AUTO_AWAY39 40 } PurpleAutoAwayState;41 42 static PurpleIdleUiOps *idle_ui_ops = NULL;43 44 30 /** 45 31 * This is needed for the I'dle Mak'er plugin to work correctly. We 46 32 * use it to determine if we're the ones who set our accounts idle … … 51 37 */ 52 38 static GList *idled_accts = NULL; 53 39 54 static guint idle_timer = 0;55 56 static time_t last_active_time = 0;57 58 40 static void 59 41 set_account_idle(PurpleAccount *account, int time_idle) 60 42 { … … 90 72 purple_presence_set_idle(presence, FALSE, 0); 91 73 } 92 74 93 94 static gboolean no_away = FALSE; 95 static gint time_until_next_idle_event; 96 /* 97 * This function should be called when you think your idle state 98 * may have changed. Maybe you're over the 10-minute mark and 99 * Purple should start reporting idle time to the server. Maybe 100 * you've returned from being idle. Maybe your auto-away message 101 * should be set. 102 * 103 * There is no harm to calling this many many times, other than 104 * it will be kinda slow. This is called by a timer set when 105 * Purple starts. It is also called when you send an IM, a chat, etc. 106 * 107 * This function has 3 sections. 108 * 1. Get your idle time. It will query XScreenSaver or Windows 109 * or use the Purple idle time. Whatever. 110 * 2. Set or unset your auto-away message. 111 * 3. Report your current idle time to the IM server. 112 */ 113 114 static void 115 check_idleness(void) 75 static time_t global_time_idle = 0; 76 void 77 purple_idle_set(time_t time_idle) 116 78 { 117 time_t time_idle; 118 gboolean auto_away; 119 const gchar *idle_reporting; 120 gboolean report_idle = TRUE; 121 gint away_seconds = 0; 122 gint idle_recheck_interval = 0; 123 gint idle_poll_seconds = purple_prefs_get_int("/purple/away/mins_before_away") * 60; 124 purple_signal_emit(purple_blist_get_handle(), "update-idle"); 125 126 idle_reporting = purple_prefs_get_string("/purple/away/idle_reporting"); 127 auto_away = purple_prefs_get_bool("/purple/away/away_when_idle"); 128 129 if (purple_strequal(idle_reporting, "system") && 130 (idle_ui_ops != NULL) && (idle_ui_ops->get_time_idle != NULL)) 131 { 132 /* Use system idle time (mouse or keyboard movement, etc.) */ 133 time_idle = idle_ui_ops->get_time_idle(); 134 idle_recheck_interval = 1; 135 } 136 else if (purple_strequal(idle_reporting, "purple")) 137 { 138 /* Use 'Purple idle' */ 139 time_idle = time(NULL) - last_active_time; 140 idle_recheck_interval = 0; 141 } 142 else 143 { 144 /* Don't report idle time */ 145 time_idle = 0; 146 report_idle = FALSE; 147 148 /* If we're not reporting idle, we can still do auto-away. 149 * First try "system" and if that isn't possible, use "purple" */ 150 if (auto_away) 151 { 152 if ((idle_ui_ops != NULL) && (idle_ui_ops->get_time_idle != NULL)) 153 { 154 time_idle = idle_ui_ops->get_time_idle(); 155 idle_recheck_interval = 1; 156 } 157 else 158 { 159 time_idle = time(NULL) - last_active_time; 160 idle_recheck_interval = 0; 161 } 162 } 163 else 164 { 165 if (!no_away) 166 { 167 no_away = TRUE; 168 purple_savedstatus_set_idleaway(FALSE); 169 } 170 time_until_next_idle_event = 0; 171 return; 172 } 173 } 174 175 time_until_next_idle_event = idle_poll_seconds - time_idle; 176 if (time_until_next_idle_event < 0) 177 { 178 /* If we're already idle, check again as appropriate. */ 179 time_until_next_idle_event = idle_recheck_interval; 180 } 181 182 if (auto_away || !no_away) 183 away_seconds = 60 * purple_prefs_get_int("/purple/away/mins_before_away"); 184 185 if (auto_away && time_idle > away_seconds) 186 { 187 purple_savedstatus_set_idleaway(TRUE); 188 no_away = FALSE; 189 } 190 else if (purple_savedstatus_is_idleaway() && time_idle < away_seconds) 191 { 192 purple_savedstatus_set_idleaway(FALSE); 193 if (time_until_next_idle_event == 0 || (away_seconds - time_idle) < time_until_next_idle_event) 194 time_until_next_idle_event = away_seconds - time_idle; 195 } 196 197 /* Idle reporting stuff */ 198 if (report_idle && (time_idle >= idle_poll_seconds)) 79 if (time_idle) 199 80 { 200 81 GList *l; 201 82 for (l = purple_connections_get_all(); l != NULL; l = l->next) … … 204 85 set_account_idle(purple_connection_get_account(gc), time_idle); 205 86 } 206 87 } 207 else if (!report_idle || (time_idle < idle_poll_seconds ))88 else 208 89 { 209 90 while (idled_accts != NULL) 210 91 set_account_unidle(idled_accts->data); 211 92 } 93 global_time_idle = time_idle; 212 94 } 213 95 214 96 215 /*216 * Check idle and set the timer to fire at the next idle-worth event217 */218 static gboolean219 check_idleness_timer(void)220 {221 check_idleness();222 if (time_until_next_idle_event == 0)223 idle_timer = 0;224 else225 {226 /* +1 for the boundary,227 * +1 more for g_timeout_add_seconds rounding. */228 idle_timer = purple_timeout_add_seconds(time_until_next_idle_event + 2, (GSourceFunc)check_idleness_timer, NULL);229 }230 return FALSE;231 }232 233 static void234 im_msg_sent_cb(PurpleAccount *account, const char *receiver,235 const char *message, void *data)236 {237 /* Check our idle time after an IM is sent */238 check_idleness();239 }240 241 97 static void 242 98 signing_on_cb(PurpleConnection *gc, void *data) 243 99 { 244 100 /* When signing on a new account, check if the account should be idle */ 245 check_idleness(); 101 if (global_time_idle) 102 set_account_idle(purple_connection_get_account(gc), global_time_idle); 246 103 } 247 104 248 105 static void 249 106 signing_off_cb(PurpleConnection *gc, void *data) 250 107 { 251 PurpleAccount *account; 252 253 account = purple_connection_get_account(gc); 254 set_account_unidle(account); 255 } 256 257 static void 258 idle_reporting_cb(const char *name, PurplePrefType type, gconstpointer val, gpointer data) 259 { 260 if (idle_timer) 261 purple_timeout_remove(idle_timer); 262 idle_timer = 0; 263 check_idleness_timer(); 264 } 265 266 void 267 purple_idle_touch() 268 { 269 time(&last_active_time); 270 if (!no_away) 271 { 272 if (idle_timer) 273 purple_timeout_remove(idle_timer); 274 idle_timer = 0; 275 check_idleness_timer(); 276 } 277 } 278 279 void 280 purple_idle_set(time_t time) 281 { 282 last_active_time = time; 283 } 284 285 void 286 purple_idle_set_ui_ops(PurpleIdleUiOps *ops) 287 { 288 idle_ui_ops = ops; 289 } 290 291 PurpleIdleUiOps * 292 purple_idle_get_ui_ops(void) 293 { 294 return idle_ui_ops; 108 set_account_unidle(purple_connection_get_account(gc)); 295 109 } 296 110 297 111 static void * … … 302 116 return &handle; 303 117 } 304 118 305 static gboolean _do_purple_idle_touch_cb(gpointer data)306 {307 int idle_poll_minutes = purple_prefs_get_int("/purple/away/mins_before_away");308 309 /* +1 more for g_timeout_add_seconds rounding. */310 idle_timer = purple_timeout_add_seconds((idle_poll_minutes * 60) + 2, (GSourceFunc)check_idleness_timer, NULL);311 312 purple_idle_touch();313 314 return FALSE;315 }316 317 318 119 void 319 120 purple_idle_init() 320 121 { 321 purple_signal_connect(purple_conversations_get_handle(), "sent-im-msg",322 purple_idle_get_handle(),323 PURPLE_CALLBACK(im_msg_sent_cb), NULL);324 122 purple_signal_connect(purple_connections_get_handle(), "signing-on", 325 123 purple_idle_get_handle(), 326 124 PURPLE_CALLBACK(signing_on_cb), NULL); 327 125 purple_signal_connect(purple_connections_get_handle(), "signing-off", 328 126 purple_idle_get_handle(), 329 127 PURPLE_CALLBACK(signing_off_cb), NULL); 330 331 purple_prefs_connect_callback(purple_idle_get_handle(), "/purple/away/idle_reporting",332 idle_reporting_cb, NULL);333 334 /* Initialize the idleness asynchronously so it doesn't check idleness,335 * and potentially try to change the status before the UI is initialized */336 purple_timeout_add(0, _do_purple_idle_touch_cb, NULL);337 338 128 } 339 129 340 130 void 341 131 purple_idle_uninit() 342 132 { 343 133 purple_signals_disconnect_by_handle(purple_idle_get_handle()); 344 purple_prefs_disconnect_by_handle(purple_idle_get_handle());345 346 /* Remove the idle timer */347 if (idle_timer > 0)348 purple_timeout_remove(idle_timer);349 idle_timer = 0;350 134 } -
libpurple/idle.h
diff -ru extract/pidgin-2.10.11/libpurple/idle.h libpurple/idle.h
old new 28 28 29 29 #include <time.h> 30 30 31 /**32 * Idle UI operations.33 */34 typedef struct35 {36 time_t (*get_time_idle)(void);37 38 void (*_purple_reserved1)(void);39 void (*_purple_reserved2)(void);40 void (*_purple_reserved3)(void);41 void (*_purple_reserved4)(void);42 } PurpleIdleUiOps;43 44 31 #ifdef __cplusplus 45 32 extern "C" { 46 33 #endif … … 51 38 /*@{*/ 52 39 53 40 /** 54 * Touch our idle tracker. This signifies that the user is 55 * 'active'. The conversation code calls this when the 56 * user sends an IM, for example. 57 */ 58 void purple_idle_touch(void); 59 60 /** 61 * Fake our idle time by setting the time at which our 62 * accounts purportedly became idle. This is used by 63 * the I'dle Mak'er plugin. 41 * Set as idle (if the timestamp is provided) or as unidle if the 42 * timestamp is 0. 64 43 */ 65 44 void purple_idle_set(time_t time); 66 45 … … 72 51 /*@{*/ 73 52 74 53 /** 75 * Sets the UI operations structure to be used for idle reporting.76 *77 * @param ops The UI operations structure.78 */79 void purple_idle_set_ui_ops(PurpleIdleUiOps *ops);80 81 /**82 * Returns the UI operations structure used for idle reporting.83 *84 * @return The UI operations structure in use.85 */86 PurpleIdleUiOps *purple_idle_get_ui_ops(void);87 88 /**89 54 * Initializes the idle system. 90 55 */ 91 56 void purple_idle_init(void); -
libpurple/internal.h
diff -ru extract/pidgin-2.10.11/libpurple/internal.h libpurple/internal.h
old new 45 45 * taken from an email to the texinfo mailing list by Manuel Guerrero. 46 46 * Thank you Manuel, and thank you Alex's good friend Google. 47 47 */ 48 49 #include <locale.h> 50 #include "gettext.h" 51 52 #define _(String) (purple_get_text(PACKAGE, String)) 53 #define N_(String) (String) 54 #define ngettext(Singular, Plural, Number) dngettext(PACKAGE, Singular, Plural, Number) 55 #define dngettext(Domain, Singular, Plural, Number) (purple_get_plural_text(Domain, Singular, Plural, Number)) 56 48 57 #ifdef ENABLE_NLS 49 # include <locale.h>50 # ifndef __APPLE_CC__51 # define __APPLE_CC__ 052 # endif53 58 # include <libintl.h> 54 # define _(String) ((const char *)dgettext(PACKAGE, String))55 59 # ifdef gettext_noop 60 # undef N_ 56 61 # define N_(String) gettext_noop (String) 57 # else58 # define N_(String) (String)59 62 # endif 60 #else61 # include <locale.h>62 # define N_(String) (String)63 # ifndef _64 # define _(String) ((const char *)String)65 # endif66 # define ngettext(Singular, Plural, Number) ((Number == 1) ? ((const char *)Singular) : ((const char *)Plural))67 # define dngettext(Domain, Singular, Plural, Number) ((Number == 1) ? ((const char *)Singular) : ((const char *)Plural))68 63 #endif 69 64 70 65 #ifdef HAVE_ENDIAN_H … … 102 97 #include <langinfo.h> 103 98 #endif 104 99 105 #include <gmodule.h>106 107 100 #ifdef PURPLE_PLUGINS 101 # include <gmodule.h> 108 102 # ifdef HAVE_DLFCN_H 109 103 # include <dlfcn.h> 110 104 # endif … … 142 136 #include "win32dep.h" 143 137 #endif 144 138 145 #ifdef HAVE_CONFIG_H139 #ifdef SIZEOF_TIME_T 146 140 #if SIZEOF_TIME_T == 4 147 141 # define PURPLE_TIME_T_MODIFIER "lu" 148 142 #elif SIZEOF_TIME_T == 8 -
libpurple/network.c
Only in libpurple: log.h Only in extract/pidgin-2.10.11/libpurple: media Only in libpurple: moz.build diff -ru extract/pidgin-2.10.11/libpurple/network.c libpurple/network.c
old new 24 24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA 25 25 */ 26 26 27 #ifdef _WIN32 28 #undef _WIN32_WINNT 29 #define _WIN32_WINNT 0x0501 30 #define INCL_WINSOCK_API_TYPEDEFS 1 31 #endif 32 27 33 #include "internal.h" 28 34 29 35 #ifndef _WIN32 … … 35 41 #ifdef HAVE_GETIFADDRS 36 42 #include <ifaddrs.h> 37 43 #endif 38 #el se44 #elif 0 39 45 #include <nspapi.h> 40 46 #endif 41 47 … … 81 87 static NMState nm_state = NM_STATE_UNKNOWN; 82 88 static gboolean have_nm_state = FALSE; 83 89 84 #elif defined _WIN3290 #elif 0 85 91 static int current_network_count; 86 92 87 93 /* Mutex for the other global vars */ 88 94 static GStaticMutex mutex = G_STATIC_MUTEX_INIT; 89 95 static gboolean network_initialized = FALSE; 90 96 static HANDLE network_change_handle = NULL; 91 static int (WSAAPI *MyWSANSPIoctl) ( 92 HANDLE hLookup, DWORD dwControlCode, LPVOID lpvInBuffer, 93 DWORD cbInBuffer, LPVOID lpvOutBuffer, DWORD cbOutBuffer, 94 LPDWORD lpcbBytesReturned, LPWSACOMPLETION lpCompletion) = NULL; 97 static LPFN_WSANSPIOCTL MyWSANSPIoctl = NULL; 98 #else 99 static network_available_callback available_callback = NULL; 95 100 #endif 96 101 97 102 struct _PurpleNetworkListenData { … … 606 611 return ntohs(addr.sin_port); 607 612 } 608 613 609 #if def _WIN32614 #if 0 610 615 #ifndef NS_NLA 611 616 #define NS_NLA 15 612 617 #endif … … 845 850 846 851 return FALSE; 847 852 848 #elif defined _WIN32853 #elif 0 849 854 return (current_network_count > 0 || force_online); 850 855 #else 856 if (available_callback) 857 return (available_callback()); 858 851 859 return TRUE; 852 860 #endif 853 861 } … … 1162 1170 #ifdef HAVE_NETWORKMANAGER 1163 1171 GError *error = NULL; 1164 1172 #endif 1165 #if def _WIN321173 #if 0 1166 1174 GError *err = NULL; 1167 1175 gint cnt = wpurple_get_connected_network_count(); 1168 1176 … … 1183 1191 purple_prefs_add_string("/purple/network/stun_server", ""); 1184 1192 purple_prefs_add_string("/purple/network/turn_server", ""); 1185 1193 purple_prefs_add_int ("/purple/network/turn_port", 3478); 1186 purple_prefs_add_int ("/purple/network/turn_port_tcp", 3478);1187 1194 purple_prefs_add_string("/purple/network/turn_username", ""); 1188 1195 purple_prefs_add_string("/purple/network/turn_password", ""); 1189 1196 purple_prefs_add_bool ("/purple/network/auto_ip", TRUE); … … 1258 1265 dbus_g_connection_unref(nm_conn); 1259 1266 #endif 1260 1267 1261 #if def _WIN321268 #if 0 1262 1269 g_static_mutex_lock(&mutex); 1263 1270 network_initialized = FALSE; 1264 1271 if (network_change_handle != NULL) { … … 1291 1298 /* TODO: clean up remaining port mappings, note calling 1292 1299 purple_upnp_remove_port_mapping from here doesn't quite work... */ 1293 1300 } 1301 1302 void 1303 purple_network_configuration_changed(void) 1304 { 1305 purple_signal_emit(purple_network_get_handle(), "network-configuration-changed", NULL); 1306 } 1307 1308 void 1309 purple_network_set_available_callback(network_available_callback cb) 1310 { 1311 available_callback = cb; 1312 } -
libpurple/network.h
diff -ru extract/pidgin-2.10.11/libpurple/network.h libpurple/network.h
old new 350 350 */ 351 351 void purple_network_uninit(void); 352 352 353 /** 354 * Emits the network-configuration-changed signal 355 */ 356 void 357 purple_network_configuration_changed(void); 358 359 /** 360 * Function pointer to a function indicating if network is available 361 */ 362 typedef gboolean (*network_available_callback)(void); 363 364 /** 365 * Sets the callback function to be used to query the UI about the 366 * availability of the network. 367 */ 368 void 369 purple_network_set_available_callback(network_available_callback cb); 370 353 371 /*@}*/ 354 372 355 373 #ifdef __cplusplus -
libpurple/notify.c
diff -ru extract/pidgin-2.10.11/libpurple/notify.c libpurple/notify.c
old new 28 28 #include "internal.h" 29 29 #include "dbus-maybe.h" 30 30 #include "notify.h" 31 #include "debug.h" 31 32 32 33 static PurpleNotifyUiOps *notify_ui_ops = NULL; 33 34 static GList *handles = NULL; … … 85 86 } 86 87 87 88 } 89 else { 90 int level; 91 if (type == PURPLE_NOTIFY_MSG_ERROR) 92 level = PURPLE_DEBUG_ERROR; 93 else if (type == PURPLE_NOTIFY_MSG_WARNING) 94 level = PURPLE_DEBUG_WARNING; 95 else 96 level = PURPLE_DEBUG_INFO; 97 purple_debug(level, "notify", "Notification: %s (%s)", 98 title ? title : "(null)", 99 primary ? primary : "(null)"); 100 } 88 101 89 102 if (cb != NULL) 90 103 cb(user_data); -
libpurple/plugin.c
diff -ru extract/pidgin-2.10.11/libpurple/plugin.c libpurple/plugin.c
old new 33 33 #include "request.h" 34 34 #include "signals.h" 35 35 #include "util.h" 36 #include "valgrind.h"37 36 #include "version.h" 38 37 39 38 typedef struct … … 73 72 74 73 #ifdef PURPLE_PLUGINS 75 74 75 #define RUNNING_ON_VALGRIND 0 76 76 77 static gboolean 77 78 has_file_extension(const char *filename, const char *ext) 78 79 { … … 283 284 purple_debug_error("plugins", "%s is not loadable: %s\n", 284 285 plugin->path, plugin->error); 285 286 } 287 #if 0 286 288 plugin->handle = g_module_open(filename, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL); 287 289 #endif 288 290 if (plugin->handle == NULL) 289 291 { 290 292 #ifdef _WIN32 … … 788 790 void 789 791 purple_plugin_destroy(PurplePlugin *plugin) 790 792 { 791 #ifdef PURPLE_PLUGINS792 793 g_return_if_fail(plugin != NULL); 793 794 795 #ifdef PURPLE_PLUGINS 794 796 if (purple_plugin_is_loaded(plugin)) 795 797 purple_plugin_unload(plugin); 796 798 … … 886 888 loader_info->destroy(plugin); 887 889 } 888 890 } 891 #else 892 if (plugin->info != NULL) { 893 if (PURPLE_IS_PROTOCOL_PLUGIN(plugin)) 894 protocol_plugins = g_list_remove(protocol_plugins, plugin); 895 896 if (plugin->info->unload) 897 plugin->info->unload(plugin); 898 } 899 900 plugins = g_list_remove(plugins, plugin); 901 #endif /* !PURPLE_PLUGINS */ 889 902 890 903 g_free(plugin->path); 891 904 g_free(plugin->error); … … 893 906 PURPLE_DBUS_UNREGISTER_POINTER(plugin); 894 907 895 908 g_free(plugin); 896 #endif /* !PURPLE_PLUGINS */897 909 } 898 910 899 911 gboolean … … 1179 1191 purple_plugins_init(void) { 1180 1192 void *handle = purple_plugins_get_handle(); 1181 1193 1194 #ifdef LIBDIR 1182 1195 purple_plugins_add_search_path(LIBDIR); 1196 #endif 1183 1197 1184 1198 purple_signal_register(handle, "plugin-load", 1185 1199 purple_marshal_VOID__POINTER, … … 1256 1270 void 1257 1271 purple_plugins_destroy_all(void) 1258 1272 { 1259 #ifdef PURPLE_PLUGINS1260 1261 1273 while (plugins != NULL) 1262 1274 purple_plugin_destroy(plugins->data); 1263 1264 #endif /* PURPLE_PLUGINS */1265 1275 } 1266 1276 1277 #if 0 1267 1278 void 1268 1279 purple_plugins_save_loaded(const char *key) 1269 1280 { … … 1345 1356 g_list_free(files); 1346 1357 #endif /* PURPLE_PLUGINS */ 1347 1358 } 1359 #endif 1348 1360 1349 1361 1350 1362 void -
libpurple/plugin.h
diff -ru extract/pidgin-2.10.11/libpurple/plugin.h libpurple/plugin.h
old new 30 30 #define _PURPLE_PLUGIN_H_ 31 31 32 32 #include <glib.h> 33 #include <gmodule.h> 33 #ifdef PURPLE_PLUGINS 34 # include <gmodule.h> 35 #endif 34 36 #include "signals.h" 35 37 #include "value.h" 36 38 … … 217 219 /** 218 220 * Handles the initialization of modules. 219 221 */ 222 #if 0 220 223 #if !defined(PURPLE_PLUGINS) || defined(PURPLE_STATIC_PRPL) 221 224 # define _FUNC_NAME(x) purple_init_##x##_plugin 222 225 # define PURPLE_INIT_PLUGIN(pluginname, initfunc, plugininfo) \ … … 237 240 return purple_plugin_register(plugin); \ 238 241 } 239 242 #endif 243 #endif 240 244 245 #ifdef PURPLE_STATIC_PRPL 246 # define _FUNC_NAME(x) purple_init_##x##_plugin 247 #else 248 # define _FUNC_NAME(x) purple_plugin_register_self 249 #endif 250 251 #define PURPLE_INIT_PLUGIN(pluginname, initfunc, plugininfo) \ 252 gboolean _FUNC_NAME(pluginname)(void) { \ 253 PurplePlugin *plugin = purple_plugin_new(TRUE, NULL); \ 254 plugin->info = &(plugininfo); \ 255 initfunc((plugin)); \ 256 return purple_plugin_register(plugin); \ 257 } 241 258 242 259 #ifdef __cplusplus 243 260 extern "C" { … … 536 553 void purple_plugins_destroy_all(void); 537 554 538 555 /** 539 * Saves the list of loaded plugins to the specified preference key540 *541 * @param key The preference key to save the list of plugins to.542 */543 void purple_plugins_save_loaded(const char *key);544 545 /**546 * Attempts to load all the plugins in the specified preference key547 * that were loaded when purple last quit.548 *549 * @param key The preference key containing the list of plugins.550 */551 void purple_plugins_load_saved(const char *key);552 553 /**554 556 * Probes for plugins in the registered module paths. 555 557 * 556 558 * @param ext The extension type to probe for, or @c NULL for all. -
libpurple/prefs.c
diff -ru extract/pidgin-2.10.11/libpurple/prefs.c libpurple/prefs.c
old new 40 40 #include "win32dep.h" 41 41 #endif 42 42 43 static PurplePrefsUiOps *prefs_ui_ops = NULL; 44 43 45 struct pref_cb { 44 46 PurplePrefCallback func; 45 47 gpointer data; 46 48 guint id; 47 49 void *handle; 48 }; 49 50 /* TODO: This should use PurpleValues? */ 51 struct purple_pref { 52 PurplePrefType type; 50 void *observer; 53 51 char *name; 54 union {55 gpointer generic;56 gboolean boolean;57 int integer;58 char *string;59 GList *stringlist;60 } value;61 GSList *callbacks;62 struct purple_pref *parent;63 struct purple_pref *sibling;64 struct purple_pref *first_child;65 };66 67 68 static struct purple_pref prefs = {69 PURPLE_PREF_NONE,70 NULL,71 { NULL },72 NULL,73 NULL,74 NULL,75 NULL76 52 }; 77 53 78 static GHashTable *prefs_hash = NULL;79 54 static guint save_timer = 0; 80 55 static gboolean prefs_loaded = FALSE; 81 82 83 /********************************************************************* 84 * Private utility functions * 85 *********************************************************************/ 86 87 static struct 88 purple_pref *find_pref(const char *name) 89 { 90 g_return_val_if_fail(name != NULL && name[0] == '/', NULL); 91 92 if (name[1] == '\0') 93 return &prefs; 94 else 95 { 96 /* When we're initializing, the debug system is 97 * initialized before the prefs system, but debug 98 * calls will end up calling prefs functions, so we 99 * need to deal cleanly here. */ 100 if (prefs_hash) 101 return g_hash_table_lookup(prefs_hash, name); 102 else 103 return NULL; 104 } 105 } 106 107 108 /********************************************************************* 109 * Writing to disk * 110 *********************************************************************/ 111 112 /* 113 * This function recursively creates the xmlnode tree from the prefs 114 * tree structure. Yay recursion! 115 */ 116 static void 117 pref_to_xmlnode(xmlnode *parent, struct purple_pref *pref) 118 { 119 xmlnode *node, *childnode; 120 struct purple_pref *child; 121 char buf[21]; 122 GList *cur; 123 124 /* Create a new node */ 125 node = xmlnode_new_child(parent, "pref"); 126 xmlnode_set_attrib(node, "name", pref->name); 127 128 /* Set the type of this node (if type == PURPLE_PREF_NONE then do nothing) */ 129 if (pref->type == PURPLE_PREF_INT) { 130 xmlnode_set_attrib(node, "type", "int"); 131 g_snprintf(buf, sizeof(buf), "%d", pref->value.integer); 132 xmlnode_set_attrib(node, "value", buf); 133 } 134 else if (pref->type == PURPLE_PREF_STRING) { 135 xmlnode_set_attrib(node, "type", "string"); 136 xmlnode_set_attrib(node, "value", pref->value.string ? pref->value.string : ""); 137 } 138 else if (pref->type == PURPLE_PREF_STRING_LIST) { 139 xmlnode_set_attrib(node, "type", "stringlist"); 140 for (cur = pref->value.stringlist; cur != NULL; cur = cur->next) 141 { 142 childnode = xmlnode_new_child(node, "item"); 143 xmlnode_set_attrib(childnode, "value", cur->data ? cur->data : ""); 144 } 145 } 146 else if (pref->type == PURPLE_PREF_PATH) { 147 char *encoded = g_filename_to_utf8(pref->value.string ? pref->value.string : "", -1, NULL, NULL, NULL); 148 xmlnode_set_attrib(node, "type", "path"); 149 xmlnode_set_attrib(node, "value", encoded); 150 g_free(encoded); 151 } 152 else if (pref->type == PURPLE_PREF_PATH_LIST) { 153 xmlnode_set_attrib(node, "type", "pathlist"); 154 for (cur = pref->value.stringlist; cur != NULL; cur = cur->next) 155 { 156 char *encoded = g_filename_to_utf8(cur->data ? cur->data : "", -1, NULL, NULL, NULL); 157 childnode = xmlnode_new_child(node, "item"); 158 xmlnode_set_attrib(childnode, "value", encoded); 159 g_free(encoded); 160 } 161 } 162 else if (pref->type == PURPLE_PREF_BOOLEAN) { 163 xmlnode_set_attrib(node, "type", "bool"); 164 g_snprintf(buf, sizeof(buf), "%d", pref->value.boolean); 165 xmlnode_set_attrib(node, "value", buf); 166 } 167 168 /* All My Children */ 169 for (child = pref->first_child; child != NULL; child = child->sibling) 170 pref_to_xmlnode(node, child); 171 } 172 173 static xmlnode * 174 prefs_to_xmlnode(void) 175 { 176 xmlnode *node; 177 struct purple_pref *pref, *child; 178 179 pref = &prefs; 180 181 /* Create the root preference node */ 182 node = xmlnode_new("pref"); 183 xmlnode_set_attrib(node, "version", "1"); 184 xmlnode_set_attrib(node, "name", "/"); 185 186 /* All My Children */ 187 for (child = pref->first_child; child != NULL; child = child->sibling) 188 pref_to_xmlnode(node, child); 189 190 return node; 191 } 192 193 static void 194 sync_prefs(void) 195 { 196 xmlnode *node; 197 char *data; 198 199 if (!prefs_loaded) 200 { 201 /* 202 * TODO: Call schedule_prefs_save()? Ideally we wouldn't need to. 203 * (prefs.xml should be loaded when purple_prefs_init is called) 204 */ 205 purple_debug_error("prefs", "Attempted to save prefs before " 206 "they were read!\n"); 207 return; 208 } 209 210 node = prefs_to_xmlnode(); 211 data = xmlnode_to_formatted_str(node, NULL); 212 purple_util_write_data_to_file("prefs.xml", data, -1); 213 g_free(data); 214 xmlnode_free(node); 215 } 56 static GSList *callbacks = NULL; 216 57 217 58 static gboolean 218 59 save_cb(gpointer data) 219 60 { 220 sync_prefs(); 61 PurplePrefsUiOps *uiop = purple_prefs_get_ui_ops(); 62 g_return_val_if_fail(uiop, FALSE); 63 uiop->save(); 64 221 65 save_timer = 0; 222 66 return FALSE; 223 67 } 224 68 225 static void226 schedule_prefs_save(void)227 {228 if (save_timer == 0)229 save_timer = purple_timeout_add_seconds(5, save_cb, NULL);230 }231 232 233 69 /********************************************************************* 234 70 * Reading from disk * 235 71 *********************************************************************/ 236 72 237 static GList *prefs_stack = NULL;238 239 static void240 prefs_start_element_handler (GMarkupParseContext *context,241 const gchar *element_name,242 const gchar **attribute_names,243 const gchar **attribute_values,244 gpointer user_data,245 GError **error)246 {247 PurplePrefType pref_type = PURPLE_PREF_NONE;248 int i;249 const char *pref_name = NULL, *pref_value = NULL;250 GString *pref_name_full;251 GList *tmp;252 253 if(!purple_strequal(element_name, "pref") &&254 !purple_strequal(element_name, "item"))255 return;256 257 for(i = 0; attribute_names[i]; i++) {258 if(purple_strequal(attribute_names[i], "name")) {259 pref_name = attribute_values[i];260 } else if(purple_strequal(attribute_names[i], "type")) {261 if(purple_strequal(attribute_values[i], "bool"))262 pref_type = PURPLE_PREF_BOOLEAN;263 else if(purple_strequal(attribute_values[i], "int"))264 pref_type = PURPLE_PREF_INT;265 else if(purple_strequal(attribute_values[i], "string"))266 pref_type = PURPLE_PREF_STRING;267 else if(purple_strequal(attribute_values[i], "stringlist"))268 pref_type = PURPLE_PREF_STRING_LIST;269 else if(purple_strequal(attribute_values[i], "path"))270 pref_type = PURPLE_PREF_PATH;271 else if(purple_strequal(attribute_values[i], "pathlist"))272 pref_type = PURPLE_PREF_PATH_LIST;273 else274 return;275 } else if(purple_strequal(attribute_names[i], "value")) {276 pref_value = attribute_values[i];277 }278 }279 280 if ((pref_type == PURPLE_PREF_BOOLEAN || pref_type == PURPLE_PREF_INT) &&281 pref_value == NULL) {282 /* Missing a value attribute */283 return;284 }285 286 if(purple_strequal(element_name, "item")) {287 struct purple_pref *pref;288 289 pref_name_full = g_string_new("");290 291 for(tmp = prefs_stack; tmp; tmp = tmp->next) {292 pref_name_full = g_string_prepend(pref_name_full, tmp->data);293 pref_name_full = g_string_prepend_c(pref_name_full, '/');294 }295 296 pref = find_pref(pref_name_full->str);297 298 if(pref) {299 if(pref->type == PURPLE_PREF_STRING_LIST) {300 pref->value.stringlist = g_list_append(pref->value.stringlist,301 g_strdup(pref_value));302 } else if(pref->type == PURPLE_PREF_PATH_LIST) {303 pref->value.stringlist = g_list_append(pref->value.stringlist,304 g_filename_from_utf8(pref_value, -1, NULL, NULL, NULL));305 }306 }307 g_string_free(pref_name_full, TRUE);308 } else {309 char *decoded;310 311 if(!pref_name || purple_strequal(pref_name, "/"))312 return;313 314 pref_name_full = g_string_new(pref_name);315 316 for(tmp = prefs_stack; tmp; tmp = tmp->next) {317 pref_name_full = g_string_prepend_c(pref_name_full, '/');318 pref_name_full = g_string_prepend(pref_name_full, tmp->data);319 }320 321 pref_name_full = g_string_prepend_c(pref_name_full, '/');322 323 switch(pref_type) {324 case PURPLE_PREF_NONE:325 purple_prefs_add_none(pref_name_full->str);326 break;327 case PURPLE_PREF_BOOLEAN:328 purple_prefs_set_bool(pref_name_full->str, atoi(pref_value));329 break;330 case PURPLE_PREF_INT:331 purple_prefs_set_int(pref_name_full->str, atoi(pref_value));332 break;333 case PURPLE_PREF_STRING:334 purple_prefs_set_string(pref_name_full->str, pref_value);335 break;336 case PURPLE_PREF_STRING_LIST:337 purple_prefs_set_string_list(pref_name_full->str, NULL);338 break;339 case PURPLE_PREF_PATH:340 if (pref_value) {341 decoded = g_filename_from_utf8(pref_value, -1, NULL, NULL, NULL);342 purple_prefs_set_path(pref_name_full->str, decoded);343 g_free(decoded);344 } else {345 purple_prefs_set_path(pref_name_full->str, NULL);346 }347 break;348 case PURPLE_PREF_PATH_LIST:349 purple_prefs_set_path_list(pref_name_full->str, NULL);350 break;351 }352 prefs_stack = g_list_prepend(prefs_stack, g_strdup(pref_name));353 g_string_free(pref_name_full, TRUE);354 }355 }356 357 static void358 prefs_end_element_handler(GMarkupParseContext *context,359 const gchar *element_name,360 gpointer user_data, GError **error)361 {362 if(prefs_stack && purple_strequal(element_name, "pref")) {363 g_free(prefs_stack->data);364 prefs_stack = g_list_delete_link(prefs_stack, prefs_stack);365 }366 }367 368 static GMarkupParser prefs_parser = {369 prefs_start_element_handler,370 prefs_end_element_handler,371 NULL,372 NULL,373 NULL374 };375 376 73 gboolean 377 74 purple_prefs_load() 378 75 { 379 gchar *filename = g_build_filename(purple_user_dir(), "prefs.xml", NULL);380 gchar *contents = NULL;381 gsize length;382 GMarkupParseContext *context;383 GError *error = NULL;384 385 if (!filename) {386 prefs_loaded = TRUE;387 return FALSE;388 }389 390 purple_debug_info("prefs", "Reading %s\n", filename);391 392 if(!g_file_get_contents(filename, &contents, &length, &error)) {393 #ifdef _WIN32394 gchar *common_appdata = wpurple_get_special_folder(CSIDL_COMMON_APPDATA);395 #endif396 g_free(filename);397 g_error_free(error);398 399 error = NULL;400 401 #ifdef _WIN32402 filename = g_build_filename(common_appdata ? common_appdata : "", "purple", "prefs.xml", NULL);403 g_free(common_appdata);404 #else405 filename = g_build_filename(SYSCONFDIR, "purple", "prefs.xml", NULL);406 #endif407 408 purple_debug_info("prefs", "Reading %s\n", filename);409 410 if (!g_file_get_contents(filename, &contents, &length, &error)) {411 purple_debug_error("prefs", "Error reading prefs: %s\n",412 error->message);413 g_error_free(error);414 g_free(filename);415 prefs_loaded = TRUE;416 417 return FALSE;418 }419 }420 421 context = g_markup_parse_context_new(&prefs_parser, 0, NULL, NULL);422 423 if(!g_markup_parse_context_parse(context, contents, length, NULL)) {424 g_markup_parse_context_free(context);425 g_free(contents);426 g_free(filename);427 prefs_loaded = TRUE;428 429 return FALSE;430 }431 432 if(!g_markup_parse_context_end_parse(context, NULL)) {433 purple_debug_error("prefs", "Error parsing %s\n", filename);434 g_markup_parse_context_free(context);435 g_free(contents);436 g_free(filename);437 prefs_loaded = TRUE;438 439 return FALSE;440 }441 442 purple_debug_info("prefs", "Finished reading %s\n", filename);443 g_markup_parse_context_free(context);444 g_free(contents);445 g_free(filename);446 76 prefs_loaded = TRUE; 447 77 448 78 return TRUE; 449 79 } 450 80 451 452 453 81 static void 454 82 prefs_save_cb(const char *name, PurplePrefType type, gconstpointer val, 455 83 gpointer user_data) 456 84 { 457 458 if(!prefs_loaded) 85 if (!prefs_loaded) 459 86 return; 460 87 461 88 purple_debug_misc("prefs", "%s changed, scheduling save.\n", name); 462 89 463 schedule_prefs_save(); 464 } 465 466 static char * 467 get_path_dirname(const char *name) 468 { 469 char *c, *str; 470 471 str = g_strdup(name); 472 473 if ((c = strrchr(str, '/')) != NULL) { 474 *c = '\0'; 475 476 if (*str == '\0') { 477 g_free(str); 478 479 str = g_strdup("/"); 480 } 481 } 482 else { 483 g_free(str); 484 485 str = g_strdup("."); 486 } 487 488 return str; 489 } 490 491 static char * 492 get_path_basename(const char *name) 493 { 494 const char *c; 495 496 if ((c = strrchr(name, '/')) != NULL) 497 return g_strdup(c + 1); 498 499 return g_strdup(name); 500 } 501 502 static char * 503 pref_full_name(struct purple_pref *pref) 504 { 505 GString *name; 506 struct purple_pref *parent; 507 508 if(!pref) 509 return NULL; 510 511 if(pref == &prefs) 512 return g_strdup("/"); 513 514 name = g_string_new(pref->name); 515 516 for(parent = pref->parent; parent && parent->name; parent = parent->parent) { 517 name = g_string_prepend_c(name, '/'); 518 name = g_string_prepend(name, parent->name); 519 } 520 name = g_string_prepend_c(name, '/'); 521 return g_string_free(name, FALSE); 522 } 523 524 static struct purple_pref * 525 find_pref_parent(const char *name) 526 { 527 char *parent_name = get_path_dirname(name); 528 struct purple_pref *ret = &prefs; 529 530 if(!purple_strequal(parent_name, "/")) { 531 ret = find_pref(parent_name); 532 } 533 534 g_free(parent_name); 535 return ret; 536 } 537 538 static void 539 free_pref_value(struct purple_pref *pref) 540 { 541 switch(pref->type) { 542 case PURPLE_PREF_BOOLEAN: 543 pref->value.boolean = FALSE; 544 break; 545 case PURPLE_PREF_INT: 546 pref->value.integer = 0; 547 break; 548 case PURPLE_PREF_STRING: 549 case PURPLE_PREF_PATH: 550 g_free(pref->value.string); 551 pref->value.string = NULL; 552 break; 553 case PURPLE_PREF_STRING_LIST: 554 case PURPLE_PREF_PATH_LIST: 555 { 556 g_list_foreach(pref->value.stringlist, (GFunc)g_free, NULL); 557 g_list_free(pref->value.stringlist); 558 } break; 559 case PURPLE_PREF_NONE: 560 break; 561 } 90 if (save_timer == 0) 91 save_timer = purple_timeout_add_seconds(6, save_cb, NULL); 562 92 } 563 93 564 static struct purple_pref * 565 add_pref(PurplePrefType type, const char *name) 566 { 567 struct purple_pref *parent; 568 struct purple_pref *me; 569 struct purple_pref *sibling; 570 char *my_name; 571 572 parent = find_pref_parent(name); 573 574 if(!parent) 575 return NULL; 576 577 my_name = get_path_basename(name); 578 579 for(sibling = parent->first_child; sibling; sibling = sibling->sibling) { 580 if(purple_strequal(sibling->name, my_name)) { 581 g_free(my_name); 582 return NULL; 583 } 584 } 585 586 me = g_new0(struct purple_pref, 1); 587 me->type = type; 588 me->name = my_name; 589 590 me->parent = parent; 591 if(parent->first_child) { 592 /* blatant abuse of a for loop */ 593 for(sibling = parent->first_child; sibling->sibling; 594 sibling = sibling->sibling); 595 sibling->sibling = me; 596 } else { 597 parent->first_child = me; 94 #define UIOP(aCall) \ 95 { \ 96 PurplePrefsUiOps *uiop = purple_prefs_get_ui_ops(); \ 97 g_return_if_fail(uiop); \ 98 \ 99 uiop->aCall; \ 100 } 101 102 #define UIOP_return(aCall, aDefault) \ 103 { \ 104 PurplePrefsUiOps *uiop = purple_prefs_get_ui_ops(); \ 105 g_return_val_if_fail(uiop, aDefault); \ 106 \ 107 return uiop->aCall; \ 598 108 } 599 109 600 g_hash_table_insert(prefs_hash, g_strdup(name), (gpointer)me);601 602 return me;603 }604 605 110 void 606 111 purple_prefs_add_none(const char *name) 607 { 608 add_pref(PURPLE_PREF_NONE, name); 609 } 112 UIOP(add_none(name)) 610 113 611 114 void 612 115 purple_prefs_add_bool(const char *name, gboolean value) 613 { 614 struct purple_pref *pref = add_pref(PURPLE_PREF_BOOLEAN, name); 615 616 if(!pref) 617 return; 618 619 pref->value.boolean = value; 620 } 116 UIOP(add_bool(name, value)) 621 117 622 118 void 623 119 purple_prefs_add_int(const char *name, int value) 624 { 625 struct purple_pref *pref = add_pref(PURPLE_PREF_INT, name); 626 627 if(!pref) 628 return; 629 630 pref->value.integer = value; 631 } 120 UIOP(add_int(name, value)) 632 121 633 122 void 634 123 purple_prefs_add_string(const char *name, const char *value) 635 { 636 struct purple_pref *pref; 637 638 if(value != NULL && !g_utf8_validate(value, -1, NULL)) { 639 purple_debug_error("prefs", "purple_prefs_add_string: Cannot store invalid UTF8 for string pref %s\n", name); 640 return; 641 } 642 643 pref = add_pref(PURPLE_PREF_STRING, name); 644 645 if(!pref) 646 return; 647 648 pref->value.string = g_strdup(value); 649 } 650 651 void 652 purple_prefs_add_string_list(const char *name, GList *value) 653 { 654 struct purple_pref *pref = add_pref(PURPLE_PREF_STRING_LIST, name); 655 GList *tmp; 656 657 if(!pref) 658 return; 659 660 for(tmp = value; tmp; tmp = tmp->next) { 661 if(tmp->data != NULL && !g_utf8_validate(tmp->data, -1, NULL)) { 662 purple_debug_error("prefs", "purple_prefs_add_string_list: Skipping invalid UTF8 for string list pref %s\n", name); 663 continue; 664 } 665 pref->value.stringlist = g_list_append(pref->value.stringlist, 666 g_strdup(tmp->data)); 667 } 668 } 669 670 void 671 purple_prefs_add_path(const char *name, const char *value) 672 { 673 struct purple_pref *pref = add_pref(PURPLE_PREF_PATH, name); 674 675 if(!pref) 676 return; 677 678 pref->value.string = g_strdup(value); 679 } 680 681 void 682 purple_prefs_add_path_list(const char *name, GList *value) 683 { 684 struct purple_pref *pref = add_pref(PURPLE_PREF_PATH_LIST, name); 685 GList *tmp; 686 687 if(!pref) 688 return; 689 690 for(tmp = value; tmp; tmp = tmp->next) 691 pref->value.stringlist = g_list_append(pref->value.stringlist, 692 g_strdup(tmp->data)); 693 } 694 695 696 static void 697 remove_pref(struct purple_pref *pref) 698 { 699 char *name; 700 GSList *l; 701 702 if(!pref) 703 return; 704 705 while(pref->first_child) 706 remove_pref(pref->first_child); 707 708 if(pref == &prefs) 709 return; 710 711 if(pref->parent->first_child == pref) { 712 pref->parent->first_child = pref->sibling; 713 } else { 714 struct purple_pref *sib = pref->parent->first_child; 715 while(sib && sib->sibling != pref) 716 sib = sib->sibling; 717 if(sib) 718 sib->sibling = pref->sibling; 719 } 720 721 name = pref_full_name(pref); 722 723 if (prefs_loaded) 724 purple_debug_info("prefs", "removing pref %s\n", name); 725 726 g_hash_table_remove(prefs_hash, name); 727 g_free(name); 728 729 free_pref_value(pref); 730 731 while((l = pref->callbacks) != NULL) { 732 pref->callbacks = pref->callbacks->next; 733 g_free(l->data); 734 g_slist_free_1(l); 735 } 736 g_free(pref->name); 737 g_free(pref); 738 } 124 UIOP(add_string(name, value)) 739 125 740 126 void 741 127 purple_prefs_remove(const char *name) 742 { 743 struct purple_pref *pref = find_pref(name); 744 745 if(!pref) 746 return; 747 748 remove_pref(pref); 749 } 750 751 void 752 purple_prefs_destroy() 753 { 754 purple_prefs_remove("/"); 755 } 756 757 static void 758 do_callbacks(const char* name, struct purple_pref *pref) 759 { 760 GSList *cbs; 761 struct purple_pref *cb_pref; 762 for(cb_pref = pref; cb_pref; cb_pref = cb_pref->parent) { 763 for(cbs = cb_pref->callbacks; cbs; cbs = cbs->next) { 764 struct pref_cb *cb = cbs->data; 765 cb->func(name, pref->type, pref->value.generic, cb->data); 766 } 767 } 768 } 128 UIOP(remove(name)) 769 129 770 130 void 771 131 purple_prefs_trigger_callback(const char *name) 772 132 { 773 struct purple_pref *pref = find_pref(name); 774 775 if(!pref) { 776 purple_debug_error("prefs", 777 "purple_prefs_trigger_callback: Unknown pref %s\n", name); 778 return; 779 } 780 781 do_callbacks(name, pref); 782 } 133 GSList *cbs; 783 134 784 void 785 purple_prefs_set_generic(const char *name, gpointer value) 786 { 787 struct purple_pref *pref = find_pref(name); 135 purple_debug_misc("prefs", "trigger callback %s\n", name); 788 136 789 if(!pref) { 790 purple_debug_error("prefs", 791 "purple_prefs_set_generic: Unknown pref %s\n", name); 792 return; 137 for (cbs = callbacks; cbs; cbs = cbs->next) { 138 const char *cb_name = ((struct pref_cb *)cbs->data)->name; 139 size_t len = strlen(cb_name); 140 if (!strncmp(cb_name, name, len) && 141 (name[len] == 0 || name[len] == '/' || 142 (len && name[len - 1] == '/'))) { 143 /* This test should behave like this: 144 * name = /toto/tata 145 * cb_name = /toto/tata --> true 146 * cb_name = /toto/tatatiti --> false 147 * cb_name = / --> true 148 * cb_name = /toto --> true 149 * cb_name = /toto/ --> true 150 */ 151 purple_prefs_observe(cbs->data); 152 } 793 153 } 794 795 pref->value.generic = value;796 do_callbacks(name, pref);797 154 } 798 155 799 156 void 800 157 purple_prefs_set_bool(const char *name, gboolean value) 801 { 802 struct purple_pref *pref = find_pref(name); 803 804 if(pref) { 805 if(pref->type != PURPLE_PREF_BOOLEAN) { 806 purple_debug_error("prefs", 807 "purple_prefs_set_bool: %s not a boolean pref\n", name); 808 return; 809 } 810 811 if(pref->value.boolean != value) { 812 pref->value.boolean = value; 813 do_callbacks(name, pref); 814 } 815 } else { 816 purple_prefs_add_bool(name, value); 817 } 818 } 158 UIOP(set_bool(name, value)) 819 159 820 160 void 821 161 purple_prefs_set_int(const char *name, int value) 822 { 823 struct purple_pref *pref = find_pref(name); 824 825 if(pref) { 826 if(pref->type != PURPLE_PREF_INT) { 827 purple_debug_error("prefs", 828 "purple_prefs_set_int: %s not an integer pref\n", name); 829 return; 830 } 831 832 if(pref->value.integer != value) { 833 pref->value.integer = value; 834 do_callbacks(name, pref); 835 } 836 } else { 837 purple_prefs_add_int(name, value); 838 } 839 } 162 UIOP(set_int(name, value)) 840 163 841 164 void 842 165 purple_prefs_set_string(const char *name, const char *value) 843 { 844 struct purple_pref *pref = find_pref(name); 845 846 if(value != NULL && !g_utf8_validate(value, -1, NULL)) { 847 purple_debug_error("prefs", "purple_prefs_set_string: Cannot store invalid UTF8 for string pref %s\n", name); 848 return; 849 } 850 851 if(pref) { 852 if(pref->type != PURPLE_PREF_STRING && pref->type != PURPLE_PREF_PATH) { 853 purple_debug_error("prefs", 854 "purple_prefs_set_string: %s not a string pref\n", name); 855 return; 856 } 857 858 if (!purple_strequal(pref->value.string, value)) { 859 g_free(pref->value.string); 860 pref->value.string = g_strdup(value); 861 do_callbacks(name, pref); 862 } 863 } else { 864 purple_prefs_add_string(name, value); 865 } 866 } 867 868 void 869 purple_prefs_set_string_list(const char *name, GList *value) 870 { 871 struct purple_pref *pref = find_pref(name); 872 if(pref) { 873 GList *tmp; 874 875 if(pref->type != PURPLE_PREF_STRING_LIST) { 876 purple_debug_error("prefs", 877 "purple_prefs_set_string_list: %s not a string list pref\n", 878 name); 879 return; 880 } 881 882 g_list_foreach(pref->value.stringlist, (GFunc)g_free, NULL); 883 g_list_free(pref->value.stringlist); 884 pref->value.stringlist = NULL; 885 886 for(tmp = value; tmp; tmp = tmp->next) { 887 if(tmp->data != NULL && !g_utf8_validate(tmp->data, -1, NULL)) { 888 purple_debug_error("prefs", "purple_prefs_set_string_list: Skipping invalid UTF8 for string list pref %s\n", name); 889 continue; 890 } 891 pref->value.stringlist = g_list_prepend(pref->value.stringlist, 892 g_strdup(tmp->data)); 893 } 894 pref->value.stringlist = g_list_reverse(pref->value.stringlist); 895 896 do_callbacks(name, pref); 897 898 } else { 899 purple_prefs_add_string_list(name, value); 900 } 901 } 902 903 void 904 purple_prefs_set_path(const char *name, const char *value) 905 { 906 struct purple_pref *pref = find_pref(name); 907 908 if(pref) { 909 if(pref->type != PURPLE_PREF_PATH) { 910 purple_debug_error("prefs", 911 "purple_prefs_set_path: %s not a path pref\n", name); 912 return; 913 } 914 915 if (!purple_strequal(pref->value.string, value)) { 916 g_free(pref->value.string); 917 pref->value.string = g_strdup(value); 918 do_callbacks(name, pref); 919 } 920 } else { 921 purple_prefs_add_path(name, value); 922 } 923 } 924 925 void 926 purple_prefs_set_path_list(const char *name, GList *value) 927 { 928 struct purple_pref *pref = find_pref(name); 929 if(pref) { 930 GList *tmp; 931 932 if(pref->type != PURPLE_PREF_PATH_LIST) { 933 purple_debug_error("prefs", 934 "purple_prefs_set_path_list: %s not a path list pref\n", 935 name); 936 return; 937 } 938 939 g_list_foreach(pref->value.stringlist, (GFunc)g_free, NULL); 940 g_list_free(pref->value.stringlist); 941 pref->value.stringlist = NULL; 942 943 for(tmp = value; tmp; tmp = tmp->next) 944 pref->value.stringlist = g_list_prepend(pref->value.stringlist, 945 g_strdup(tmp->data)); 946 pref->value.stringlist = g_list_reverse(pref->value.stringlist); 947 948 do_callbacks(name, pref); 949 950 } else { 951 purple_prefs_add_path_list(name, value); 952 } 953 } 954 166 UIOP(set_string(name, value)) 955 167 956 168 gboolean 957 169 purple_prefs_exists(const char *name) 958 { 959 struct purple_pref *pref = find_pref(name); 960 961 if (pref != NULL) 962 return TRUE; 963 964 return FALSE; 965 } 170 UIOP_return(exists(name), FALSE) 966 171 967 172 PurplePrefType 968 173 purple_prefs_get_type(const char *name) 969 { 970 struct purple_pref *pref = find_pref(name); 971 972 if (pref == NULL) 973 return PURPLE_PREF_NONE; 974 975 return (pref->type); 976 } 174 UIOP_return(get_type(name), PURPLE_PREF_NONE) 977 175 978 176 gboolean 979 177 purple_prefs_get_bool(const char *name) 980 { 981 struct purple_pref *pref = find_pref(name); 982 983 if(!pref) { 984 purple_debug_error("prefs", 985 "purple_prefs_get_bool: Unknown pref %s\n", name); 986 return FALSE; 987 } else if(pref->type != PURPLE_PREF_BOOLEAN) { 988 purple_debug_error("prefs", 989 "purple_prefs_get_bool: %s not a boolean pref\n", name); 990 return FALSE; 991 } 992 993 return pref->value.boolean; 994 } 178 UIOP_return(get_bool(name), FALSE) 995 179 996 180 int 997 181 purple_prefs_get_int(const char *name) 998 { 999 struct purple_pref *pref = find_pref(name); 1000 1001 if(!pref) { 1002 purple_debug_error("prefs", 1003 "purple_prefs_get_int: Unknown pref %s\n", name); 1004 return 0; 1005 } else if(pref->type != PURPLE_PREF_INT) { 1006 purple_debug_error("prefs", 1007 "purple_prefs_get_int: %s not an integer pref\n", name); 1008 return 0; 1009 } 1010 1011 return pref->value.integer; 1012 } 182 UIOP_return(get_int(name), 0) 1013 183 1014 184 const char * 1015 185 purple_prefs_get_string(const char *name) 1016 { 1017 struct purple_pref *pref = find_pref(name); 1018 1019 if(!pref) { 1020 purple_debug_error("prefs", 1021 "purple_prefs_get_string: Unknown pref %s\n", name); 1022 return NULL; 1023 } else if(pref->type != PURPLE_PREF_STRING) { 1024 purple_debug_error("prefs", 1025 "purple_prefs_get_string: %s not a string pref\n", name); 1026 return NULL; 1027 } 186 UIOP_return(get_string(name), NULL) 1028 187 1029 return pref->value.string; 1030 } 1031 1032 GList * 1033 purple_prefs_get_string_list(const char *name) 188 guint 189 purple_prefs_connect_callback(void *handle, const char *name, PurplePrefCallback func, gpointer data) 1034 190 { 1035 struct purple_pref *pref = find_pref(name); 1036 GList *ret = NULL, *tmp; 1037 1038 if(!pref) { 1039 purple_debug_error("prefs", 1040 "purple_prefs_get_string_list: Unknown pref %s\n", name); 1041 return NULL; 1042 } else if(pref->type != PURPLE_PREF_STRING_LIST) { 1043 purple_debug_error("prefs", 1044 "purple_prefs_get_string_list: %s not a string list pref\n", name); 1045 return NULL; 1046 } 1047 1048 for(tmp = pref->value.stringlist; tmp; tmp = tmp->next) 1049 ret = g_list_prepend(ret, g_strdup(tmp->data)); 1050 ret = g_list_reverse(ret); 191 struct pref_cb *cb; 192 static guint cb_id = 0; 193 PurplePrefsUiOps *uiop = NULL; 1051 194 1052 return ret;1053 } 195 g_return_val_if_fail(name != NULL, 0); 196 g_return_val_if_fail(func != NULL, 0); 1054 197 1055 const char * 1056 purple_prefs_get_path(const char *name) 1057 { 1058 struct purple_pref *pref = find_pref(name); 198 uiop = purple_prefs_get_ui_ops(); 199 g_return_val_if_fail(uiop, 0); 1059 200 1060 if(!pref) { 1061 purple_debug_error("prefs", 1062 "purple_prefs_get_path: Unknown pref %s\n", name); 1063 return NULL; 1064 } else if(pref->type != PURPLE_PREF_PATH) { 1065 purple_debug_error("prefs", 1066 "purple_prefs_get_path: %s not a path pref\n", name); 1067 return NULL; 1068 } 201 cb = g_new0(struct pref_cb, 1); 1069 202 1070 return pref->value.string; 1071 } 203 cb->func = func; 204 cb->data = data; 205 cb->id = ++cb_id; 206 cb->handle = handle; 207 cb->name = g_strdup(name); 1072 208 1073 GList * 1074 purple_prefs_get_path_list(const char *name) 1075 { 1076 struct purple_pref *pref = find_pref(name); 1077 GList *ret = NULL, *tmp; 209 cb->observer = uiop->add_observer(name, cb); 1078 210 1079 if(!pref) { 1080 purple_debug_error("prefs", 1081 "purple_prefs_get_path_list: Unknown pref %s\n", name); 1082 return NULL; 1083 } else if(pref->type != PURPLE_PREF_PATH_LIST) { 1084 purple_debug_error("prefs", 1085 "purple_prefs_get_path_list: %s not a path list pref\n", name); 1086 return NULL; 211 if (cb->observer == NULL) { 212 purple_debug_error("prefs", "purple_prefs_connect_callback: add observer failed for %s\n", name); 213 g_free(cb->name); 214 g_free(cb); 215 return 0; 1087 216 } 1088 217 1089 for(tmp = pref->value.stringlist; tmp; tmp = tmp->next) 1090 ret = g_list_prepend(ret, g_strdup(tmp->data)); 1091 ret = g_list_reverse(ret); 1092 1093 return ret; 218 callbacks = g_slist_append(callbacks, cb); 219 return cb->id; 1094 220 } 1095 221 1096 static void 1097 purple_prefs_rename_node(struct purple_pref *oldpref, struct purple_pref *newpref) 222 void purple_prefs_observe(gpointer data) 1098 223 { 1099 struct purple_pref *child, *next; 1100 char *oldname, *newname; 224 struct pref_cb *cb = data; 225 PurplePrefsUiOps *uiop = purple_prefs_get_ui_ops(); 226 gconstpointer value = NULL; 227 PurplePrefType type = PURPLE_PREF_NONE; 228 type = uiop->get_type(cb->name); 1101 229 1102 /* if we're a parent, rename the kids first */ 1103 for(child = oldpref->first_child; child != NULL; child = next) 1104 { 1105 struct purple_pref *newchild; 1106 next = child->sibling; 1107 for(newchild = newpref->first_child; newchild != NULL; newchild = newchild->sibling) 1108 { 1109 if(purple_strequal(child->name, newchild->name)) 1110 { 1111 purple_prefs_rename_node(child, newchild); 1112 break; 1113 } 1114 } 1115 if(newchild == NULL) { 1116 /* no rename happened, we weren't able to find the new pref */ 1117 char *tmpname = pref_full_name(child); 1118 purple_debug_error("prefs", "Unable to find rename pref for %s\n", tmpname); 1119 g_free(tmpname); 1120 } 1121 } 1122 1123 oldname = pref_full_name(oldpref); 1124 newname = pref_full_name(newpref); 1125 1126 if (oldpref->type != newpref->type) 1127 { 1128 purple_debug_error("prefs", "Unable to rename %s to %s: differing types\n", oldname, newname); 1129 g_free(oldname); 1130 g_free(newname); 1131 return; 1132 } 230 purple_debug_misc("prefs", "observe name = %s\n", cb->name); 1133 231 1134 purple_debug_info("prefs", "Renaming %s to %s\n", oldname, newname); 1135 g_free(oldname); 1136 1137 switch(oldpref->type) { 1138 case PURPLE_PREF_NONE: 232 switch (type) { 233 case PURPLE_PREF_INT: 234 value = GINT_TO_POINTER(uiop->get_int(cb->name)); 1139 235 break; 1140 236 case PURPLE_PREF_BOOLEAN: 1141 purple_prefs_set_bool(newname, oldpref->value.boolean); 1142 break; 1143 case PURPLE_PREF_INT: 1144 purple_prefs_set_int(newname, oldpref->value.integer); 237 value = GINT_TO_POINTER(uiop->get_bool(cb->name)); 1145 238 break; 1146 239 case PURPLE_PREF_STRING: 1147 purple_prefs_set_string(newname, oldpref->value.string); 1148 break; 1149 case PURPLE_PREF_STRING_LIST: 1150 purple_prefs_set_string_list(newname, oldpref->value.stringlist); 240 value = uiop->get_string(cb->name); 1151 241 break; 1152 case PURPLE_PREF_PATH: 1153 purple_prefs_set_path(newname, oldpref->value.string); 1154 break; 1155 case PURPLE_PREF_PATH_LIST: 1156 purple_prefs_set_path_list(newname, oldpref->value.stringlist); 242 case PURPLE_PREF_NONE: 1157 243 break; 244 default: 245 purple_debug_error("prefs", "Unexpected type = %i\n", type); 1158 246 } 1159 g_free(newname); 1160 1161 remove_pref(oldpref); 247 cb->func(cb->name, type, value, cb->data); 1162 248 } 1163 249 1164 250 void 1165 purple_prefs_rename(const char *oldname, const char *newname) 1166 { 1167 struct purple_pref *oldpref, *newpref; 1168 1169 oldpref = find_pref(oldname); 1170 1171 /* it's already been renamed, call off the dogs */ 1172 if(!oldpref) 1173 return; 1174 1175 newpref = find_pref(newname); 1176 1177 if (newpref == NULL) 1178 { 1179 purple_debug_error("prefs", "Unable to rename %s to %s: new pref not created\n", oldname, newname); 1180 return; 1181 } 1182 1183 purple_prefs_rename_node(oldpref, newpref); 1184 } 1185 1186 void 1187 purple_prefs_rename_boolean_toggle(const char *oldname, const char *newname) 1188 { 1189 struct purple_pref *oldpref, *newpref; 1190 1191 oldpref = find_pref(oldname); 1192 1193 /* it's already been renamed, call off the cats */ 1194 if(!oldpref) 1195 return; 1196 1197 if (oldpref->type != PURPLE_PREF_BOOLEAN) 1198 { 1199 purple_debug_error("prefs", "Unable to rename %s to %s: old pref not a boolean\n", oldname, newname); 1200 return; 1201 } 1202 1203 if (oldpref->first_child != NULL) /* can't rename parents */ 1204 { 1205 purple_debug_error("prefs", "Unable to rename %s to %s: can't rename parents\n", oldname, newname); 1206 return; 1207 } 1208 1209 1210 newpref = find_pref(newname); 1211 1212 if (newpref == NULL) 1213 { 1214 purple_debug_error("prefs", "Unable to rename %s to %s: new pref not created\n", oldname, newname); 1215 return; 1216 } 1217 1218 if (oldpref->type != newpref->type) 1219 { 1220 purple_debug_error("prefs", "Unable to rename %s to %s: differing types\n", oldname, newname); 1221 return; 1222 } 1223 1224 purple_debug_info("prefs", "Renaming and toggling %s to %s\n", oldname, newname); 1225 purple_prefs_set_bool(newname, !(oldpref->value.boolean)); 1226 1227 remove_pref(oldpref); 1228 } 1229 1230 guint 1231 purple_prefs_connect_callback(void *handle, const char *name, PurplePrefCallback func, gpointer data) 1232 { 1233 struct purple_pref *pref; 1234 struct pref_cb *cb; 1235 static guint cb_id = 0; 1236 1237 g_return_val_if_fail(name != NULL, 0); 1238 g_return_val_if_fail(func != NULL, 0); 1239 1240 pref = find_pref(name); 1241 if (pref == NULL) { 1242 purple_debug_error("prefs", "purple_prefs_connect_callback: Unknown pref %s\n", name); 1243 return 0; 1244 } 1245 1246 cb = g_new0(struct pref_cb, 1); 1247 1248 cb->func = func; 1249 cb->data = data; 1250 cb->id = ++cb_id; 1251 cb->handle = handle; 1252 1253 pref->callbacks = g_slist_append(pref->callbacks, cb); 1254 1255 return cb->id; 1256 } 1257 1258 static gboolean 1259 disco_callback_helper(struct purple_pref *pref, guint callback_id) 251 purple_prefs_disconnect_callback(guint callback_id) 1260 252 { 1261 253 GSList *cbs; 1262 struct purple_pref *child;1263 1264 if(!pref)1265 return FALSE;1266 254 1267 for (cbs = pref->callbacks; cbs; cbs = cbs->next) {255 for (cbs = callbacks; cbs; cbs = cbs->next) { 1268 256 struct pref_cb *cb = cbs->data; 1269 if(cb->id == callback_id) { 1270 pref->callbacks = g_slist_delete_link(pref->callbacks, cbs); 257 if (cb->id == callback_id) { 258 PurplePrefsUiOps *uiop = purple_prefs_get_ui_ops(); 259 uiop->remove_observer(cb->name, cb->observer); 260 261 callbacks = g_slist_delete_link(callbacks, cbs); 262 g_free(cb->name); 1271 263 g_free(cb); 1272 return TRUE;264 return; 1273 265 } 1274 266 } 1275 1276 for(child = pref->first_child; child; child = child->sibling) {1277 if(disco_callback_helper(child, callback_id))1278 return TRUE;1279 }1280 1281 return FALSE;1282 267 } 1283 268 1284 269 void 1285 purple_prefs_disconnect_callback(guint callback_id) 1286 { 1287 disco_callback_helper(&prefs, callback_id); 1288 } 1289 1290 static void 1291 disco_callback_helper_handle(struct purple_pref *pref, void *handle) 270 purple_prefs_disconnect_by_handle(void *handle) 1292 271 { 1293 272 GSList *cbs; 1294 struct purple_pref *child;1295 273 1296 if(!pref) 1297 return; 274 g_return_if_fail(handle != NULL); 1298 275 1299 cbs = pref->callbacks;276 cbs = callbacks; 1300 277 while (cbs != NULL) { 278 PurplePrefsUiOps *uiop; 1301 279 struct pref_cb *cb = cbs->data; 1302 if(cb->handle == handle) { 1303 pref->callbacks = g_slist_delete_link(pref->callbacks, cbs); 1304 g_free(cb); 1305 cbs = pref->callbacks; 1306 } else 280 if (cb->handle != handle) { 1307 281 cbs = cbs->next; 1308 } 1309 1310 for(child = pref->first_child; child; child = child->sibling) 1311 disco_callback_helper_handle(child, handle); 1312 } 282 continue; 283 } 1313 284 1314 void 1315 purple_prefs_disconnect_by_handle(void *handle) 1316 { 1317 g_return_if_fail(handle != NULL); 285 uiop = purple_prefs_get_ui_ops(); 286 uiop->remove_observer(cb->name, cb->observer); 1318 287 1319 disco_callback_helper_handle(&prefs, handle); 288 callbacks = g_slist_delete_link(callbacks, cbs); 289 g_free(cb->name); 290 g_free(cb); 291 cbs = callbacks; 292 } 1320 293 } 1321 294 1322 295 GList * 1323 296 purple_prefs_get_children_names(const char *name) 1324 { 1325 GList * list = NULL; 1326 struct purple_pref *pref = find_pref(name), *child; 1327 char sep[2] = "\0\0";; 1328 1329 if (pref == NULL) 1330 return NULL; 1331 1332 if (name[strlen(name) - 1] != '/') 1333 sep[0] = '/'; 1334 for (child = pref->first_child; child; child = child->sibling) { 1335 list = g_list_append(list, g_strdup_printf("%s%s%s", name, sep, child->name)); 1336 } 1337 return list; 1338 } 1339 1340 void 1341 purple_prefs_update_old() 1342 { 1343 purple_prefs_rename("/core", "/purple"); 1344 1345 /* Remove some no-longer-used prefs */ 1346 purple_prefs_remove("/purple/away/auto_response/enabled"); 1347 purple_prefs_remove("/purple/away/auto_response/idle_only"); 1348 purple_prefs_remove("/purple/away/auto_response/in_active_conv"); 1349 purple_prefs_remove("/purple/away/auto_response/sec_before_resend"); 1350 purple_prefs_remove("/purple/away/auto_response"); 1351 purple_prefs_remove("/purple/away/default_message"); 1352 purple_prefs_remove("/purple/buddies/use_server_alias"); 1353 purple_prefs_remove("/purple/conversations/away_back_on_send"); 1354 purple_prefs_remove("/purple/conversations/send_urls_as_links"); 1355 purple_prefs_remove("/purple/conversations/im/show_login"); 1356 purple_prefs_remove("/purple/conversations/chat/show_join"); 1357 purple_prefs_remove("/purple/conversations/chat/show_leave"); 1358 purple_prefs_remove("/purple/conversations/combine_chat_im"); 1359 purple_prefs_remove("/purple/conversations/use_alias_for_title"); 1360 purple_prefs_remove("/purple/logging/log_signon_signoff"); 1361 purple_prefs_remove("/purple/logging/log_idle_state"); 1362 purple_prefs_remove("/purple/logging/log_away_state"); 1363 purple_prefs_remove("/purple/logging/log_own_states"); 1364 purple_prefs_remove("/purple/status/scores/hidden"); 1365 purple_prefs_remove("/plugins/core/autorecon/hide_connected_error"); 1366 purple_prefs_remove("/plugins/core/autorecon/hide_connecting_error"); 1367 purple_prefs_remove("/plugins/core/autorecon/hide_reconnecting_dialog"); 1368 purple_prefs_remove("/plugins/core/autorecon/restore_state"); 1369 purple_prefs_remove("/plugins/core/autorecon"); 1370 1371 /* Convert old sounds while_away pref to new 3-way pref. */ 1372 if (purple_prefs_exists("/purple/sound/while_away") && 1373 purple_prefs_get_bool("/purple/sound/while_away")) 1374 { 1375 purple_prefs_set_int("/purple/sound/while_status", 3); 1376 } 1377 purple_prefs_remove("/purple/sound/while_away"); 1378 } 297 UIOP_return(get_children_names(name), NULL) 1379 298 1380 299 void * 1381 300 purple_prefs_get_handle(void) … … 1390 309 { 1391 310 void *handle = purple_prefs_get_handle(); 1392 311 1393 prefs_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);1394 1395 312 purple_prefs_connect_callback(handle, "/", prefs_save_cb, NULL); 1396 313 1397 314 purple_prefs_add_none("/purple"); … … 1402 319 1403 320 /* Away */ 1404 321 purple_prefs_add_none("/purple/away"); 1405 purple_prefs_add_string("/purple/away/idle_reporting", "system"); 1406 purple_prefs_add_bool("/purple/away/away_when_idle", TRUE); 1407 purple_prefs_add_int("/purple/away/mins_before_away", 5); 1408 1409 /* Away -> Auto-Reply */ 1410 if (!purple_prefs_exists("/purple/away/auto_response/enabled") || 1411 !purple_prefs_exists("/purple/away/auto_response/idle_only")) 1412 { 1413 purple_prefs_add_string("/purple/away/auto_reply", "awayidle"); 1414 } 1415 else 1416 { 1417 if (!purple_prefs_get_bool("/purple/away/auto_response/enabled")) 1418 { 1419 purple_prefs_add_string("/purple/away/auto_reply", "never"); 1420 } 1421 else 1422 { 1423 if (purple_prefs_get_bool("/purple/away/auto_response/idle_only")) 1424 { 1425 purple_prefs_add_string("/purple/away/auto_reply", "awayidle"); 1426 } 1427 else 1428 { 1429 purple_prefs_add_string("/purple/away/auto_reply", "away"); 1430 } 1431 } 1432 } 322 purple_prefs_add_string("/purple/away/auto_reply", "awayidle"); 1433 323 1434 324 /* Buddies */ 1435 325 purple_prefs_add_none("/purple/buddies"); … … 1442 332 purple_prefs_remove("/purple/contact/idle_score"); 1443 333 1444 334 purple_prefs_load(); 1445 purple_prefs_update_old();1446 335 } 1447 336 1448 337 void … … 1451 340 if (save_timer != 0) 1452 341 { 1453 342 purple_timeout_remove(save_timer); 1454 save_timer = 0; 1455 sync_prefs(); 343 save_cb(NULL); 1456 344 } 1457 345 1458 346 purple_prefs_disconnect_by_handle(purple_prefs_get_handle()); 1459 347 1460 348 prefs_loaded = FALSE; 1461 purple_prefs_destroy(); 1462 g_hash_table_destroy(prefs_hash); 1463 prefs_hash = NULL; 349 } 1464 350 351 void 352 purple_prefs_set_ui_ops(PurplePrefsUiOps *ops) 353 { 354 prefs_ui_ops = ops; 355 } 356 357 PurplePrefsUiOps * 358 purple_prefs_get_ui_ops(void) 359 { 360 return prefs_ui_ops; 1465 361 } -
libpurple/prefs.h
diff -ru extract/pidgin-2.10.11/libpurple/prefs.h libpurple/prefs.h
old new 38 38 PURPLE_PREF_BOOLEAN, /**< Boolean. */ 39 39 PURPLE_PREF_INT, /**< Integer. */ 40 40 PURPLE_PREF_STRING, /**< String. */ 41 /* The 3 following types are unused in libpurple, 42 and not implemented in Instantbird */ 41 43 PURPLE_PREF_STRING_LIST, /**< List of strings. */ 42 44 PURPLE_PREF_PATH, /**< Path. */ 43 45 PURPLE_PREF_PATH_LIST /**< List of paths. */ … … 62 64 typedef void (*PurplePrefCallback) (const char *name, PurplePrefType type, 63 65 gconstpointer val, gpointer data); 64 66 67 68 /** @copydoc _PurplePrefsUiOps */ 69 typedef struct _PurplePrefsUiOps PurplePrefsUiOps; 70 71 72 /** Prefs UI operations 73 */ 74 struct _PurplePrefsUiOps 75 { 76 void (*add_none)(const char *name); 77 void (*add_bool)(const char *name, gboolean value); 78 void (*add_int)(const char *name, int value); 79 void (*add_string)(const char *name, const char *value); 80 81 void (*set_bool)(const char *name, gboolean value); 82 void (*set_int)(const char *name, int value); 83 void (*set_string)(const char *name, const char *value); 84 85 gboolean (*get_bool)(const char *name); 86 int (*get_int)(const char *name); 87 const char *(*get_string)(const char *name); 88 89 PurplePrefType (*get_type)(const char *name); 90 GList *(*get_children_names)(const char *name); 91 92 gboolean (*exists)(const char *name); 93 void (*remove)(const char *name); 94 95 void (*save)(void); 96 97 void *(*add_observer)(const char *name, gpointer data); 98 void (*remove_observer)(const char *name, void *observer); 99 100 void (*_purple_reserved1)(void); 101 void (*_purple_reserved2)(void); 102 void (*_purple_reserved3)(void); 103 void (*_purple_reserved4)(void); 104 }; 105 106 65 107 #ifdef __cplusplus 66 108 extern "C" { 67 109 #endif 68 110 69 111 /**************************************************************************/ 112 /** @name UI Registration Functions */ 113 /**************************************************************************/ 114 /*@{*/ 115 /** 116 * Sets the UI operations structure to be used for preferences. 117 * 118 * @param ops The UI operations structure. 119 */ 120 void purple_prefs_set_ui_ops(PurplePrefsUiOps *ops); 121 122 /** 123 * Returns the UI operations structure used for preferences. 124 * 125 * @return The UI operations structure in use. 126 */ 127 PurplePrefsUiOps *purple_prefs_get_ui_ops(void); 128 129 /*@}*/ 130 131 /**************************************************************************/ 70 132 /** @name Prefs API 71 133 Preferences are named according to a directory-like structure. 72 134 Example: "/plugins/core/potato/is_from_idaho" (probably a boolean) */ … … 122 184 void purple_prefs_add_string(const char *name, const char *value); 123 185 124 186 /** 125 * Add a new string list pref.126 *127 * @param name The name of the pref128 * @param value The initial value to set129 * @note This function takes a copy of the strings in the value list. The list130 * itself and original copies of the strings are up to the caller to131 * free.132 */133 void purple_prefs_add_string_list(const char *name, GList *value);134 135 /**136 * Add a new path pref.137 *138 * @param name The name of the pref139 * @param value The initial value to set140 */141 void purple_prefs_add_path(const char *name, const char *value);142 143 /**144 * Add a new path list pref.145 *146 * @param name The name of the pref147 * @param value The initial value to set148 * @note This function takes a copy of the strings in the value list. The list149 * itself and original copies of the strings are up to the caller to150 * free.151 */152 void purple_prefs_add_path_list(const char *name, GList *value);153 154 155 /**156 187 * Remove a pref. 157 188 * 158 189 * @param name The name of the pref … … 160 191 void purple_prefs_remove(const char *name); 161 192 162 193 /** 163 * Rename a pref164 *165 * @param oldname The old name of the pref166 * @param newname The new name for the pref167 */168 void purple_prefs_rename(const char *oldname, const char *newname);169 170 /**171 * Rename a boolean pref, toggling it's value172 *173 * @param oldname The old name of the pref174 * @param newname The new name for the pref175 */176 void purple_prefs_rename_boolean_toggle(const char *oldname, const char *newname);177 178 /**179 * Remove all prefs.180 */181 void purple_prefs_destroy(void);182 183 /**184 * Set raw pref value185 *186 * @param name The name of the pref187 * @param value The value to set188 *189 * @deprecated We're not really sure what purpose this function serves, so it190 * will be removed in 3.0.0. Preferences values set using this191 * function aren't serialized to prefs.xml, which could be192 * misleading. There is also no purple_prefs_get_generic, which193 * means that if you can't really get the value (other in a194 * connected callback). If you think you have a use for this then195 * please let us know.196 */197 /* TODO: When this is removed, also remove struct purple_pref->value.generic */198 void purple_prefs_set_generic(const char *name, gpointer value);199 200 /**201 194 * Set boolean pref value 202 195 * 203 196 * @param name The name of the pref … … 221 214 */ 222 215 void purple_prefs_set_string(const char *name, const char *value); 223 216 224 /**225 * Set string list pref value226 *227 * @param name The name of the pref228 * @param value The value to set229 */230 void purple_prefs_set_string_list(const char *name, GList *value);231 232 /**233 * Set path pref value234 *235 * @param name The name of the pref236 * @param value The value to set237 */238 void purple_prefs_set_path(const char *name, const char *value);239 240 /**241 * Set path list pref value242 *243 * @param name The name of the pref244 * @param value The value to set245 */246 void purple_prefs_set_path_list(const char *name, GList *value);247 248 217 249 218 /** 250 219 * Check if a pref exists … … 287 256 const char *purple_prefs_get_string(const char *name); 288 257 289 258 /** 290 * Get string list pref value291 *292 * @param name The name of the pref293 * @return The value of the pref294 */295 GList *purple_prefs_get_string_list(const char *name);296 297 /**298 * Get path pref value299 *300 * @param name The name of the pref301 * @return The value of the pref302 */303 const char *purple_prefs_get_path(const char *name);304 305 /**306 * Get path list pref value307 *308 * @param name The name of the pref309 * @return The value of the pref310 */311 GList *purple_prefs_get_path_list(const char *name);312 313 /**314 259 * Returns a list of children for a pref 315 260 * 316 261 * @param name The parent pref … … 338 283 gpointer data); 339 284 340 285 /** 286 * Call the callback of the observer 287 */ 288 void purple_prefs_observe(gpointer data); 289 290 /** 341 291 * Remove a callback to a pref 342 292 */ 343 293 void purple_prefs_disconnect_callback(guint callback_id); … … 357 307 */ 358 308 gboolean purple_prefs_load(void); 359 309 360 /**361 * Rename legacy prefs and delete some that no longer exist.362 */363 void purple_prefs_update_old(void);364 365 310 /*@}*/ 366 311 367 312 #ifdef __cplusplus -
libpurple/protocols/jabber/buddy.c
Only in libpurple/protocols/bonjour: Makefile.in Only in libpurple/protocols/bonjour: moz.build Only in libpurple/protocols/bonjour: win32 Only in libpurple/protocols: create-cid.sh Only in libpurple/protocols/gg: Makefile.in Only in libpurple/protocols/gg: moz.build Only in libpurple/protocols/jabber: Makefile.in Only in extract/pidgin-2.10.11/libpurple/protocols/jabber: auth_cyrus.c diff -ru extract/pidgin-2.10.11/libpurple/protocols/jabber/buddy.c libpurple/protocols/jabber/buddy.c
old new 131 131 const JabberBuddyResource *jbrb = b; 132 132 JabberBuddyState state_a, state_b; 133 133 134 if (jbra->priority != jbrb->priority)135 return jbra->priority > jbrb->priority ? -1 : 1;136 137 134 /* Fold the states for easier comparison */ 138 135 /* TODO: Differentiate online/chat and away/dnd? */ 139 136 switch (jbra->state) { … … 177 174 } 178 175 179 176 if (state_a == state_b) { 177 if (jbra->priority != jbrb->priority) 178 return jbra->priority > jbrb->priority ? -1 : 1; 179 180 180 if (jbra->idle == jbrb->idle) 181 181 return 0; 182 182 else if ((jbra->idle && !jbrb->idle) || -
libpurple/protocols/jabber/disco.c
diff -ru extract/pidgin-2.10.11/libpurple/protocols/jabber/disco.c libpurple/protocols/jabber/disco.c
old new 35 35 #include "google/jingleinfo.h" 36 36 #include "iq.h" 37 37 #include "jabber.h" 38 #ifdef USE_JINGLE 38 39 #include "jingle/jingle.h" 40 #endif 39 41 #include "pep.h" 40 42 #include "presence.h" 41 43 #include "roster.h" -
libpurple/protocols/jabber/google/google_session.c
diff -ru extract/pidgin-2.10.11/libpurple/protocols/jabber/google/google_session.c libpurple/protocols/jabber/google/google_session.c
old new 23 23 #include "google_session.h" 24 24 #include "relay.h" 25 25 26 #include "jingle/jingle.h"27 28 26 #ifdef USE_VV 29 27 28 #include "jingle/jingle.h" 29 30 30 typedef struct { 31 31 PurpleMedia *media; 32 32 gboolean video; -
libpurple/protocols/jabber/iq.c
diff -ru extract/pidgin-2.10.11/libpurple/protocols/jabber/iq.c libpurple/protocols/jabber/iq.c
old new 33 33 #include "google/jingleinfo.h" 34 34 #include "google/google_session.h" 35 35 #include "iq.h" 36 #ifdef USE_JINGLE 36 37 #include "jingle/jingle.h" 38 #endif 37 39 #include "oob.h" 38 40 #include "roster.h" 39 41 #include "si.h" … … 43 45 #include "ibb.h" 44 46 45 47 #ifdef _WIN32 46 #include " utsname.h"48 #include "win32/utsname.h" 47 49 #endif 48 50 49 51 static GHashTable *iq_handlers = NULL; … … 560 562 iq_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); 561 563 signal_iq_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); 562 564 565 #ifdef USE_JINGLE 563 566 jabber_iq_register_handler("jingle", JINGLE, jingle_parse); 567 #endif 564 568 jabber_iq_register_handler("mailbox", NS_GOOGLE_MAIL_NOTIFY, 565 569 jabber_gmail_poke); 566 570 jabber_iq_register_handler("new-mail", NS_GOOGLE_MAIL_NOTIFY, -
libpurple/protocols/jabber/jabber.c
diff -ru extract/pidgin-2.10.11/libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/jabber.c
old new 69 69 #include "pep.h" 70 70 #include "adhoccommands.h" 71 71 72 #ifdef USE_JINGLE 72 73 #include "jingle/jingle.h" 73 74 #include "jingle/rtp.h" 75 #endif 74 76 75 77 #define PING_TIMEOUT 60 76 78 /* Send a whitespace keepalive to the server if we haven't sent … … 1597 1599 { 1598 1600 JabberStream *js = purple_connection_get_protocol_data(gc); 1599 1601 1602 #ifdef USE_JINGLE 1600 1603 /* Close all of the open Jingle sessions on this stream */ 1601 1604 jingle_terminate_sessions(js); 1605 #endif 1602 1606 1603 1607 if (js->bosh) 1604 1608 jabber_bosh_connection_close(js->bosh); … … 3874 3878 /* Bits Of Binary */ 3875 3879 jabber_add_feature(NS_BOB, 0); 3876 3880 3881 #ifdef USE_JINGLE 3877 3882 /* Jingle features! */ 3878 3883 jabber_add_feature(JINGLE, 0); 3884 #endif 3879 3885 3880 3886 #ifdef USE_VV 3881 3887 jabber_add_feature(NS_GOOGLE_PROTOCOL_SESSION, jabber_audio_enabled); -
libpurple/protocols/jabber/jabber.h
diff -ru extract/pidgin-2.10.11/libpurple/protocols/jabber/jabber.h libpurple/protocols/jabber/jabber.h
old new 62 62 #include "connection.h" 63 63 #include "dnsquery.h" 64 64 #include "dnssrv.h" 65 #ifdef USE_VV 65 66 #include "media.h" 66 67 #include "mediamanager.h" 68 #endif 67 69 #include "roomlist.h" 68 70 #include "sslconn.h" 69 71 -
libpurple/protocols/jabber/libxmpp.c
diff -ru extract/pidgin-2.10.11/libpurple/protocols/jabber/libxmpp.c libpurple/protocols/jabber/libxmpp.c
old new 258 258 GList *encryption_values = NULL; 259 259 260 260 /* Translators: 'domain' is used here in the context of Internet domains, e.g. pidgin.im */ 261 split = purple_account_user_split_new(_("Domain"), NULL, '@');261 split = purple_account_user_split_new(_("Domain"), "jabber.org", '@'); 262 262 purple_account_user_split_set_reverse(split, FALSE); 263 263 prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); 264 264 265 split = purple_account_user_split_new(_("Resource"), " ", '/');265 split = purple_account_user_split_new(_("Resource"), "Instantbird", '/'); 266 266 purple_account_user_split_set_reverse(split, FALSE); 267 267 prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); 268 268 … … 315 315 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, 316 316 option); 317 317 318 /* this should probably be part of global smiley theme settings later on,319 shared with MSN */320 option = purple_account_option_bool_new(_("Show Custom Smileys"),321 "custom_smileys", TRUE);322 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,323 option);324 325 318 my_protocol = plugin; 326 319 327 320 purple_prefs_remove("/plugins/prpl/jabber"); -
libpurple/protocols/jabber/message.c
diff -ru extract/pidgin-2.10.11/libpurple/protocols/jabber/message.c libpurple/protocols/jabber/message.c
old new 106 106 * this should be able to be implemented by removing the 107 107 * user from the conversation like we do with chats now. */ 108 108 purple_conversation_write(conv, "", buf, 109 PURPLE_MESSAGE_SYSTEM, time(NULL)); 109 PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY, 110 time(NULL)); 110 111 } 111 112 } 112 113 serv_got_typing_stopped(gc, jm->from); … … 602 603 GList *smiley_refs = NULL; 603 604 gchar *reformatted_xhtml; 604 605 605 if (purple_account_get_bool(account, "custom_smileys", TRUE)) {606 if (purple_account_get_bool(account, "custom_smileys", FALSE)) { 606 607 /* find a list of smileys ("cid" and "alt" text pairs) 607 608 occuring in the message */ 608 609 smiley_refs = jabber_message_get_refs_from_xmlnode(child); … … 1303 1304 const PurpleConnection *gc = js->gc; 1304 1305 PurpleAccount *account = purple_connection_get_account(gc); 1305 1306 1306 return purple_account_get_bool(account, "custom_smileys", TRUE);1307 return purple_account_get_bool(account, "custom_smileys", FALSE); 1307 1308 } -
libpurple/protocols/msn/msg.c
Only in libpurple/protocols/jabber: moz.build Only in libpurple/protocols: module.ver.in Only in libpurple/protocols/msn: Makefile.in Only in libpurple/protocols/msn: moz.build diff -ru extract/pidgin-2.10.11/libpurple/protocols/msn/msg.c libpurple/protocols/msn/msg.c
old new 819 819 820 820 } 821 821 822 #define purple_mkstemp(a, b) NULL 823 822 824 /* TODO: Make these not be such duplicates of each other */ 823 825 static void 824 826 got_wink_cb(MsnSlpCall *slpcall, const guchar *data, gsize size) -
libpurple/protocols/novell/nmconn.c
Only in libpurple/protocols/myspace: Makefile.in Only in libpurple/protocols/myspace: moz.build Only in libpurple/protocols: netsoul Only in libpurple/protocols/novell: Makefile.in Only in libpurple/protocols/novell: moz.build diff -ru extract/pidgin-2.10.11/libpurple/protocols/novell/nmconn.c libpurple/protocols/novell/nmconn.c
old new 19 19 */ 20 20 21 21 #include <glib.h> 22 #ifndef _MSC_VER 22 23 #include <unistd.h> 24 #endif 23 25 #include <errno.h> 24 26 #include <string.h> 25 27 #include <ctype.h> -
libpurple/protocols/null/nullprpl.c
Only in libpurple/protocols/null: Makefile.in Only in libpurple/protocols/null: moz.build diff -ru extract/pidgin-2.10.11/libpurple/protocols/null/nullprpl.c libpurple/protocols/null/nullprpl.c
old new 67 67 #include "util.h" 68 68 #include "version.h" 69 69 70 /* Disable gettext for the null-prpl, it will never be translated... */ 71 #undef _ 72 #define _(String) (String) 70 73 71 74 #define NULLPRPL_ID "prpl-null" 72 75 static PurplePlugin *_null_protocol = NULL; … … 172 175 !strcmp(status_id, NULL_STATUS_AWAY) || 173 176 !strcmp(status_id, NULL_STATUS_OFFLINE)) { 174 177 purple_debug_info("nullprpl", "%s sees that %s is %s: %s\n", 175 from_username, to_username, status_id, message); 178 from_username, to_username, status_id, 179 message ? message : ""); 176 180 purple_prpl_got_user_status(from->account, to_username, status_id, 177 181 (message) ? "message" : NULL, message, NULL); 178 182 } else { … … 364 368 365 369 purple_debug_info("nullprpl", "logging in %s\n", acct->username); 366 370 371 if (!strcmp(acct->username, "crash@test")) 372 *((int *) NULL) = 42; 373 367 374 purple_connection_update_progress(gc, _("Connecting"), 368 375 0, /* which connection step this is */ 369 376 2); /* total number of steps */ … … 522 529 523 530 static void nullprpl_set_status(PurpleAccount *acct, PurpleStatus *status) { 524 531 const char *msg = purple_status_get_attr_string(status, "message"); 525 purple_debug_info("nullprpl", "setting %s's status to %s: %s\n", 526 acct->username, purple_status_get_name(status), msg); 532 if (msg) 533 purple_debug_info("nullprpl", "setting %s's status to %s: %s\n", 534 acct->username, purple_status_get_name(status), msg); 535 else 536 purple_debug_info("nullprpl", "setting %s's status to %s\n", 537 acct->username, purple_status_get_name(status)); 527 538 528 539 foreach_nullprpl_gc(report_status_change, get_nullprpl_gc(acct->username), 529 540 NULL); -
libpurple/protocols/oscar/authorization.c
Only in libpurple/protocols/oscar: Makefile.in diff -ru extract/pidgin-2.10.11/libpurple/protocols/oscar/authorization.c libpurple/protocols/oscar/authorization.c
old new 93 93 oscar_auth_dontgrant_msgprompt(gpointer cbdata) 94 94 { 95 95 struct name_data *data = cbdata; 96 #if 0 96 97 purple_request_input(data->gc, NULL, _("Authorization Denied Message:"), 97 98 NULL, _("No reason given."), TRUE, FALSE, NULL, 98 99 _("_OK"), G_CALLBACK(oscar_auth_dontgrant), 99 100 _("_Cancel"), G_CALLBACK(oscar_free_name_data), 100 101 purple_connection_get_account(data->gc), data->name, NULL, 101 102 data); 103 #else 104 oscar_auth_dontgrant(data, NULL); 105 #endif 102 106 } 103 107 104 108 void -
libpurple/protocols/oscar/family_locate.c
diff -ru extract/pidgin-2.10.11/libpurple/protocols/oscar/family_locate.c libpurple/protocols/oscar/family_locate.c
old new 567 567 aim_userinfo_t *aim_locate_finduserinfo(OscarData *od, const char *bn) { 568 568 aim_userinfo_t *cur = NULL; 569 569 570 if (bn == NULL )570 if (bn == NULL || od == NULL) 571 571 return NULL; 572 572 573 573 cur = od->locate.userinfo; -
libpurple/protocols/oscar/libaim.c
diff -ru extract/pidgin-2.10.11/libpurple/protocols/oscar/libaim.c libpurple/protocols/oscar/libaim.c
old new 142 142 NULL 143 143 }; 144 144 145 gboolean purple_init_icq_plugin(void); 146 145 147 static void 146 148 init_plugin(PurplePlugin *plugin) 147 149 { 148 150 oscar_init(plugin, FALSE); 151 purple_init_icq_plugin(); 149 152 } 150 153 151 PURPLE_INIT_PLUGIN( aim, init_plugin, info);154 PURPLE_INIT_PLUGIN(oscar, init_plugin, info) -
libpurple/protocols/oscar/libicq.c
diff -ru extract/pidgin-2.10.11/libpurple/protocols/oscar/libicq.c libpurple/protocols/oscar/libicq.c
old new 24 24 * which contains all the shared implementation code with libaim 25 25 */ 26 26 27 27 #ifndef PURPLE_STATIC_PRPL 28 #define PURPLE_STATIC_PRPL 29 #endif 28 30 #include "oscarcommon.h" 29 31 30 32 static GHashTable * -
libpurple/protocols/oscar/oscar.c
Only in libpurple/protocols/oscar: moz.build diff -ru extract/pidgin-2.10.11/libpurple/protocols/oscar/oscar.c libpurple/protocols/oscar/oscar.c
old new 350 350 flap_connection_send_version(od, conn); 351 351 else 352 352 { 353 if (purple_account_get_bool(account, "use_clientlogin", OSCAR_DEFAULT_USE_CLIENTLOGIN))353 if (purple_account_get_bool(account, "use_clientlogin", od->icq ? ICQ_DEFAULT_USE_CLIENTLOGIN : AIM_DEFAULT_USE_CLIENTLOGIN)) 354 354 { 355 355 ClientInfo aiminfo = CLIENTINFO_PURPLE_AIM; 356 356 ClientInfo icqinfo = CLIENTINFO_PURPLE_ICQ; … … 577 577 578 578 gc = data; 579 579 od = purple_connection_get_protocol_data(gc); 580 report_idle = strcmp((const char *)value, "none") != 0;580 report_idle = GPOINTER_TO_INT(value); 581 581 presence = aim_ssi_getpresence(od->ssi.local); 582 582 583 583 if (report_idle) … … 765 765 od->use_ssl = purple_ssl_is_supported() && strcmp(encryption_type, OSCAR_NO_ENCRYPTION) != 0; 766 766 767 767 /* Connect to core Purple signals */ 768 purple_prefs_connect_callback(gc, "/ purple/away/idle_reporting", idle_reporting_pref_cb, gc);768 purple_prefs_connect_callback(gc, "/messenger/status/reportIdle", idle_reporting_pref_cb, gc); 769 769 purple_prefs_connect_callback(gc, "/plugins/prpl/oscar/recent_buddies", recent_buddies_pref_cb, gc); 770 770 771 771 /* … … 778 778 * This authentication method is used for both ICQ and AIM when 779 779 * clientLogin is not enabled. 780 780 */ 781 if (purple_account_get_bool(account, "use_clientlogin", OSCAR_DEFAULT_USE_CLIENTLOGIN)) {781 if (purple_account_get_bool(account, "use_clientlogin", od->icq ? ICQ_DEFAULT_USE_CLIENTLOGIN : AIM_DEFAULT_USE_CLIENTLOGIN)) { 782 782 send_client_login(od, purple_account_get_username(account)); 783 783 } else { 784 784 FlapConnection *newconn; … … 3977 3977 const char *idle_reporting_pref; 3978 3978 gboolean report_idle; 3979 3979 3980 idle_reporting_pref = purple_prefs_get_string("/purple/away/idle_reporting"); 3981 report_idle = strcmp(idle_reporting_pref, "none") != 0; 3980 report_idle = purple_prefs_get_bool("/messenger/status/reportIdle"); 3982 3981 3983 3982 if (report_idle) 3984 3983 aim_ssi_setpresence(od, tmp | AIM_SSI_PRESENCE_FLAG_SHOWIDLE); … … 4020 4019 b = purple_find_buddy_in_group(account, curitem->name, g); 4021 4020 if (b) { 4022 4021 /* Get server stored alias */ 4023 purple_blist_alias_buddy(b, alias_utf8); 4022 if (!purple_strequal(curitem->name, alias_utf8)) 4023 purple_blist_alias_buddy(b, alias_utf8); 4024 4024 } else { 4025 4025 b = purple_buddy_new(account, curitem->name, alias_utf8); 4026 4026 … … 5762 5762 prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); 5763 5763 5764 5764 option = purple_account_option_bool_new(_("Use clientLogin"), "use_clientlogin", 5765 OSCAR_DEFAULT_USE_CLIENTLOGIN);5765 is_icq ? ICQ_DEFAULT_USE_CLIENTLOGIN : AIM_DEFAULT_USE_CLIENTLOGIN); 5766 5766 prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); 5767 5767 5768 5768 option = purple_account_option_bool_new( -
libpurple/protocols/oscar/oscarcommon.h
diff -ru extract/pidgin-2.10.11/libpurple/protocols/oscar/oscarcommon.h libpurple/protocols/oscar/oscarcommon.h
old new 54 54 #define OSCAR_DEFAULT_WEB_AWARE FALSE 55 55 #define OSCAR_DEFAULT_ALWAYS_USE_RV_PROXY FALSE 56 56 #define OSCAR_DEFAULT_ALLOW_MULTIPLE_LOGINS TRUE 57 #define OSCAR_DEFAULT_USE_CLIENTLOGIN TRUE 57 #define AIM_DEFAULT_USE_CLIENTLOGIN FALSE 58 #define ICQ_DEFAULT_USE_CLIENTLOGIN TRUE 58 59 #define OSCAR_DEFAULT_ENCRYPTION OSCAR_OPPORTUNISTIC_ENCRYPTION 59 60 60 61 #ifdef _WIN32 -
libpurple/protocols/sametime/sametime.c
Only in libpurple/protocols: prpl-rules.mk Only in libpurple/protocols: prpl.mk Only in libpurple/protocols: prpl.py Only in libpurple/protocols: qq Only in libpurple/protocols/sametime: Makefile.in Only in libpurple/protocols/sametime: meanwhile Only in libpurple/protocols/sametime: moz.build diff -ru extract/pidgin-2.10.11/libpurple/protocols/sametime/sametime.c libpurple/protocols/sametime/sametime.c
old new 927 927 return NULL; 928 928 } 929 929 930 if (!name) {931 DEBUG_WARN("Can't ensure a null group\n");932 return NULL;933 }934 935 930 DEBUG_INFO("attempting to ensure group %s, called %s\n", 936 931 NSTR(name), NSTR(alias)); 937 932 -
libpurple/protocols/yahoo/libyahoo.c
Only in libpurple/protocols/simple: Makefile.in Only in libpurple/protocols/simple: moz.build Only in libpurple/protocols: sipe Only in libpurple/protocols: xpcomModule.cpp.in Only in libpurple/protocols/yahoo: Makefile.in diff -ru extract/pidgin-2.10.11/libpurple/protocols/yahoo/libyahoo.c libpurple/protocols/yahoo/libyahoo.c
old new 306 306 NULL 307 307 }; 308 308 309 gboolean purple_init_yahoojp_plugin(void); 310 309 311 static void 310 312 init_plugin(PurplePlugin *plugin) 311 313 { … … 343 345 344 346 purple_signal_connect(purple_get_core(), "uri-handler", plugin, 345 347 PURPLE_CALLBACK(yahoo_uri_handler), NULL); 348 purple_init_yahoojp_plugin(); 346 349 } 347 350 348 351 PURPLE_INIT_PLUGIN(yahoo, init_plugin, info); -
libpurple/protocols/yahoo/libyahoojp.c
diff -ru extract/pidgin-2.10.11/libpurple/protocols/yahoo/libyahoojp.c libpurple/protocols/yahoo/libyahoojp.c
old new 21 21 * 22 22 */ 23 23 24 #ifndef PURPLE_STATIC_PRPL 25 #define PURPLE_STATIC_PRPL 26 #endif 24 27 #include "internal.h" 25 28 26 29 #include <account.h> -
libpurple/protocols/yahoo/libymsg.c
diff -ru extract/pidgin-2.10.11/libpurple/protocols/yahoo/libymsg.c libpurple/protocols/yahoo/libymsg.c
old new 1363 1363 static void 1364 1364 yahoo_buddy_add_deny_reason_cb(gpointer data) { 1365 1365 struct yahoo_add_request *add_req = data; 1366 yahoo_buddy_add_deny_cb(add_req, NULL); 1367 /* 1366 1368 purple_request_input(add_req->gc, NULL, _("Authorization denied message:"), 1367 1369 NULL, _("No reason given."), TRUE, FALSE, NULL, 1368 1370 _("OK"), G_CALLBACK(yahoo_buddy_add_deny_cb), 1369 1371 _("Cancel"), G_CALLBACK(yahoo_buddy_add_deny_noreason_cb), 1370 1372 purple_connection_get_account(add_req->gc), add_req->who, NULL, 1371 1373 add_req); 1374 */ 1372 1375 } 1373 1376 1374 1377 static void yahoo_buddy_denied_our_add(PurpleConnection *gc, const char *who, const char *reason) -
libpurple/protocols/yahoo/util.c
Only in libpurple/protocols/yahoo: moz.build diff -ru extract/pidgin-2.10.11/libpurple/protocols/yahoo/util.c libpurple/protocols/yahoo/util.c
old new 499 499 */ 500 500 int size, htmlsize; 501 501 gchar tmp[11]; 502 gchar *tmp2 = g_strdup_printf("font-size: %spt", fontsize); 502 503 size = strtol(fontsize, NULL, 10); 503 504 htmlsize = point_to_html(size); 504 505 sprintf(tmp, "%u", htmlsize); 505 506 xmlnode_set_attrib(*cur, "size", tmp); 506 xmlnode_set_attrib(*cur, "absz", fontsize); 507 xmlnode_set_attrib(*cur, "style", tmp2); 508 g_free(tmp2); 507 509 #endif /* !USE_CSS_FORMATTING */ 508 510 g_free(fontsize); 509 511 } -
libpurple/proxy.c
diff -ru extract/pidgin-2.10.11/libpurple/proxy.c libpurple/proxy.c
old new 285 285 return param; 286 286 } 287 287 288 #if 0 288 289 static PurpleProxyInfo * 289 290 purple_gnome_proxy_get_info(void) 290 291 { … … 415 416 416 417 return &info; 417 418 } 419 #endif 418 420 419 421 #ifdef _WIN32 420 422 … … 2236 2238 gpi = NULL; 2237 2239 } 2238 2240 if (gpi == NULL) { 2241 #if 0 2239 2242 if (purple_running_gnome()) 2240 2243 gpi = purple_gnome_proxy_get_info(); 2241 2244 else 2245 #endif 2242 2246 gpi = purple_global_proxy_get_info(); 2243 2247 } 2244 2248 … … 2560 2564 } 2561 2565 } 2562 2566 2567 #if 0 2563 2568 static void 2564 2569 proxy_pref_cb(const char *name, PurplePrefType type, 2565 2570 gconstpointer value, gpointer data) … … 2595 2600 else if (purple_strequal(name, "/purple/proxy/password")) 2596 2601 purple_proxy_info_set_password(info, value); 2597 2602 } 2603 #endif 2598 2604 2599 2605 void * 2600 2606 purple_proxy_get_handle() … … 2614 2620 2615 2621 /* Proxy */ 2616 2622 purple_prefs_add_none("/purple/proxy"); 2623 #if 0 2617 2624 purple_prefs_add_string("/purple/proxy/type", "none"); 2618 2625 purple_prefs_add_string("/purple/proxy/host", ""); 2619 2626 purple_prefs_add_int("/purple/proxy/port", 0); 2620 2627 purple_prefs_add_string("/purple/proxy/username", ""); 2621 2628 purple_prefs_add_string("/purple/proxy/password", ""); 2629 #endif 2622 2630 purple_prefs_add_bool("/purple/proxy/socks4_remotedns", FALSE); 2623 2631 2632 #if 0 2624 2633 /* Setup callbacks for the preferences. */ 2625 2634 handle = purple_proxy_get_handle(); 2626 2635 purple_prefs_connect_callback(handle, "/purple/proxy/type", proxy_pref_cb, … … 2640 2649 purple_prefs_trigger_callback("/purple/proxy/port"); 2641 2650 purple_prefs_trigger_callback("/purple/proxy/username"); 2642 2651 purple_prefs_trigger_callback("/purple/proxy/password"); 2652 #endif 2643 2653 } 2644 2654 2645 2655 void -
libpurple/proxy.h
diff -ru extract/pidgin-2.10.11/libpurple/proxy.h libpurple/proxy.h
old new 195 195 */ 196 196 void purple_global_proxy_set_info(PurpleProxyInfo *info); 197 197 198 /** 199 * Set purple's global proxy information. 200 * 201 * @param info The proxy information. 202 */ 203 void purple_global_proxy_set_info(PurpleProxyInfo *info); 204 198 205 /*@}*/ 199 206 200 207 /**************************************************************************/ -
libpurple/prpl.c
diff -ru extract/pidgin-2.10.11/libpurple/prpl.c libpurple/prpl.c
old new 382 382 g_return_if_fail(new_status != NULL); 383 383 g_return_if_fail(!purple_status_is_exclusive(new_status) || old_status != NULL); 384 384 385 purple_signal_emit(purple_accounts_get_handle(), "account-status-changing", 386 account, old_status, new_status); 387 385 388 do_prpl_change_account_status(account, old_status, new_status); 386 389 387 390 purple_signal_emit(purple_accounts_get_handle(), "account-status-changed", -
libpurple/prpl.h
diff -ru extract/pidgin-2.10.11/libpurple/prpl.h libpurple/prpl.h
old new 72 72 #include "conversation.h" 73 73 #include "ft.h" 74 74 #include "imgstore.h" 75 #include "media.h"76 75 #include "notify.h" 77 76 #include "proxy.h" 78 77 #include "plugin.h" … … 80 79 #include "status.h" 81 80 #include "whiteboard.h" 82 81 83 84 82 /** @copydoc PurpleBuddyIconSpec */ 85 83 struct _PurpleBuddyIconSpec { 86 84 /** This is a comma-delimited list of image formats or @c NULL if icons -
libpurple/request.c
Only in libpurple: purple-prefs.js diff -ru extract/pidgin-2.10.11/libpurple/request.c libpurple/request.c
old new 1196 1196 1197 1197 /* -- */ 1198 1198 1199 #define PURPLE_REQUEST_NO_OPS(type, title, description) \ 1200 purple_debug_error("request", "Requesting "type": %s (%s)", \ 1201 title ? title : "(null)", \ 1202 description ? description : "(null)") 1203 1199 1204 void * 1200 1205 purple_request_input(void *handle, const char *title, const char *primary, 1201 1206 const char *secondary, const char *default_value, … … 1230 1235 1231 1236 return info->ui_handle; 1232 1237 } 1238 else 1239 PURPLE_REQUEST_NO_OPS("input", title, primary); 1233 1240 1234 1241 return NULL; 1235 1242 } … … 1292 1299 1293 1300 return info->ui_handle; 1294 1301 } 1302 else 1303 PURPLE_REQUEST_NO_OPS("choice", title, primary); 1295 1304 1296 1305 return NULL; 1297 1306 } … … 1366 1375 1367 1376 return info->ui_handle; 1368 1377 } 1378 else 1379 PURPLE_REQUEST_NO_OPS("action", title, primary); 1369 1380 1370 1381 return NULL; 1371 1382 } … … 1470 1481 handles = g_list_append(handles, info); 1471 1482 return info->ui_handle; 1472 1483 } 1484 else 1485 PURPLE_REQUEST_NO_OPS("file", title, filename); 1473 1486 1474 1487 return NULL; 1475 1488 } … … 1497 1510 handles = g_list_append(handles, info); 1498 1511 return info->ui_handle; 1499 1512 } 1513 else 1514 PURPLE_REQUEST_NO_OPS("folder", title, dirname); 1500 1515 1501 1516 return NULL; 1502 1517 } -
libpurple/server.c
diff -ru extract/pidgin-2.10.11/libpurple/server.c libpurple/server.c
old new 126 126 PurplePlugin *prpl = NULL; 127 127 PurplePluginProtocolInfo *prpl_info = NULL; 128 128 int val = -EINVAL; 129 const gchar *auto_reply_pref = NULL;130 129 131 130 g_return_val_if_fail(gc != NULL, val); 132 131 … … 148 147 * XXX - If "only auto-reply when away & idle" is set, then shouldn't 149 148 * this only reset lar->sent if we're away AND idle? 150 149 */ 151 auto_reply_pref = purple_prefs_get_string("/purple/away/auto_reply");152 150 if((gc->flags & PURPLE_CONNECTION_AUTO_RESP) && 153 151 !purple_presence_is_available(presence) && 154 !purple_strequal( auto_reply_pref, "never")) {152 !purple_strequal(purple_prefs_get_string("/purple/away/auto_reply"), "never")) { 155 153 156 154 struct last_auto_response *lar; 157 155 lar = get_last_auto_response(gc, name); … … 645 643 const char *away_msg = NULL; 646 644 gboolean mobile = FALSE; 647 645 648 auto_reply_pref = purple_prefs_get_string("/purple/away/auto_reply");649 650 646 presence = purple_account_get_presence(account); 651 647 status = purple_presence_get_active_status(presence); 652 648 status_type = purple_status_get_type(status); … … 655 651 if ((primitive == PURPLE_STATUS_AVAILABLE) || 656 652 (primitive == PURPLE_STATUS_INVISIBLE) || 657 653 mobile || 658 purple_strequal( auto_reply_pref, "never") ||654 purple_strequal((auto_reply_pref = purple_prefs_get_string("/purple/away/auto_reply")), "never") || 659 655 (!purple_presence_is_idle(presence) && purple_strequal(auto_reply_pref, "awayidle"))) 660 656 { 661 657 g_free(name); -
libpurple/smiley.c
diff -ru extract/pidgin-2.10.11/libpurple/smiley.c libpurple/smiley.c
old new 60 60 static char *smileys_dir = NULL; 61 61 62 62 #define SMILEYS_DEFAULT_FOLDER "custom_smiley" 63 #define SMILEYS_LOG_ID "smileys"63 #define SMILEYS_LOG_ID N_("smileys") 64 64 65 65 #define XML_FILE_NAME "smileys.xml" 66 66 -
libpurple/ssl-nss.c
diff -ru extract/pidgin-2.10.11/libpurple/ssl-nss.c libpurple/ssl-nss.c
old new 21 21 */ 22 22 #include "internal.h" 23 23 #include "debug.h" 24 #include "certificate.h"25 24 #include "plugin.h" 26 25 #include "sslconn.h" 27 26 #include "util.h" … … 73 72 74 73 #define PURPLE_SSL_NSS_DATA(gsc) ((PurpleSslNssData *)gsc->private_data) 75 74 76 static const PRIOMethods *_nss_methods = NULL; 77 static PRDescIdentity _identity; 78 static PurpleCertificateScheme x509_nss; 75 /* static const PRIOMethods *_nss_methods = NULL; */ 76 /* static PRDescIdentity _identity; */ 77 /* static PurpleCertificateScheme x509_nss; */ 79 78 80 79 /* Thank you, Evolution */ 81 80 static void … … 226 225 static void 227 226 ssl_nss_init_nss(void) 228 227 { 228 #if 0 229 229 #if NSS_VMAJOR > 3 || ( NSS_VMAJOR == 3 && NSS_VMINOR >= 14 ) 230 230 SSLVersionRange supported, enabled; 231 231 #endif /* NSS >= 3.14 */ … … 268 268 269 269 _identity = PR_GetUniqueIdentity("Purple"); 270 270 _nss_methods = PR_GetDefaultIOMethods(); 271 #endif 271 272 272 273 } 273 274 … … 300 301 static void 301 302 ssl_nss_uninit(void) 302 303 { 304 #if 0 303 305 NSS_Shutdown(); 304 306 PR_Cleanup(); 305 307 306 308 _nss_methods = NULL; 309 #endif 307 310 } 308 311 312 #if 0 309 313 static void 310 314 ssl_nss_verified_cb(PurpleCertificateVerificationStatus st, 311 315 gpointer userdata) … … 382 386 383 387 return peer_certs; 384 388 } 389 #endif 385 390 386 391 /* 387 392 * Ideally this information would be exposed to the UI somehow, but for now we … … 455 460 purple_input_remove(nss_data->handshake_handler); 456 461 nss_data->handshake_handler = 0; 457 462 463 gsc->connect_cb(gsc->connect_cb_data, gsc, cond); 464 465 #if 0 458 466 /* If a Verifier was given, hand control over to it */ 459 467 if (gsc->verifier) { 460 468 GList *peers; … … 477 485 */ 478 486 gsc->connect_cb(gsc->connect_cb_data, gsc, cond); 479 487 } 488 #endif 480 489 } 481 490 482 491 static gboolean … … 538 547 539 548 SSL_OptionSet(nss_data->in, SSL_SECURITY, PR_TRUE); 540 549 SSL_OptionSet(nss_data->in, SSL_HANDSHAKE_AS_CLIENT, PR_TRUE); 550 SSL_OptionSet(nss_data->in, SSL_ENABLE_SESSION_TICKETS, PR_FALSE); 541 551 542 552 /* If we have our internal verifier set up, use it. Otherwise, 543 553 * use default. */ 544 if (gsc->verifier != NULL )554 if (gsc->verifier != NULL && !purple_prefs_get_bool("/purple/ssl/check_certificates")) 545 555 SSL_AuthCertificateHook(nss_data->in, ssl_auth_cert, NULL); 546 556 547 557 if(gsc->host) … … 593 603 PRInt32 ret; 594 604 PurpleSslNssData *nss_data = PURPLE_SSL_NSS_DATA(gsc); 595 605 606 if (nss_data->handshake_handler != 0) { 607 purple_debug_error("nss", "attempting to read from an ssl socket before the end of the handshake\n"); 608 return -1; 609 } 610 596 611 ret = PR_Read(nss_data->in, data, len); 597 612 598 613 if (ret == -1) … … 610 625 if(!nss_data) 611 626 return 0; 612 627 628 if (nss_data->handshake_handler != 0) { 629 purple_debug_error("nss", "attempting to write to an ssl socket before the end of the handshake\n"); 630 return -1; 631 } 632 613 633 ret = PR_Write(nss_data->in, data, len); 614 634 615 635 if (ret == -1) … … 642 662 return NULL; 643 663 } 644 664 665 #if 0 666 /* No purple_certificate_* stuff for Instantbird */ 667 645 668 /************************************************************************/ 646 669 /* X.509 functionality */ 647 670 /************************************************************************/ … … 1213 1236 x509_verify_cert, /* Verify that the specified cert chain is trusted */ 1214 1237 NULL 1215 1238 }; 1239 #endif 1216 1240 1217 1241 static PurpleSslOps ssl_ops = 1218 1242 { … … 1231 1255 }; 1232 1256 1233 1257 1258 void purple_nss_init(void) 1259 { 1260 purple_ssl_set_ops(&ssl_ops); 1261 } 1262 1263 #if 0 1264 /* Instantbird does not need the plugin stuff for NSS */ 1234 1265 static gboolean 1235 1266 plugin_load(PurplePlugin *plugin) 1236 1267 { … … 1303 1334 } 1304 1335 1305 1336 PURPLE_INIT_PLUGIN(ssl_nss, init_plugin, info) 1337 #endif -
libpurple/sslconn.c
diff -ru extract/pidgin-2.10.11/libpurple/sslconn.c libpurple/sslconn.c
old new 27 27 28 28 #include "internal.h" 29 29 30 #include "certificate.h"31 30 #include "debug.h" 32 31 #include "request.h" 33 32 #include "sslconn.h" 34 33 34 extern void purple_nss_init(void); 35 35 36 static gboolean _ssl_initialized = FALSE; 36 37 static PurpleSslOps *_ssl_ops = NULL; 37 38 … … 43 44 44 45 if (_ssl_initialized) 45 46 return FALSE; 47 #if 0 46 48 47 49 plugin = purple_plugins_find_with_id("core-ssl"); 48 50 49 51 if (plugin != NULL && !purple_plugin_is_loaded(plugin)) 50 52 purple_plugin_load(plugin); 53 #endif 54 purple_nss_init(); 51 55 52 56 ops = purple_ssl_get_ops(); 53 57 if ((ops == NULL) || (ops->init == NULL) || (ops->uninit == NULL) || … … 63 67 gboolean 64 68 purple_ssl_is_supported(void) 65 69 { 66 #ifdef HAVE_SSL67 70 ssl_init(); 68 71 return (purple_ssl_get_ops() != NULL); 69 #else70 return FALSE;71 #endif72 72 } 73 73 74 74 static void … … 131 131 gsc->connect_cb = func; 132 132 gsc->error_cb = error_func; 133 133 134 #if 0 134 135 /* TODO: Move this elsewhere */ 135 136 gsc->verifier = purple_certificate_find_verifier("x509","tls_cached"); 137 #endif 136 138 137 139 gsc->connect_data = purple_proxy_connect(NULL, account, host, port, purple_ssl_connect_cb, gsc); 138 140 … … 222 224 if(host) 223 225 gsc->host = g_strdup(host); 224 226 227 #if 0 225 228 /* TODO: Move this elsewhere */ 226 229 gsc->verifier = purple_certificate_find_verifier("x509","tls_cached"); 230 #endif 227 231 228 232 229 233 ops = purple_ssl_get_ops(); -
libpurple/sslconn.h
diff -ru extract/pidgin-2.10.11/libpurple/sslconn.h libpurple/sslconn.h
old new 34 34 PURPLE_SSL_CERTIFICATE_INVALID = 3 35 35 } PurpleSslErrorType; 36 36 37 #include "certificate.h"38 37 #include "proxy.h" 39 38 40 39 #define PURPLE_SSL_DEFAULT_PORT 443 41 40 42 41 /** @copydoc _PurpleSslConnection */ 43 42 typedef struct _PurpleSslConnection PurpleSslConnection; 43 typedef struct _PurpleCertificateVerifier PurpleCertificateVerifier; 44 44 45 45 typedef void (*PurpleSslInputFunction)(gpointer, PurpleSslConnection *, 46 46 PurpleInputCondition); -
libpurple/status.c
diff -ru extract/pidgin-2.10.11/libpurple/status.c libpurple/status.c
old new 607 607 notify_buddy_status_update(PurpleBuddy *buddy, PurplePresence *presence, 608 608 PurpleStatus *old_status, PurpleStatus *new_status) 609 609 { 610 #if 0 610 611 if (purple_prefs_get_bool("/purple/logging/log_system")) 611 612 { 612 613 time_t current_time = time(NULL); … … 652 653 g_free(tmp); 653 654 g_free(logtmp); 654 655 } 656 #endif 655 657 } 656 658 657 659 static void … … 1253 1255 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); 1254 1256 PurpleAccount *account = purple_buddy_get_account(buddy); 1255 1257 1258 #if 0 1256 1259 if (!old_idle && idle) 1257 1260 { 1258 1261 if (purple_prefs_get_bool("/purple/logging/log_system")) … … 1293 1296 } 1294 1297 } 1295 1298 } 1299 #endif 1296 1300 1297 1301 if (old_idle != idle) 1298 1302 purple_signal_emit(purple_blist_get_handle(), "buddy-idle-changed", buddy, … … 1339 1343 1340 1344 account = purple_presence_get_account(presence); 1341 1345 1346 #if 0 1342 1347 if (purple_prefs_get_bool("/purple/logging/log_system")) 1343 1348 { 1344 1349 PurpleLog *log = purple_account_get_log(account, FALSE); … … 1360 1365 g_free(msg); 1361 1366 } 1362 1367 } 1368 #endif 1363 1369 1364 1370 gc = purple_account_get_connection(account); 1365 1371 -
libpurple/upnp.h
diff -ru extract/pidgin-2.10.11/libpurple/upnp.h libpurple/upnp.h
old new 61 61 */ 62 62 void purple_upnp_discover(PurpleUPnPCallback cb, gpointer cb_data); 63 63 64 #if 065 /**66 * Retrieve the current UPnP control info, if there is any available.67 * This will only be filled in if purple_upnp_discover() had been called,68 * and finished discovering.69 *70 * @return The control URL for the IGD we'll use to use the IGD services71 */72 const PurpleUPnPControlInfo* purple_upnp_get_control_info(void);73 #endif74 75 64 /** 76 65 * Gets the IP address from a UPnP enabled IGD that sits on the local 77 66 * network, so when getting the network IP, instead of returning the -
libpurple/util.c
diff -ru extract/pidgin-2.10.11/libpurple/util.c libpurple/util.c
old new 2497 2497 /************************************************************************** 2498 2498 * Path/Filename Functions 2499 2499 **************************************************************************/ 2500 #ifdef PURPLE_PLUGINS 2500 2501 const char * 2501 2502 purple_home_dir(void) 2502 2503 { … … 2506 2507 return wpurple_data_dir(); 2507 2508 #endif 2508 2509 } 2510 #endif 2509 2511 2510 2512 /* Returns the argument passed to -c IFF it was present, or ~/.purple. */ 2511 2513 const char * 2512 2514 purple_user_dir(void) 2513 2515 { 2514 if (custom_user_dir != NULL) 2515 return custom_user_dir; 2516 else if (!user_dir) 2517 user_dir = g_build_filename(purple_home_dir(), ".purple", NULL); 2518 2519 return user_dir; 2516 g_return_val_if_fail(custom_user_dir != NULL, NULL); 2517 return custom_user_dir; 2520 2518 } 2521 2519 2522 2520 void purple_util_set_user_dir(const char *dir) … … 2730 2728 return xmlnode_from_file(purple_user_dir(), filename, description, "util"); 2731 2729 } 2732 2730 2731 #if 0 2733 2732 /* 2734 2733 * Like mkstemp() but returns a file pointer, uses a pre-set template, 2735 2734 * uses the semantics of tempnam() for the directory to use and allocates … … 2778 2777 2779 2778 return fp; 2780 2779 } 2780 #endif 2781 2781 2782 2782 const char * 2783 2783 purple_util_get_image_extension(gconstpointer data, size_t len) … … 2845 2845 return filename; 2846 2846 } 2847 2847 2848 #if 0 2848 2849 gboolean 2849 2850 purple_program_is_valid(const char *program) 2850 2851 { … … 2880 2881 2881 2882 return is_valid; 2882 2883 } 2883 2884 #endif 2884 2885 2885 2886 gboolean 2886 2887 purple_running_gnome(void) 2887 2888 { 2888 #if ndef _WIN322889 #if !defined(_WIN32) && !defined(__APPLE__) 2889 2890 gchar *tmp = g_find_program_in_path("gnome-open"); 2890 2891 2891 2892 if (tmp == NULL) … … 2903 2904 gboolean 2904 2905 purple_running_kde(void) 2905 2906 { 2906 #if ndef _WIN322907 #if !defined(_WIN32) && !defined(__APPLE__) 2907 2908 gchar *tmp = g_find_program_in_path("kfmclient"); 2908 2909 const char *session; 2909 2910 -
libpurple/util.h
diff -ru extract/pidgin-2.10.11/libpurple/util.h libpurple/util.h
old new 644 644 * 645 645 * @see purple_user_dir() 646 646 */ 647 const gchar *purple_home_dir(void); 647 /* const gchar *purple_home_dir(void); */ 648 648 649 649 /** 650 650 * Returns the purple settings directory in the user's home directory. … … 745 745 * 746 746 * @return A file pointer to the temporary file, or @c NULL on failure. 747 747 */ 748 FILE *purple_mkstemp(char **path, gboolean binary); 748 /* FILE *purple_mkstemp(char **path, gboolean binary); */ 749 749 750 750 /** 751 751 * Returns an extension corresponding to the image data's file type. … … 787 787 * 788 788 * @return TRUE if the program is runable. 789 789 */ 790 gboolean purple_program_is_valid(const char *program); 790 /* gboolean purple_program_is_valid(const char *program); */ 791 791 792 792 /** 793 793 * Check if running GNOME. -
libpurple/win32/libc_interface.h
Only in libpurple: version.h diff -ru extract/pidgin-2.10.11/libpurple/win32/libc_interface.h libpurple/win32/libc_interface.h
old new 134 134 /* stdio.h */ 135 135 #undef snprintf 136 136 #define snprintf _snprintf 137 #undef vsnprintf138 #define vsnprintf _vsnprintf139 137 140 138 #define rename( oldname, newname ) \ 141 139 wpurple_rename( oldname, newname ) -
libpurple/win32/win32dep.c
diff -ru extract/pidgin-2.10.11/libpurple/win32/win32dep.c libpurple/win32/win32dep.c
old new 22 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA 23 23 * 24 24 */ 25 #ifndef _WIN32_IE 25 26 #define _WIN32_IE 0x501 27 #endif 28 26 29 #include "internal.h" 27 30 #include <winuser.h> 28 31 … … 112 115 113 116 /* Determine Purple Paths during Runtime */ 114 117 118 #if 0 115 119 /* Get paths to special Windows folders. */ 116 120 gchar *wpurple_get_special_folder(int folder_type) { 117 121 gchar *retval = NULL; … … 327 331 328 332 return result; 329 333 } 334 #endif 330 335 331 336 void wpurple_init(void) { 332 337 WORD wVersionRequested; … … 336 341 g_thread_init(NULL); 337 342 338 343 purple_debug_info("wpurple", "wpurple_init start\n"); 339 purple_debug_info("wpurple", "libpurple version: " DISPLAY_VERSION "\n");344 // purple_debug_info("wpurple", "libpurple version: " DISPLAY_VERSION "\n"); 340 345 341 346 purple_debug_info("wpurple", "Glib:%u.%u.%u\n", 342 347 glib_major_version, glib_minor_version, glib_micro_version); -
libpurple/win32/win32dep.h
diff -ru extract/pidgin-2.10.11/libpurple/win32/win32dep.h libpurple/win32/win32dep.h
old new 54 54 **/ 55 55 /* Windows helper functions */ 56 56 FARPROC wpurple_find_and_loadproc(const char *dllname, const char *procedure); 57 gboolean wpurple_read_reg_dword(HKEY rootkey, const char *subkey, const char *valname, LPDWORD result); 58 char *wpurple_read_reg_string(HKEY rootkey, const char *subkey, const char *valname); /* needs to be g_free'd */59 gboolean wpurple_write_reg_string(HKEY rootkey, const char *subkey, const char *valname, const char *value); 57 /* gboolean wpurple_read_reg_dword(HKEY rootkey, const char *subkey, const char *valname, LPDWORD result); */ 58 /* char *wpurple_read_reg_string(HKEY rootkey, const char *subkey, const char *valname); / * needs to be g_free'd */ 59 /* gboolean wpurple_write_reg_string(HKEY rootkey, const char *subkey, const char *valname, const char *value); */ 60 60 char *wpurple_escape_dirsep(const char *filename); /* needs to be g_free'd */ 61 GIOChannel *wpurple_g_io_channel_win32_new_socket(int socket); /* Until we get the post-2.8 glib win32 giochannel implementation working, use the thread-based one */62 61 63 62 /* Determine Purple paths */ 64 gchar *wpurple_get_special_folder(int folder_type); /* needs to be g_free'd */65 const char *wpurple_install_dir(void); 66 const char *wpurple_lib_dir(void); 67 const char *wpurple_locale_dir(void); 68 const char *wpurple_data_dir(void); 63 /* gchar *wpurple_get_special_folder(int folder_type); /* needs to be g_free'd */ 64 /* const char *wpurple_install_dir(void); */ 65 /* const char *wpurple_lib_dir(void); */ 66 /* const char *wpurple_locale_dir(void); */ 67 /* const char *wpurple_data_dir(void); */ 69 68 70 69 /* init / cleanup */ 71 70 void wpurple_init(void); … … 80 79 /* 81 80 * Purple specific 82 81 */ 83 #define DATADIR wpurple_install_dir() 84 #define LIBDIR wpurple_lib_dir() 85 #define LOCALEDIR wpurple_locale_dir() 82 /* #define DATADIR wpurple_install_dir() */ 83 /* #define LIBDIR wpurple_lib_dir() */ 84 /* #define LOCALEDIR wpurple_locale_dir() */ 86 85 87 86 #ifdef __cplusplus 88 87 } -
libpurple/win32/wpurpleerror.h
diff -ru extract/pidgin-2.10.11/libpurple/win32/wpurpleerror.h libpurple/win32/wpurpleerror.h
old new 25 25 #ifndef _WPURPLEERROR_H 26 26 #define _WPURPLEERROR_H 27 27 28 #if defined(_MSC_VER) && _MSC_VER >= 1600 29 /* libpurple expects errno to contain winsocks error codes rather than 30 the real errno values (which are defined in MSVC10). */ 31 32 /* Include the Microsoft errno.h before undefining the error codes, so 33 that it doesn't do anything if it is included later (avoid macro 34 redefinition warnings). */ 35 #include <errno.h> 36 #endif 37 28 38 /* Here we define unix socket errors as windows socket errors */ 29 39 30 40 #undef ENETDOWN … … 44 54 45 55 #undef EADDRINUSE 46 56 #define EADDRINUSE WSAEADDRINUSE 47 #undef EINPROGRESS48 #define EINPROGRESS WSAEINPROGRESS49 57 #undef EALREADY 50 58 #define EALREADY WSAEALREADY 51 59 #undef EADDRNOTAVAIL