akronix: diff-current-to-2.10.9.patch
File diff-current-to-2.10.9.patch, 234.8 KB (added by , 9 years ago) |
---|
-
libpurple/account.c
diff -ru extract/pidgin-2.10.9/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; … … 89 90 static void set_current_error(PurpleAccount *account, 90 91 PurpleConnectionErrorInfo *new_err); 91 92 93 #if 0 92 94 /********************************************************************* 93 95 * Writing to disk * 94 96 *********************************************************************/ … … 961 963 962 964 return ret; 963 965 } 966 #endif 964 967 965 968 static void 966 969 load_accounts(void) … … 969 972 970 973 accounts_loaded = TRUE; 971 974 975 #if 0 972 976 node = purple_util_read_xml_from_file("accounts.xml", _("accounts")); 973 977 974 978 if (node == NULL) … … 985 989 xmlnode_free(node); 986 990 987 991 _purple_buddy_icons_account_loaded_cb(); 992 #endif 988 993 } 989 994 990 995 … … 1097 1102 1098 1103 purple_presence_destroy(account->presence); 1099 1104 1105 #if 0 1100 1106 if(account->system_log) 1101 1107 purple_log_free(account->system_log); 1108 #endif 1102 1109 1103 1110 while (account->deny) { 1104 1111 g_free(account->deny->data); … … 1282 1289 1283 1290 gc = purple_account_get_connection(account); 1284 1291 _purple_connection_destroy(gc); 1292 1293 /* 1294 XXXFlo: disable this until the UI for requesting a password 1295 from the user works in Instantbird 1285 1296 if (!purple_account_get_remember_password(account)) 1286 1297 purple_account_set_password(account, NULL); 1298 */ 1287 1299 purple_account_set_connection(account, NULL); 1288 1300 1289 1301 account->disconnecting = FALSE; … … 1977 1989 purple_account_set_int(PurpleAccount *account, const char *name, int value) 1978 1990 { 1979 1991 PurpleAccountSetting *setting; 1992 PurpleAccountUiOps *ui_ops; 1980 1993 1981 1994 g_return_if_fail(account != NULL); 1982 1995 g_return_if_fail(name != NULL); … … 1988 2001 1989 2002 g_hash_table_insert(account->settings, g_strdup(name), setting); 1990 2003 2004 ui_ops = purple_accounts_get_ui_ops(); 2005 2006 if (ui_ops != NULL && ui_ops->set_int != NULL) 2007 ui_ops->set_int(account, name, value); 2008 1991 2009 schedule_accounts_save(); 1992 2010 } 1993 2011 … … 1996 2014 const char *value) 1997 2015 { 1998 2016 PurpleAccountSetting *setting; 2017 PurpleAccountUiOps *ui_ops; 1999 2018 2000 2019 g_return_if_fail(account != NULL); 2001 2020 g_return_if_fail(name != NULL); … … 2007 2026 2008 2027 g_hash_table_insert(account->settings, g_strdup(name), setting); 2009 2028 2029 ui_ops = purple_accounts_get_ui_ops(); 2030 2031 if (ui_ops != NULL && ui_ops->set_string != NULL) 2032 ui_ops->set_string(account, name, value); 2033 2010 2034 schedule_accounts_save(); 2011 2035 } 2012 2036 … … 2014 2038 purple_account_set_bool(PurpleAccount *account, const char *name, gboolean value) 2015 2039 { 2016 2040 PurpleAccountSetting *setting; 2041 PurpleAccountUiOps *ui_ops; 2017 2042 2018 2043 g_return_if_fail(account != NULL); 2019 2044 g_return_if_fail(name != NULL); … … 2025 2050 2026 2051 g_hash_table_insert(account->settings, g_strdup(name), setting); 2027 2052 2053 ui_ops = purple_accounts_get_ui_ops(); 2054 2055 if (ui_ops != NULL && ui_ops->set_bool != NULL) 2056 ui_ops->set_bool(account, name, value); 2057 2028 2058 schedule_accounts_save(); 2029 2059 } 2030 2060 … … 2204 2234 2205 2235 p = purple_find_prpl(purple_account_get_protocol_id(account)); 2206 2236 2207 return ((p && p->info->name) ? _(p->info->name): _("Unknown"));2237 return ((p && p->info->name) ? p->info->name : _("Unknown")); 2208 2238 } 2209 2239 2210 2240 PurpleConnection * … … 2396 2426 const char *default_value) 2397 2427 { 2398 2428 PurpleAccountSetting *setting; 2429 const char *value; 2399 2430 2400 2431 g_return_val_if_fail(account != NULL, default_value); 2401 2432 g_return_val_if_fail(name != NULL, default_value); … … 2407 2438 2408 2439 g_return_val_if_fail(setting->type == PURPLE_PREF_STRING, default_value); 2409 2440 2410 return setting->value.string; 2441 value = setting->value.string; 2442 if (value == NULL || !*value) 2443 return default_value; 2444 2445 return value; 2411 2446 } 2412 2447 2413 2448 gboolean … … 2495 2530 return setting->value.boolean; 2496 2531 } 2497 2532 2533 #if 0 2498 2534 PurpleLog * 2499 2535 purple_account_get_log(PurpleAccount *account, gboolean create) 2500 2536 { … … 2525 2561 account->system_log = NULL; 2526 2562 } 2527 2563 } 2564 #endif 2528 2565 2529 2566 void 2530 2567 purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy) … … 2963 3000 purple_conversation_destroy(conv); 2964 3001 } 2965 3002 2966 /* Remove this account's pounces */2967 purple_pounce_destroy_all_by_account(account);2968 2969 3003 /* This will cause the deletion of an old buddy icon. */ 2970 3004 purple_buddy_icons_set_account_icon(account, NULL, 0); 2971 3005 … … 3147 3181 purple_marshal_VOID__POINTER, NULL, 1, 3148 3182 purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT)); 3149 3183 3184 purple_signal_register(handle, "account-status-changing", 3185 purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, 3186 purple_value_new(PURPLE_TYPE_SUBTYPE, 3187 PURPLE_SUBTYPE_ACCOUNT), 3188 purple_value_new(PURPLE_TYPE_SUBTYPE, 3189 PURPLE_SUBTYPE_STATUS), 3190 purple_value_new(PURPLE_TYPE_SUBTYPE, 3191 PURPLE_SUBTYPE_STATUS)); 3192 3150 3193 purple_signal_register(handle, "account-status-changed", 3151 3194 purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, 3152 3195 purple_value_new(PURPLE_TYPE_SUBTYPE, … … 3232 3275 purple_accounts_uninit(void) 3233 3276 { 3234 3277 gpointer handle = purple_accounts_get_handle(); 3278 #if 0 3235 3279 if (save_timer != 0) 3236 3280 { 3237 3281 purple_timeout_remove(save_timer); 3238 3282 save_timer = 0; 3239 3283 sync_accounts(); 3240 3284 } 3241 3285 #endif 3242 3286 for (; accounts; accounts = g_list_delete_link(accounts, accounts)) 3243 3287 purple_account_destroy(accounts->data); 3244 3288 -
libpurple/account.h
diff -ru extract/pidgin-2.10.9/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.9/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 *********************************************************************/ … … 600 600 parse_chat(group, cnode); 601 601 } 602 602 } 603 #endif 603 604 604 605 /* TODO: Make static and rename to load_blist */ 605 606 void 606 607 purple_blist_load() 607 608 { 609 #if 0 608 610 xmlnode *purple, *blist, *privacy; 611 #endif 609 612 610 613 blist_loaded = TRUE; 611 614 615 #if 0 612 616 purple = purple_util_read_xml_from_file("blist.xml", _("buddy list")); 613 617 614 618 if (purple == NULL) … … 670 674 671 675 /* This tells the buddy icon code to do its thing. */ 672 676 _purple_buddy_icons_blist_loaded_cb(); 677 #endif 673 678 } 674 679 675 680 … … 1623 1628 ((PurpleContact*)bnode->parent)->totalsize--; 1624 1629 /* the group totalsize will be taken care of by remove_contact below */ 1625 1630 1626 if (bnode->parent->parent != (PurpleBlistNode*)g) 1631 if (bnode->parent->parent != (PurpleBlistNode*)g) { 1632 purple_signal_emit(purple_blist_get_handle(), "buddy-removed-from-group", buddy); 1627 1633 serv_move_buddy(buddy, (PurpleGroup *)bnode->parent->parent, g); 1634 } 1628 1635 1629 1636 if (bnode->next) 1630 1637 bnode->next->prev = bnode->prev; … … 2185 2192 if (ops && ops->remove_node) 2186 2193 ops->remove_node(node); 2187 2194 2188 /* Remove this buddy's pounces */2189 purple_pounce_destroy_all_by_buddy(buddy);2190 2191 2195 /* Signal that the buddy has been removed before freeing the memory for it */ 2192 2196 purple_signal_emit(purple_blist_get_handle(), "buddy-removed", buddy); 2193 2197 … … 3091 3095 3092 3096 if (!ops) 3093 3097 return; 3094 3098 #if 0 3095 3099 if (!ops->save_node) { 3096 3100 ops->save_node = purple_blist_save_node; 3097 3101 overrode = TRUE; … … 3111 3115 purple_debug_warning("blist", "Only some of the blist saving UI ops " 3112 3116 "were overridden. This probably is not what you want!\n"); 3113 3117 } 3118 #endif 3114 3119 } 3115 3120 3116 3121 PurpleBlistUiOps * … … 3192 3197 purple_value_new(PURPLE_TYPE_SUBTYPE, 3193 3198 PURPLE_SUBTYPE_BLIST_BUDDY)); 3194 3199 3200 purple_signal_register(handle, "buddy-removed-from-group", 3201 purple_marshal_VOID__POINTER, NULL, 1, 3202 purple_value_new(PURPLE_TYPE_SUBTYPE, 3203 PURPLE_SUBTYPE_BLIST_BUDDY)); 3204 3195 3205 purple_signal_register(handle, "buddy-icon-changed", 3196 3206 purple_marshal_VOID__POINTER, NULL, 1, 3197 3207 purple_value_new(PURPLE_TYPE_SUBTYPE, … … 3238 3248 if (purplebuddylist == NULL) 3239 3249 return; 3240 3250 3251 #if 0 3241 3252 if (save_timer != 0) { 3242 3253 purple_timeout_remove(save_timer); 3243 3254 save_timer = 0; 3244 3255 purple_blist_sync(); 3245 3256 } 3257 #endif 3246 3258 3247 3259 purple_blist_destroy(); 3248 3260 -
libpurple/blist.h
diff -ru extract/pidgin-2.10.9/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.9/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.9/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
Only in extract/pidgin-2.10.9/libpurple: certificate.c Only in extract/pidgin-2.10.9/libpurple: certificate.h diff -ru extract/pidgin-2.10.9/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.9/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.9/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.9/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.9/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.9/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) … … 117 115 * for protocol prefs to work. */ 118 116 purple_prefs_init(); 119 117 120 purple_debug_init();121 122 118 if (ops != NULL) 123 119 { 124 120 if (ops->ui_prefs_init != NULL) … … 140 136 */ 141 137 purple_plugins_init(); 142 138 139 #ifdef STATIC_PROTO_INIT 143 140 /* Initialize all static protocols. */ 144 141 static_proto_init(); 142 #endif 145 143 146 purple_plugins_probe(G_MODULE_SUFFIX); 144 if (ops != NULL && ops->register_plugins != NULL) 145 ops->register_plugins(); 147 146 148 purple_ theme_manager_init();147 purple_plugins_probe(G_MODULE_SUFFIX); 149 148 150 149 /* The buddy icon code uses the imgstore, so init it early. */ 151 150 purple_imgstore_init(); … … 158 157 purple_connections_init(); 159 158 160 159 purple_accounts_init(); 161 purple_savedstatuses_init();162 160 purple_notify_init(); 163 purple_certificate_init();164 161 purple_conversations_init(); 165 162 purple_blist_init(); 166 163 purple_log_init(); 167 164 purple_network_init(); 168 165 purple_privacy_init(); 169 purple_pounces_init();170 166 purple_proxy_init(); 171 167 purple_dnsquery_init(); 172 purple_sound_init();173 168 purple_ssl_init(); 174 169 purple_stun_init(); 175 170 purple_xfers_init(); … … 184 179 if (ops != NULL && ops->ui_init != NULL) 185 180 ops->ui_init(); 186 181 187 /* The UI may have registered some theme types, so refresh them */188 purple_theme_manager_refresh();189 190 182 return TRUE; 191 183 } 192 184 … … 204 196 /* Transmission ends */ 205 197 purple_connections_disconnect_all(); 206 198 199 #if 0 207 200 /* 208 201 * Certificates must be destroyed before the SSL plugins, because 209 202 * PurpleCertificates contain pointers to PurpleCertificateSchemes, … … 211 204 * SSL plugin is uninit. 212 205 */ 213 206 purple_certificate_uninit(); 207 #endif 214 208 215 209 /* The SSL plugins must be uninit before they're unloaded */ 216 210 purple_ssl_uninit(); … … 223 217 /* Save .xml files, remove signals, etc. */ 224 218 purple_smileys_uninit(); 225 219 purple_idle_uninit(); 226 purple_pounces_uninit();227 220 purple_blist_uninit(); 228 221 purple_ciphers_uninit(); 229 222 purple_notify_uninit(); 230 223 purple_conversations_uninit(); 231 224 purple_connections_uninit(); 232 225 purple_buddy_icons_uninit(); 233 purple_savedstatuses_uninit();234 226 purple_status_uninit(); 235 227 purple_accounts_uninit(); 236 purple_sound_uninit();237 purple_theme_manager_uninit();238 228 purple_xfers_uninit(); 239 229 purple_proxy_uninit(); 240 230 purple_dnsquery_uninit(); … … 271 261 wpurple_cleanup(); 272 262 #endif 273 263 264 xmlCleanupParser(); 265 274 266 _core = NULL; 275 267 } 276 268 … … 403 395 return TRUE; 404 396 } 405 397 398 #if 0 406 399 gboolean 407 400 purple_core_migrate(void) 408 401 { … … 750 743 g_free(status_file); 751 744 return TRUE; 752 745 } 746 #endif 753 747 754 748 GHashTable* purple_core_get_ui_info() { 755 749 PurpleCoreUiOps *ops = purple_core_get_ui_ops(); -
libpurple/core.h
diff -ru extract/pidgin-2.10.9/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.9/libpurple: dbus-analyze-functions.py Only in extract/pidgin-2.10.9/libpurple: dbus-analyze-signals.py Only in extract/pidgin-2.10.9/libpurple: dbus-analyze-types.py Only in extract/pidgin-2.10.9/libpurple: dbus-bindings.h Only in extract/pidgin-2.10.9/libpurple: dbus-define-api.h Only in extract/pidgin-2.10.9/libpurple: dbus-purple.h Only in extract/pidgin-2.10.9/libpurple: dbus-server.c Only in extract/pidgin-2.10.9/libpurple: dbus-server.h Only in extract/pidgin-2.10.9/libpurple: dbus-types.h Only in extract/pidgin-2.10.9/libpurple: dbus-useful.c Only in extract/pidgin-2.10.9/libpurple: dbus-useful.h diff -ru extract/pidgin-2.10.9/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.9/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
Only in extract/pidgin-2.10.9/libpurple: desktopitem.c Only in extract/pidgin-2.10.9/libpurple: desktopitem.h diff -ru extract/pidgin-2.10.9/libpurple/dnsquery.c libpurple/dnsquery.c
old new 38 38 #include <resolv.h> 39 39 #endif 40 40 41 #if (defined(__APPLE__) || defined (__unix__)) && !defined(__osf__)42 #define PURPLE_DNSQUERY_USE_FORK43 #endif44 41 /************************************************************************** 45 42 * DNS query API 46 43 **************************************************************************/ … … 900 897 return FALSE; 901 898 } 902 899 903 if (purple_dnsquery_ui_resolve(query_data)) 904 /* The UI is handling the resolve; we're done */ 905 return FALSE; 906 907 resolve_host(query_data); 908 900 g_return_val_if_fail(purple_dnsquery_ui_resolve(query_data), FALSE); 901 /* The UI is handling the resolve; we're done */ 909 902 return FALSE; 910 903 } 911 904 -
libpurple/eventloop.c
diff -ru extract/pidgin-2.10.9/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.9/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
Only in extract/pidgin-2.10.9/libpurple: example diff -ru extract/pidgin-2.10.9/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 extract/pidgin-2.10.9/libpurple: gaim-compat.h Only in extract/pidgin-2.10.9/libpurple: gconf Only in libpurple: gettext.c Only in libpurple: gettext.h diff -ru extract/pidgin-2.10.9/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.9/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.9/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 58 # include <libintl.h> 51 # define _(String) ((const char *)dgettext(PACKAGE, String))52 59 # ifdef gettext_noop 60 # undef N_ 53 61 # define N_(String) gettext_noop (String) 54 # else55 # define N_(String) (String)56 62 # endif 57 #else58 # include <locale.h>59 # define N_(String) (String)60 # ifndef _61 # define _(String) ((const char *)String)62 # endif63 # define ngettext(Singular, Plural, Number) ((Number == 1) ? ((const char *)Singular) : ((const char *)Plural))64 # define dngettext(Domain, Singular, Plural, Number) ((Number == 1) ? ((const char *)Singular) : ((const char *)Plural))65 63 #endif 66 64 67 65 #ifdef HAVE_ENDIAN_H … … 99 97 #include <langinfo.h> 100 98 #endif 101 99 102 #include <gmodule.h>103 104 100 #ifdef PURPLE_PLUGINS 101 # include <gmodule.h> 105 102 # ifdef HAVE_DLFCN_H 106 103 # include <dlfcn.h> 107 104 # endif … … 139 136 #include "win32dep.h" 140 137 #endif 141 138 142 #ifdef HAVE_CONFIG_H139 #ifdef SIZEOF_TIME_T 143 140 #if SIZEOF_TIME_T == 4 144 141 # define PURPLE_TIME_T_MODIFIER "lu" 145 142 #elif SIZEOF_TIME_T == 8 -
libpurple/log.h
Only in extract/pidgin-2.10.9/libpurple: log.c diff -ru extract/pidgin-2.10.9/libpurple/log.h libpurple/log.h
old new 1 /**2 * @file log.h Logging API3 * @ingroup core4 * @see @ref log-signals5 */6 7 /* purple8 *9 * Purple is the legal property of its developers, whose names are too numerous10 * to list here. Please refer to the COPYRIGHT file distributed with this11 * source distribution.12 *13 * This program is free software; you can redistribute it and/or modify14 * it under the terms of the GNU General Public License as published by15 * the Free Software Foundation; either version 2 of the License, or16 * (at your option) any later version.17 *18 * This program is distributed in the hope that it will be useful,19 * but WITHOUT ANY WARRANTY; without even the implied warranty of20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the21 * GNU General Public License for more details.22 *23 * You should have received a copy of the GNU General Public License24 * along with this program; if not, write to the Free Software25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA26 */27 1 #ifndef _PURPLE_LOG_H_ 28 2 #define _PURPLE_LOG_H_ 29 3 30 #include <stdio.h> 31 32 33 /******************************************************** 34 * DATA STRUCTURES ************************************** 35 ********************************************************/ 36 37 typedef struct _PurpleLog PurpleLog; 38 typedef struct _PurpleLogLogger PurpleLogLogger; 39 typedef struct _PurpleLogCommonLoggerData PurpleLogCommonLoggerData; 40 typedef struct _PurpleLogSet PurpleLogSet; 41 42 typedef enum { 43 PURPLE_LOG_IM, 44 PURPLE_LOG_CHAT, 45 PURPLE_LOG_SYSTEM 46 } PurpleLogType; 47 48 typedef enum { 49 PURPLE_LOG_READ_NO_NEWLINE = 1 50 } PurpleLogReadFlags; 51 52 #include "account.h" 53 #include "conversation.h" 54 55 typedef void (*PurpleLogSetCallback) (GHashTable *sets, PurpleLogSet *set); 56 57 /** 58 * A log logger. 59 * 60 * This struct gets filled out and is included in the PurpleLog. It contains everything 61 * needed to write and read from logs. 62 */ 63 struct _PurpleLogLogger { 64 char *name; /**< The logger's name */ 65 char *id; /**< an identifier to refer to this logger */ 66 67 /** This gets called when the log is first created. 68 I don't think this is actually needed. */ 69 void (*create)(PurpleLog *log); 70 71 /** This is used to write to the log file */ 72 gsize (*write)(PurpleLog *log, 73 PurpleMessageFlags type, 74 const char *from, 75 time_t time, 76 const char *message); 77 78 /** Called when the log is destroyed */ 79 void (*finalize)(PurpleLog *log); 80 81 /** This function returns a sorted GList of available PurpleLogs */ 82 GList *(*list)(PurpleLogType type, const char *name, PurpleAccount *account); 83 84 /** Given one of the logs returned by the logger's list function, 85 * this returns the contents of the log in GtkIMHtml markup */ 86 char *(*read)(PurpleLog *log, PurpleLogReadFlags *flags); 87 88 /** Given one of the logs returned by the logger's list function, 89 * this returns the size of the log in bytes */ 90 int (*size)(PurpleLog *log); 91 92 /** Returns the total size of all the logs. If this is undefined a default 93 * implementation is used */ 94 int (*total_size)(PurpleLogType type, const char *name, PurpleAccount *account); 95 96 /** This function returns a sorted GList of available system PurpleLogs */ 97 GList *(*list_syslog)(PurpleAccount *account); 98 99 /** Adds PurpleLogSets to a GHashTable. By passing the data in the PurpleLogSets 100 * to list, the caller can get every available PurpleLog from the logger. 101 * Loggers using purple_log_common_writer() (or otherwise storing their 102 * logs in the same directory structure as the stock loggers) do not 103 * need to implement this function. 104 * 105 * Loggers which implement this function must create a PurpleLogSet, 106 * then call @a cb with @a sets and the newly created PurpleLogSet. */ 107 void (*get_log_sets)(PurpleLogSetCallback cb, GHashTable *sets); 108 109 /* Attempts to delete the specified log, indicating success or failure */ 110 gboolean (*remove)(PurpleLog *log); 111 112 /* Tests whether a log is deletable */ 113 gboolean (*is_deletable)(PurpleLog *log); 114 115 void (*_purple_reserved1)(void); 116 void (*_purple_reserved2)(void); 117 void (*_purple_reserved3)(void); 118 void (*_purple_reserved4)(void); 119 }; 120 121 /** 122 * A log. Not the wooden type. 123 */ 124 struct _PurpleLog { 125 PurpleLogType type; /**< The type of log this is */ 126 char *name; /**< The name of this log */ 127 PurpleAccount *account; /**< The account this log is taking 128 place on */ 129 PurpleConversation *conv; /**< The conversation being logged */ 130 time_t time; /**< The time this conversation 131 started, converted to the local timezone */ 132 133 PurpleLogLogger *logger; /**< The logging mechanism this log 134 is to use */ 135 void *logger_data; /**< Data used by the log logger */ 136 struct tm *tm; /**< The time this conversation 137 started, saved with original 138 timezone data, if available and 139 if struct tm has the BSD 140 timezone fields, else @c NULL. 141 Do NOT modify anything in this struct.*/ 142 143 /* IMPORTANT: Some code in log.c allocates these without zeroing them. 144 * IMPORTANT: Update that code if you add members here. */ 145 }; 146 147 /** 148 * A common logger_data struct containing a file handle and path, as well 149 * as a pointer to something else for additional data. 150 */ 151 struct _PurpleLogCommonLoggerData { 152 char *path; 153 FILE *file; 154 void *extra_data; 155 }; 156 157 /** 158 * Describes available logs. 159 * 160 * By passing the elements of this struct to purple_log_get_logs(), the caller 161 * can get all available PurpleLogs. 162 */ 163 struct _PurpleLogSet { 164 PurpleLogType type; /**< The type of logs available */ 165 char *name; /**< The name of the logs available */ 166 PurpleAccount *account; /**< The account the available logs 167 took place on. This will be 168 @c NULL if the account no longer 169 exists. (Depending on a 170 logger's implementation of 171 list, it may not be possible 172 to load such logs.) */ 173 gboolean buddy; /**< Is this (account, name) a buddy 174 on the buddy list? */ 175 char *normalized_name; /**< The normalized version of 176 @a name. It must be set, and 177 may be set to the same pointer 178 value as @a name. */ 179 180 /* IMPORTANT: Some code in log.c allocates these without zeroing them. 181 * IMPORTANT: Update that code if you add members here. */ 182 }; 183 184 #ifdef __cplusplus 185 extern "C" { 186 #endif 187 188 /***************************************/ 189 /** @name Log Functions */ 190 /***************************************/ 191 /*@{*/ 192 193 /** 194 * Creates a new log 195 * 196 * @param type The type of log this is. 197 * @param name The name of this conversation (buddy name, chat name, 198 * etc.) 199 * @param account The account the conversation is occurring on 200 * @param conv The conversation being logged 201 * @param time The time this conversation started 202 * @param tm The time this conversation started, with timezone data, 203 * if available and if struct tm has the BSD timezone fields. 204 * @return The new log 205 */ 206 PurpleLog *purple_log_new(PurpleLogType type, const char *name, PurpleAccount *account, 207 PurpleConversation *conv, time_t time, const struct tm *tm); 208 209 /** 210 * Frees a log 211 * 212 * @param log The log to destroy 213 */ 214 void purple_log_free(PurpleLog *log); 215 216 /** 217 * Writes to a log file. Assumes you have checked preferences already. 218 * 219 * @param log The log to write to 220 * @param type The type of message being logged 221 * @param from Whom this message is coming from, or @c NULL for 222 * system messages 223 * @param time A timestamp in UNIX time 224 * @param message The message to log 225 */ 226 void purple_log_write(PurpleLog *log, 227 PurpleMessageFlags type, 228 const char *from, 229 time_t time, 230 const char *message); 231 232 /** 233 * Reads from a log 234 * 235 * @param log The log to read from 236 * @param flags The returned logging flags. 237 * 238 * @return The contents of this log in Purple Markup. 239 */ 240 char *purple_log_read(PurpleLog *log, PurpleLogReadFlags *flags); 241 242 /** 243 * Returns a list of all available logs 244 * 245 * @param type The type of the log 246 * @param name The name of the log 247 * @param account The account 248 * @return A sorted list of PurpleLogs 249 */ 250 GList *purple_log_get_logs(PurpleLogType type, const char *name, PurpleAccount *account); 251 252 /** 253 * Returns a GHashTable of PurpleLogSets. 254 * 255 * A "log set" here means the information necessary to gather the 256 * PurpleLogs for a given buddy/chat. This information would be passed 257 * to purple_log_list to get a list of PurpleLogs. 258 * 259 * The primary use of this function is to get a list of everyone the 260 * user has ever talked to (assuming he or she uses logging). 261 * 262 * The GHashTable that's returned will free all log sets in it when 263 * destroyed. If a PurpleLogSet is removed from the GHashTable, it 264 * must be freed with purple_log_set_free(). 265 * 266 * @return A GHashTable of all available unique PurpleLogSets 267 */ 268 GHashTable *purple_log_get_log_sets(void); 269 270 /** 271 * Returns a list of all available system logs 272 * 273 * @param account The account 274 * @return A sorted list of PurpleLogs 275 */ 276 GList *purple_log_get_system_logs(PurpleAccount *account); 277 278 /** 279 * Returns the size of a log 280 * 281 * @param log The log 282 * @return The size of the log, in bytes 283 */ 284 int purple_log_get_size(PurpleLog *log); 285 286 /** 287 * Returns the size, in bytes, of all available logs in this conversation 288 * 289 * @param type The type of the log 290 * @param name The name of the log 291 * @param account The account 292 * @return The size in bytes 293 */ 294 int purple_log_get_total_size(PurpleLogType type, const char *name, PurpleAccount *account); 295 296 /** 297 * Returns the activity score of a log, based on total size in bytes, 298 * which is then decayed based on age 299 * 300 * @param type The type of the log 301 * @param name The name of the log 302 * @param account The account 303 * @return The activity score 304 * 305 * @since 2.6.0 306 */ 307 int purple_log_get_activity_score(PurpleLogType type, const char *name, PurpleAccount *account); 308 309 /** 310 * Tests whether a log is deletable 311 * 312 * A return value of @c FALSE indicates that purple_log_delete() will fail on this 313 * log, unless something changes between the two calls. A return value of @c TRUE, 314 * however, does not guarantee the log can be deleted. 315 * 316 * @param log The log 317 * @return A boolean indicating if the log is deletable 318 */ 319 gboolean purple_log_is_deletable(PurpleLog *log); 320 321 /** 322 * Deletes a log 323 * 324 * @param log The log 325 * @return A boolean indicating success or failure 326 */ 327 gboolean purple_log_delete(PurpleLog *log); 328 329 /** 330 * Returns the default logger directory Purple uses for a given account 331 * and username. This would be where Purple stores logs created by 332 * the built-in text or HTML loggers. 333 * 334 * @param type The type of the log. 335 * @param name The name of the log. 336 * @param account The account. 337 * @return The default logger directory for Purple. 338 */ 339 char *purple_log_get_log_dir(PurpleLogType type, const char *name, PurpleAccount *account); 340 341 /** 342 * Implements GCompareFunc for PurpleLogs 343 * 344 * @param y A PurpleLog 345 * @param z Another PurpleLog 346 * @return A value as specified by GCompareFunc 347 */ 348 gint purple_log_compare(gconstpointer y, gconstpointer z); 349 350 /** 351 * Implements GCompareFunc for PurpleLogSets 352 * 353 * @param y A PurpleLogSet 354 * @param z Another PurpleLogSet 355 * @return A value as specified by GCompareFunc 356 */ 357 gint purple_log_set_compare(gconstpointer y, gconstpointer z); 358 359 /** 360 * Frees a log set 361 * 362 * @param set The log set to destroy 363 */ 364 void purple_log_set_free(PurpleLogSet *set); 365 366 /*@}*/ 367 368 /******************************************/ 369 /** @name Common Logger Functions */ 370 /******************************************/ 371 /*@{*/ 372 373 /** 374 * Opens a new log file in the standard Purple log location 375 * with the given file extension, named for the current time, 376 * for writing. If a log file is already open, the existing 377 * file handle is retained. The log's logger_data value is 378 * set to a PurpleLogCommonLoggerData struct containing the log 379 * file handle and log path. 380 * 381 * This function is intended to be used as a "common" 382 * implementation of a logger's @c write function. 383 * It should only be passed to purple_log_logger_new() and never 384 * called directly. 385 * 386 * @param log The log to write to. 387 * @param ext The file extension to give to this log file. 388 */ 389 void purple_log_common_writer(PurpleLog *log, const char *ext); 390 391 /** 392 * Returns a sorted GList of PurpleLogs of the requested type. 393 * 394 * This function should only be used with logs that are written 395 * with purple_log_common_writer(). It's intended to be used as 396 * a "common" implementation of a logger's @c list function. 397 * It should only be passed to purple_log_logger_new() and never 398 * called directly. 399 * 400 * @param type The type of the logs being listed. 401 * @param name The name of the log. 402 * @param account The account of the log. 403 * @param ext The file extension this log format uses. 404 * @param logger A reference to the logger struct for this log. 405 * 406 * @return A sorted GList of PurpleLogs matching the parameters. 407 */ 408 GList *purple_log_common_lister(PurpleLogType type, const char *name, 409 PurpleAccount *account, const char *ext, 410 PurpleLogLogger *logger); 411 412 /** 413 * Returns the total size of all the logs for a given user, with 414 * a given extension. 415 * 416 * This function should only be used with logs that are written 417 * with purple_log_common_writer(). It's intended to be used as 418 * a "common" implementation of a logger's @c total_size function. 419 * It should only be passed to purple_log_logger_new() and never 420 * called directly. 421 * 422 * @param type The type of the logs being sized. 423 * @param name The name of the logs to size 424 * (e.g. the username or chat name). 425 * @param account The account of the log. 426 * @param ext The file extension this log format uses. 427 * 428 * @return The size of all the logs with the specified extension 429 * for the specified user. 430 */ 431 int purple_log_common_total_sizer(PurpleLogType type, const char *name, 432 PurpleAccount *account, const char *ext); 433 434 /** 435 * Returns the size of a given PurpleLog. 436 * 437 * This function should only be used with logs that are written 438 * with purple_log_common_writer(). It's intended to be used as 439 * a "common" implementation of a logger's @c size function. 440 * It should only be passed to purple_log_logger_new() and never 441 * called directly. 442 * 443 * @param log The PurpleLog to size. 444 * 445 * @return An integer indicating the size of the log in bytes. 446 */ 447 int purple_log_common_sizer(PurpleLog *log); 448 449 /** 450 * Deletes a log 451 * 452 * This function should only be used with logs that are written 453 * with purple_log_common_writer(). It's intended to be used as 454 * a "common" implementation of a logger's @c delete function. 455 * It should only be passed to purple_log_logger_new() and never 456 * called directly. 457 * 458 * @param log The PurpleLog to delete. 459 * 460 * @return A boolean indicating success or failure. 461 */ 462 gboolean purple_log_common_deleter(PurpleLog *log); 463 464 /** 465 * Checks to see if a log is deletable 466 * 467 * This function should only be used with logs that are written 468 * with purple_log_common_writer(). It's intended to be used as 469 * a "common" implementation of a logger's @c is_deletable function. 470 * It should only be passed to purple_log_logger_new() and never 471 * called directly. 472 * 473 * @param log The PurpleLog to check. 474 * 475 * @return A boolean indicating if the log is deletable. 476 */ 477 gboolean purple_log_common_is_deletable(PurpleLog *log); 478 479 /*@}*/ 480 481 /******************************************/ 482 /** @name Logger Functions */ 483 /******************************************/ 484 /*@{*/ 485 486 /** 487 * Creates a new logger 488 * 489 * @param id The logger's id. 490 * @param name The logger's name. 491 * @param functions The number of functions being passed. The following 492 * functions are currently available (in order): @c create, 493 * @c write, @c finalize, @c list, @c read, @c size, 494 * @c total_size, @c list_syslog, @c get_log_sets, 495 * @c remove, @c is_deletable. 496 * For details on these functions, see PurpleLogLogger. 497 * Functions may not be skipped. For example, passing 498 * @c create and @c write is acceptable (for a total of 499 * two functions). Passing @c create and @c finalize, 500 * however, is not. To accomplish that, the caller must 501 * pass @c create, @c NULL (a placeholder for @c write), 502 * and @c finalize (for a total of 3 functions). 503 * 504 * @return The new logger 505 */ 506 PurpleLogLogger *purple_log_logger_new(const char *id, const char *name, int functions, ...); 507 508 /** 509 * Frees a logger 510 * 511 * @param logger The logger to free 512 */ 513 void purple_log_logger_free(PurpleLogLogger *logger); 514 515 /** 516 * Adds a new logger 517 * 518 * @param logger The new logger to add 519 */ 520 void purple_log_logger_add (PurpleLogLogger *logger); 521 522 /** 523 * 524 * Removes a logger 525 * 526 * @param logger The logger to remove 527 */ 528 void purple_log_logger_remove (PurpleLogLogger *logger); 529 530 /** 531 * 532 * Sets the current logger 533 * 534 * @param logger The logger to set 535 */ 536 void purple_log_logger_set (PurpleLogLogger *logger); 537 538 /** 539 * 540 * Returns the current logger 541 * 542 * @return logger The current logger 543 */ 544 PurpleLogLogger *purple_log_logger_get (void); 545 546 /** 547 * Returns a GList containing the IDs and names of the registered 548 * loggers. 549 * 550 * @return The list of IDs and names. 551 */ 552 GList *purple_log_logger_get_options(void); 553 554 /**************************************************************************/ 555 /** @name Log Subsystem */ 556 /**************************************************************************/ 557 /*@{*/ 558 559 /** 560 * Initializes the log subsystem. 561 */ 562 void purple_log_init(void); 563 564 /** 565 * Returns the log subsystem handle. 566 * 567 * @return The log subsystem handle. 568 */ 569 void *purple_log_get_handle(void); 570 571 /** 572 * Uninitializes the log subsystem. 573 */ 574 void purple_log_uninit(void); 575 576 /*@}*/ 577 578 579 #ifdef __cplusplus 580 } 581 #endif 4 #define purple_log_init() 5 #define purple_log_uninit() 6 #define PurpleLog void 582 7 583 8 #endif /* _PURPLE_LOG_H_ */ -
libpurple/network.c
Only in libpurple: Makefile.in Only in extract/pidgin-2.10.9/libpurple: marshallers.c Only in extract/pidgin-2.10.9/libpurple: marshallers.h Only in extract/pidgin-2.10.9/libpurple: marshallers.list Only in extract/pidgin-2.10.9/libpurple: media Only in extract/pidgin-2.10.9/libpurple: media.c Only in extract/pidgin-2.10.9/libpurple: media-gst.h Only in extract/pidgin-2.10.9/libpurple: media.h Only in extract/pidgin-2.10.9/libpurple: mediamanager.c Only in extract/pidgin-2.10.9/libpurple: mediamanager.h Only in libpurple: moz.build diff -ru extract/pidgin-2.10.9/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 { … … 611 616 return ntohs(addr.sin_port); 612 617 } 613 618 614 #if def _WIN32619 #if 0 615 620 #ifndef NS_NLA 616 621 #define NS_NLA 15 617 622 #endif … … 850 855 851 856 return FALSE; 852 857 853 #elif defined _WIN32858 #elif 0 854 859 return (current_network_count > 0 || force_online); 855 860 #else 861 if (available_callback) 862 return (available_callback()); 863 856 864 return TRUE; 857 865 #endif 858 866 } … … 1140 1148 #ifdef HAVE_NETWORKMANAGER 1141 1149 GError *error = NULL; 1142 1150 #endif 1143 #if def _WIN321151 #if 0 1144 1152 GError *err = NULL; 1145 1153 gint cnt = wpurple_get_connected_network_count(); 1146 1154 … … 1161 1169 purple_prefs_add_string("/purple/network/stun_server", ""); 1162 1170 purple_prefs_add_string("/purple/network/turn_server", ""); 1163 1171 purple_prefs_add_int ("/purple/network/turn_port", 3478); 1164 purple_prefs_add_int ("/purple/network/turn_port_tcp", 3478);1165 1172 purple_prefs_add_string("/purple/network/turn_username", ""); 1166 1173 purple_prefs_add_string("/purple/network/turn_password", ""); 1167 1174 purple_prefs_add_bool ("/purple/network/auto_ip", TRUE); … … 1236 1243 dbus_g_connection_unref(nm_conn); 1237 1244 #endif 1238 1245 1239 #if def _WIN321246 #if 0 1240 1247 g_static_mutex_lock(&mutex); 1241 1248 network_initialized = FALSE; 1242 1249 if (network_change_handle != NULL) { … … 1269 1276 /* TODO: clean up remaining port mappings, note calling 1270 1277 purple_upnp_remove_port_mapping from here doesn't quite work... */ 1271 1278 } 1279 1280 void 1281 purple_network_configuration_changed(void) 1282 { 1283 purple_signal_emit(purple_network_get_handle(), "network-configuration-changed", NULL); 1284 } 1285 1286 void 1287 purple_network_set_available_callback(network_available_callback cb) 1288 { 1289 available_callback = cb; 1290 } -
libpurple/network.h
diff -ru extract/pidgin-2.10.9/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.9/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.9/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.9/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
Only in extract/pidgin-2.10.9/libpurple: plugins Only in extract/pidgin-2.10.9/libpurple: pounce.c Only in extract/pidgin-2.10.9/libpurple: pounce.h diff -ru extract/pidgin-2.10.9/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.9/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/gg/lib/common.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 diff -ru extract/pidgin-2.10.9/libpurple/protocols/gg/lib/common.c libpurple/protocols/gg/lib/common.c
old new 44 44 #include <stdio.h> 45 45 #include <stdlib.h> 46 46 #include <string.h> 47 #include <unistd.h> 47 #ifndef _MSC_VER 48 # include <unistd.h> 49 #endif 48 50 49 51 #include "libgadu.h" 50 52 -
libpurple/protocols/gg/lib/dcc7.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/gg/lib/dcc7.c libpurple/protocols/gg/lib/dcc7.c
old new 49 49 #include <string.h> 50 50 #include <stdio.h> 51 51 #include <stdlib.h> 52 #include <unistd.h> 52 #ifndef _MSC_VER 53 # include <unistd.h> 54 #endif 53 55 54 56 #include "compat.h" 55 57 #include "libgadu.h" … … 58 60 #include "libgadu-internal.h" 59 61 #include "libgadu-debug.h" 60 62 61 #define gg_debug_dcc(dcc, level, fmt...) \62 gg_debug_session(((dcc) != NULL) ? (dcc)->sess : NULL, level, fmt)63 #define gg_debug_dcc(dcc, level, ...) \ 64 gg_debug_session(((dcc) != NULL) ? (dcc)->sess : NULL, level, __VA_ARGS__) 63 65 64 66 #define gg_debug_dump_dcc(dcc, level, buf, len) \ 65 67 gg_debug_dump(((dcc) != NULL) ? (dcc)->sess : NULL, level, buf, len) -
libpurple/protocols/gg/lib/events.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/gg/lib/events.c libpurple/protocols/gg/lib/events.c
old new 50 50 #include <string.h> 51 51 #include <stdlib.h> 52 52 #include <time.h> 53 #include <unistd.h> 53 #ifndef _MSC_VER 54 # include <unistd.h> 55 #endif 54 56 #include <ctype.h> 55 57 #ifdef GG_CONFIG_HAVE_GNUTLS 56 58 # include <gnutls/gnutls.h> -
libpurple/protocols/gg/lib/handlers.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/gg/lib/handlers.c libpurple/protocols/gg/lib/handlers.c
old new 59 59 #include <stdlib.h> 60 60 #include <string.h> 61 61 #include <signal.h> 62 #include <unistd.h> 62 #ifndef _MSC_VER 63 # include <unistd.h> 64 #endif 63 65 #include <time.h> 64 66 #ifdef GG_CONFIG_HAVE_OPENSSL 65 67 # include <openssl/err.h> -
libpurple/protocols/gg/lib/http.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/gg/lib/http.c libpurple/protocols/gg/lib/http.c
old new 45 45 #include <stdio.h> 46 46 #include <stdlib.h> 47 47 #include <string.h> 48 #include <unistd.h> 48 #ifndef _MSC_VER 49 # include <unistd.h> 50 #endif 49 51 50 52 #define GG_HTTP_MAX_LENGTH 1000000000 51 53 -
libpurple/protocols/gg/lib/libgadu.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/gg/lib/libgadu.c libpurple/protocols/gg/lib/libgadu.c
old new 65 65 #include <string.h> 66 66 #include <signal.h> 67 67 #include <time.h> 68 #include <unistd.h> 68 #ifndef _MSC_VER 69 # include <unistd.h> 70 #endif 69 71 #ifdef GG_CONFIG_HAVE_GNUTLS 70 72 # include <gnutls/gnutls.h> 71 73 #endif -
libpurple/protocols/gg/lib/libgadu-config.h
diff -ru extract/pidgin-2.10.9/libpurple/protocols/gg/lib/libgadu-config.h libpurple/protocols/gg/lib/libgadu-config.h
old new 1 1 /* Local libgadu configuration. */ 2 2 3 #include "config.h" 3 /*#include "config.h" */ 4 4 5 5 #ifndef __GG_LIBGADU_CONFIG_H 6 6 #define __GG_LIBGADU_CONFIG_H … … 11 11 #define __GG_LIBGADU_BIGENDIAN 12 12 #endif /* WORDS_BIGENDIAN */ 13 13 14 #ifndef _WIN32 14 15 /* Defined if this machine has va_copy(). */ 15 16 #define __GG_LIBGADU_HAVE_VA_COPY 16 17 17 18 /* Defined if this machine has __va_copy(). */ 18 19 #define __GG_LIBGADU_HAVE___VA_COPY 20 #endif 19 21 20 22 /* Defined if this machine supports long long. */ 21 23 #undef __GG_LIBGADU_HAVE_LONG_LONG … … 56 58 #define random (long) rand 57 59 #endif 58 60 61 #ifdef _MSC_VER 62 typedef unsigned __int32 uint32_t; 63 typedef unsigned __int16 uint16_t; 64 typedef unsigned __int8 uint8_t; 65 #define snprintf _snprintf 66 #include <win32dep.h> 67 #define EINPROGRESS WSAEINPROGRESS 68 #define ECONNRESET WSAECONNRESET 69 #define ENOTCONN WSAENOTCONN 70 #define strncasecmp strnicmp 71 #define strcasecmp stricmp 72 #define ssize_t SSIZE_T 73 #endif 74 59 75 #endif /* __GG_LIBGADU_CONFIG_H */ -
libpurple/protocols/gg/lib/libgadu.h
diff -ru extract/pidgin-2.10.9/libpurple/protocols/gg/lib/libgadu.h libpurple/protocols/gg/lib/libgadu.h
old new 41 41 extern "C" { 42 42 #endif 43 43 44 #include "libgadu-config.h" 45 44 46 #include <sys/types.h> 45 47 #include <stdio.h> 46 48 #include <stdarg.h> … … 2288 2290 2289 2291 #define GG_DCC7_DUNNO1 0x24 2290 2292 2293 #if 0 2291 2294 struct gg_dcc7_dunno1 { 2292 2295 // XXX 2293 2296 } GG_PACKED; 2297 #endif 2294 2298 2295 2299 #define GG_DCC7_TIMEOUT_CONNECT 10 /* 10 sekund */ 2296 2300 #define GG_DCC7_TIMEOUT_SEND 1800 /* 30 minut */ -
libpurple/protocols/gg/lib/message.h
diff -ru extract/pidgin-2.10.9/libpurple/protocols/gg/lib/message.h libpurple/protocols/gg/lib/message.h
old new 20 20 #define LIBGADU_MESSAGE_H 21 21 22 22 #include <sys/types.h> 23 #include <inttypes.h>24 23 #include "libgadu.h" 25 24 26 25 #if 0 -
libpurple/protocols/gg/lib/pubdir.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/gg/lib/pubdir.c libpurple/protocols/gg/lib/pubdir.c
old new 32 32 #include <stdio.h> 33 33 #include <stdlib.h> 34 34 #include <string.h> 35 #ifndef _MSC_VER 35 36 #include <unistd.h> 37 #endif 36 38 37 39 #include "libgadu.h" 38 40 #include "libgadu-config.h" -
libpurple/protocols/gg/lib/resolver.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/gg/lib/resolver.c libpurple/protocols/gg/lib/resolver.c
old new 33 33 #include <errno.h> 34 34 #include <stdlib.h> 35 35 #include <string.h> 36 #include <unistd.h> 36 #ifndef _MSC_VER 37 # include <unistd.h> 38 #endif 37 39 #ifndef _WIN32 38 40 # include <signal.h> 39 41 # include <netinet/in.h> -
libpurple/protocols/gg/lib/sha1.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/gg/lib/sha1.c libpurple/protocols/gg/lib/sha1.c
old new 28 28 29 29 #include <string.h> 30 30 #include <sys/types.h> 31 #ifndef _MSC_VER 31 32 #include <unistd.h> 33 #endif 32 34 33 35 #include "libgadu.h" 34 36 -
libpurple/protocols/jabber/buddy.c
Only in libpurple/protocols/gg: Makefile.in Only in libpurple/protocols/gg: moz.build Only in extract/pidgin-2.10.9/libpurple/protocols: irc Only in extract/pidgin-2.10.9/libpurple/protocols/jabber: auth_cyrus.c diff -ru extract/pidgin-2.10.9/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.9/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.9/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.9/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; … … 552 554 iq_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); 553 555 signal_iq_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); 554 556 557 #ifdef USE_JINGLE 555 558 jabber_iq_register_handler("jingle", JINGLE, jingle_parse); 559 #endif 556 560 jabber_iq_register_handler("mailbox", NS_GOOGLE_MAIL_NOTIFY, 557 561 jabber_gmail_poke); 558 562 jabber_iq_register_handler("new-mail", NS_GOOGLE_MAIL_NOTIFY, -
libpurple/protocols/jabber/jabber.c
diff -ru extract/pidgin-2.10.9/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 … … 1589 1591 { 1590 1592 JabberStream *js = purple_connection_get_protocol_data(gc); 1591 1593 1594 #ifdef USE_JINGLE 1592 1595 /* Close all of the open Jingle sessions on this stream */ 1593 1596 jingle_terminate_sessions(js); 1597 #endif 1594 1598 1595 1599 if (js->bosh) 1596 1600 jabber_bosh_connection_close(js->bosh); … … 3866 3870 /* Bits Of Binary */ 3867 3871 jabber_add_feature(NS_BOB, 0); 3868 3872 3873 #ifdef USE_JINGLE 3869 3874 /* Jingle features! */ 3870 3875 jabber_add_feature(JINGLE, 0); 3876 #endif 3871 3877 3872 3878 #ifdef USE_VV 3873 3879 jabber_add_feature(NS_GOOGLE_PROTOCOL_SESSION, jabber_audio_enabled); -
libpurple/protocols/jabber/jabber.h
diff -ru extract/pidgin-2.10.9/libpurple/protocols/jabber/jabber.h libpurple/protocols/jabber/jabber.h
old new 60 60 #include "connection.h" 61 61 #include "dnsquery.h" 62 62 #include "dnssrv.h" 63 #ifdef USE_VV 63 64 #include "media.h" 64 65 #include "mediamanager.h" 66 #endif 65 67 #include "roomlist.h" 66 68 #include "sslconn.h" 67 69 -
libpurple/protocols/jabber/libxmpp.c
diff -ru extract/pidgin-2.10.9/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
Only in libpurple/protocols/jabber: Makefile.in diff -ru extract/pidgin-2.10.9/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/cmdproc.c
Only in libpurple/protocols/jabber: moz.build Only in libpurple/protocols: module.ver.in diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/cmdproc.c libpurple/protocols/msn/cmdproc.c
old new 109 109 g_free(show); 110 110 } 111 111 112 gboolean 112 void 113 113 msn_cmdproc_send_trans(MsnCmdProc *cmdproc, MsnTransaction *trans) 114 114 { 115 115 MsnServConn *servconn; 116 116 char *data; 117 117 size_t len; 118 gboolean ret;119 118 120 g_return_ val_if_fail(cmdproc != NULL, TRUE);121 g_return_ val_if_fail(trans != NULL, TRUE);119 g_return_if_fail(cmdproc != NULL); 120 g_return_if_fail(trans != NULL); 122 121 123 122 servconn = cmdproc->servconn; 124 123 125 124 if (!servconn->connected) { 126 125 msn_transaction_destroy(trans); 127 return FALSE;126 return; 128 127 } 129 128 130 129 if (trans->saveable) … … 155 154 trans->payload_len = 0; 156 155 } 157 156 158 ret = msn_servconn_write(servconn, data, len) != -1;157 msn_servconn_write(servconn, data, len); 159 158 160 159 if (!trans->saveable) 161 160 msn_transaction_destroy(trans); 162 161 g_free(data); 163 return ret;164 162 } 165 163 166 164 void -
libpurple/protocols/msn/cmdproc.h
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/cmdproc.h libpurple/protocols/msn/cmdproc.h
old new 79 79 * @param cmdproc The MsnCmdProc to be used. 80 80 * @param trans The MsnTransaction to be sent. 81 81 */ 82 gbooleanmsn_cmdproc_send_trans(MsnCmdProc *cmdproc, MsnTransaction *trans);82 void msn_cmdproc_send_trans(MsnCmdProc *cmdproc, MsnTransaction *trans); 83 83 84 84 /** 85 85 * Add a transaction to the queue to be processed latter. -
libpurple/protocols/msn/contact.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/contact.c libpurple/protocols/msn/contact.c
old new 474 474 } 475 475 476 476 /*parse contact list*/ 477 static gboolean477 static void 478 478 msn_parse_contact_list(MsnSession *session, xmlnode *node) 479 479 { 480 480 xmlnode *fault, *faultnode; … … 499 499 if (g_str_equal(errorcode, "ABDoesNotExist")) { 500 500 msn_create_address_book(session); 501 501 g_free(errorcode); 502 return FALSE;502 return; 503 503 } 504 504 505 505 g_free(errorcode); 506 506 } 507 507 508 508 msn_get_contact_list(session, MSN_PS_INITIAL, NULL); 509 return FALSE;510 509 } else { 511 510 xmlnode *service; 512 511 … … 515 514 service; service = xmlnode_get_next_twin(service)) { 516 515 msn_parse_each_service(session, service); 517 516 } 518 return TRUE;519 517 } 520 518 } 521 519 … … 536 534 537 535 purple_debug_misc("msn", "Got the contact list!\n"); 538 536 539 if (msn_parse_contact_list(session, resp->xml)) {537 msn_parse_contact_list(session, resp->xml); 540 538 #ifdef MSN_PARTIAL_LISTS 541 542 543 544 539 abLastChange = purple_account_get_string(session->account, 540 "ablastChange", NULL); 541 dynamicItemLastChange = purple_account_get_string(session->account, 542 "DynamicItemLastChanged", NULL); 545 543 #endif 546 544 547 545 if (state->partner_scenario == MSN_PS_INITIAL) { 548 546 #ifdef MSN_PARTIAL_LISTS 549 550 551 552 547 /* XXX: this should be enabled when we can correctly do partial 548 syncs with the server. Currently we need to retrieve the whole 549 list to detect sync issues */ 550 msn_get_address_book(session, MSN_PS_INITIAL, abLastChange, dynamicItemLastChange); 553 551 #else 554 552 msn_get_address_book(session, MSN_PS_INITIAL, NULL, NULL); 555 553 #endif 556 }557 554 } 558 555 } 559 556 } -
libpurple/protocols/msn/directconn.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/directconn.c libpurple/protocols/msn/directconn.c
old new 51 51 purple_cipher_context_destroy(context); 52 52 } else if (type == DC_NONCE_PLAIN) { 53 53 memcpy(digest, nonce, nonce_len); 54 } else {55 nonce_hash[0] = '\0';56 g_return_if_reached();57 54 } 58 55 59 56 g_sprintf(nonce_hash, … … 596 593 597 594 case DC_STATE_ESTABLISHED: 598 595 if (packet_length) { 599 MsnP2PVersion p2p; 600 p2p = msn_slplink_get_p2p_version(dc->slplink); 601 part = msn_slpmsgpart_new_from_data(p2p, dc->in_buffer + 4, packet_length); 596 part = msn_slpmsgpart_new_from_data(dc->in_buffer + 4, packet_length); 602 597 if (part) { 603 598 msn_slplink_process_msg(dc->slplink, part); 604 599 msn_slpmsgpart_unref(part); -
libpurple/protocols/msn/httpconn.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/httpconn.c libpurple/protocols/msn/httpconn.c
old new 111 111 return TRUE; 112 112 } 113 113 114 size -= (s - buf);115 114 buf = s; 115 size -= (s - buf); 116 116 } 117 117 118 118 if ((s = strstr(buf, "\r\n\r\n")) == NULL) -
libpurple/protocols/msn/msg.c
Only in libpurple/protocols/msn: Makefile.in Only in libpurple/protocols/msn: moz.build diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/msg.c libpurple/protocols/msn/msg.c
old new 135 135 136 136 msn_message_set_header(msg, "User-Agent", NULL); 137 137 138 msg->msnslp_message = TRUE; 139 138 140 msn_message_set_flag(msg, 'D'); 139 141 msn_message_set_content_type(msg, "application/x-msnmsgrp2p"); 140 142 … … 250 252 /* Now we *should* be at the body. */ 251 253 content_type = msn_message_get_content_type(msg); 252 254 255 if (content_type != NULL && 256 !strcmp(content_type, "application/x-msnmsgrp2p")) { 257 msg->msnslp_message = TRUE; 258 msg->part = msn_slpmsgpart_new_from_data(tmp, payload_len - (tmp - tmp_base)); 259 } 260 253 261 if (payload_len - (tmp - tmp_base) > 0) { 254 262 msg->body_len = payload_len - (tmp - tmp_base); 255 263 g_free(msg->body); … … 371 379 372 380 body = msn_message_get_bin_data(msg, &body_len); 373 381 374 if ( body != NULL && (end - n) > body_len)382 if (msg->msnslp_message) 375 383 { 376 memcpy(n, body, body_len); 377 n += body_len; 378 *n = '\0'; 379 } 384 size_t siz; 385 char *body; 380 386 381 if (ret_size != NULL) 382 { 383 *ret_size = n - base; 387 body = msn_slpmsgpart_serialize(msg->part, &siz); 384 388 385 if (*ret_size > 1664) 386 *ret_size = 1664; 389 memcpy(n, body, siz); 390 n += siz; 391 392 g_free(body); 393 } 394 else 395 { 396 if (body != NULL) 397 { 398 memcpy(n, body, body_len); 399 n += body_len; 400 *n = '\0'; 401 } 387 402 } 388 403 389 404 return base; … … 624 639 625 640 body = msn_message_get_bin_data(msg, &body_len); 626 641 627 if ( body != NULL)642 if (msg->msnslp_message) 628 643 { 629 if (msg->type == MSN_MSG_TEXT) 630 { 631 g_string_append_len(str, body, body_len); 632 g_string_append(str, "\r\n"); 633 } 634 else 644 msn_slpmsgpart_to_string(msg->part, str); 645 646 if (purple_debug_is_verbose() && body != NULL) 635 647 { 636 size_t i; 637 for (i = 0; i < body_len; i++, body++) 648 if (text_body) 649 { 650 g_string_append_len(str, body, body_len); 651 if (body[body_len - 1] == '\0') 652 { 653 str->len--; 654 g_string_append(str, " 0x00"); 655 } 656 g_string_append(str, "\r\n"); 657 } 658 else 638 659 { 639 g_string_append_printf(str, "%02x ", (unsigned char)*body); 640 if (i % 16 == 0 && i != 0) 641 g_string_append_c(str, '\n'); 660 int i; 661 662 for (i = 0; i < body_len; i++) 663 { 664 g_string_append_printf(str, "%.2hhX ", body[i]); 665 if ((i % 16) == 15) 666 g_string_append(str, "\r\n"); 667 } 668 669 g_string_append(str, "\r\n"); 642 670 } 643 g_string_append_c(str, '\n'); 671 } 672 } 673 else 674 { 675 if (body != NULL) 676 { 677 g_string_append_len(str, body, body_len); 678 g_string_append(str, "\r\n"); 644 679 } 645 680 } 646 681 … … 819 854 820 855 } 821 856 857 #define purple_mkstemp(a, b) NULL 858 822 859 /* TODO: Make these not be such duplicates of each other */ 823 860 static void 824 861 got_wink_cb(MsnSlpCall *slpcall, const guchar *data, gsize size) … … 877 914 { 878 915 MsnSession *session; 879 916 MsnSlpLink *slplink; 880 MsnP2PVersion p2p;881 917 882 918 session = cmdproc->servconn->session; 883 919 slplink = msn_session_get_slplink(session, msg->remote_user); … … 900 936 } 901 937 } 902 938 903 p2p = msn_slplink_get_p2p_version(slplink); 904 msg->part = msn_slpmsgpart_new_from_data(p2p, msg->body, msg->body_len); 905 906 if (msg->part) 939 if (msg->part) { 907 940 msn_slplink_process_msg(slplink, msg->part); 908 else 909 purple_debug_warning("msn", "P2P message failed to parse.\n"); 941 } 942 else /* This should never happen. */ 943 purple_debug_fatal("msn", "P2P message without a Part.\n"); 910 944 } 911 945 912 946 static void … … 947 981 948 982 session = cmdproc->servconn->session; 949 983 950 if (!purple_account_get_bool(session->account, "custom_smileys", TRUE))984 if (!purple_account_get_bool(session->account, "custom_smileys", FALSE)) 951 985 return; 952 986 953 987 swboard = cmdproc->data; -
libpurple/protocols/msn/msg.h
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/msg.h libpurple/protocols/msn/msg.h
old new 78 78 79 79 MsnMsgType type; 80 80 81 gboolean msnslp_message; 81 82 MsnSlpMessagePart *part; 82 83 83 84 char *remote_user; … … 136 137 MsnMessage *msn_message_new_plain(const char *message); 137 138 138 139 /** 140 * Creates a MSNSLP ack message. 141 * 142 * @param acked_msg The message to acknowledge. 143 * 144 * @return A new MSNSLP ack message. 145 */ 146 MsnMessage *msn_message_new_msnslp_ack(MsnMessage *acked_msg); 147 148 /** 139 149 * Creates a new message based off a command. 140 150 * 141 151 * @param session The MSN session. -
libpurple/protocols/msn/msn.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/msn.c libpurple/protocols/msn/msn.c
old new 539 539 for (l = session->user->endpoints; l; l = l->next) { 540 540 MsnUserEndpoint *ep = l->data; 541 541 542 if (ep->id[0] != '\0' && strncasecmp(ep->id + 1, session->guid, 36) == 0)542 if (ep->id[0] != '\0' && g_ascii_strncasecmp(ep->id + 1, session->guid, 36) == 0) 543 543 /* Don't add myself to the list */ 544 544 continue; 545 545 … … 608 608 MsnUserEndpoint *ep = l->data; 609 609 char *user; 610 610 611 if (ep->id[0] != '\0' && strncasecmp(ep->id + 1, session->guid, 36) == 0)611 if (ep->id[0] != '\0' && g_ascii_strncasecmp(ep->id + 1, session->guid, 36) == 0) 612 612 /* Don't kick myself */ 613 613 continue; 614 614 … … 3041 3041 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, 3042 3042 option); 3043 3043 3044 option = purple_account_option_bool_new(_("Show custom smileys"),3045 "custom_smileys", TRUE);3046 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,3047 option);3048 3049 3044 option = purple_account_option_bool_new(_("Allow direct connections"), 3050 3045 "direct_connect", TRUE); 3051 3046 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, -
libpurple/protocols/msn/msnutils.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/msnutils.c libpurple/protocols/msn/msnutils.c
old new 265 265 msg[retcount++] = '\n'; 266 266 c += 4; 267 267 } 268 else if (!g_ascii_strncasecmp(c + 1, "br/>", 4)) 269 { 270 msg[retcount++] = '\r'; 271 msg[retcount++] = '\n'; 272 c += 5; 273 } 268 274 else if (!g_ascii_strncasecmp(c + 1, "i>", 2)) 269 275 { 270 276 if (!has_italic) -
libpurple/protocols/msn/nexus.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/nexus.c libpurple/protocols/msn/nexus.c
old new 26 26 #include "cipher.h" 27 27 #include "debug.h" 28 28 29 #include "msnutils.h"30 29 #include "soap.h" 31 30 #include "nexus.h" 32 31 #include "notification.h" … … 165 164 return out; 166 165 } 167 166 168 #define MSN_USER_KEY_SIZE (7*4 + 8 + 20 + 72)169 167 #define CRYPT_MODE_CBC 1 170 168 #define CIPHER_TRIPLE_DES 0x6603 171 169 #define HASH_SHA1 0x8004 172 170 static char * 173 171 msn_rps_encrypt(MsnNexus *nexus) 174 172 { 175 char usr_key_base[MSN_USER_KEY_SIZE],*usr_key;173 MsnUsrKey *usr_key; 176 174 const char magic1[] = "SESSION KEY HASH"; 177 175 const char magic2[] = "SESSION KEY ENCRYPTION"; 178 176 PurpleCipherContext *hmac; 179 177 size_t len; 180 guchar *hash;178 guchar hash[20]; 181 179 char *key1, *key2, *key3; 182 180 gsize key1_len; 183 const char*iv;181 int *iv; 184 182 char *nonce_fixed; 185 183 char *cipher; 186 184 char *response; 187 185 188 usr_key = &usr_key_base[0]; 189 /* Header */ 190 msn_push32le(usr_key, 28); /* Header size */ 191 msn_push32le(usr_key, CRYPT_MODE_CBC); /* Crypt mode */ 192 msn_push32le(usr_key, CIPHER_TRIPLE_DES); /* Cipher type */ 193 msn_push32le(usr_key, HASH_SHA1); /* Hash type */ 194 msn_push32le(usr_key, 8); /* IV size */ 195 msn_push32le(usr_key, 20); /* Hash size */ 196 msn_push32le(usr_key, 72); /* Cipher size */ 197 /* Data */ 198 iv = usr_key; 199 msn_push32le(usr_key, rand()); 200 msn_push32le(usr_key, rand()); 201 hash = (guchar *)usr_key; 202 usr_key += 20; /* Remaining is cipher data */ 186 usr_key = g_malloc(sizeof(MsnUsrKey)); 187 usr_key->size = GUINT32_TO_LE(28); 188 usr_key->crypt_mode = GUINT32_TO_LE(CRYPT_MODE_CBC); 189 usr_key->cipher_type = GUINT32_TO_LE(CIPHER_TRIPLE_DES); 190 usr_key->hash_type = GUINT32_TO_LE(HASH_SHA1); 191 usr_key->iv_len = GUINT32_TO_LE(8); 192 usr_key->hash_len = GUINT32_TO_LE(20); 193 usr_key->cipher_len = GUINT32_TO_LE(72); 203 194 204 195 key1 = (char *)purple_base64_decode((const char *)nexus->tokens[MSN_AUTH_MESSENGER].secret, &key1_len); 205 196 key2 = rps_create_key(key1, key1_len, magic1, sizeof(magic1) - 1); 206 197 key3 = rps_create_key(key1, key1_len, magic2, sizeof(magic2) - 1); 207 198 199 iv = (int *)usr_key->iv; 200 iv[0] = rand(); 201 iv[1] = rand(); 202 208 203 len = strlen(nexus->nonce); 209 204 hmac = purple_cipher_context_new_by_name("hmac", NULL); 210 205 purple_cipher_context_set_option(hmac, "hash", "sha1"); … … 217 212 nonce_fixed = g_malloc(len + 8); 218 213 memcpy(nonce_fixed, nexus->nonce, len); 219 214 memset(nonce_fixed + len, 0x08, 8); 220 cipher = des3_cbc(key3, iv, nonce_fixed, len + 8, FALSE);215 cipher = des3_cbc(key3, usr_key->iv, nonce_fixed, len + 8, FALSE); 221 216 g_free(nonce_fixed); 222 217 223 memcpy(usr_key, cipher, 72); 218 memcpy(usr_key->hash, hash, 20); 219 memcpy(usr_key->cipher, cipher, 72); 224 220 225 221 g_free(key1); 226 222 g_free(key2); 227 223 g_free(key3); 228 224 g_free(cipher); 229 225 230 response = purple_base64_encode((guchar *)usr_key_base, MSN_USER_KEY_SIZE); 226 response = purple_base64_encode((guchar *)usr_key, sizeof(MsnUsrKey)); 227 228 g_free(usr_key); 231 229 232 230 return response; 233 231 } -
libpurple/protocols/msn/nexus.h
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/nexus.h libpurple/protocols/msn/nexus.h
old new 28 28 29 29 typedef struct _MsnNexus MsnNexus; 30 30 typedef struct _MsnTicketToken MsnTicketToken; 31 typedef struct _MsnUsrKey MsnUsrKey; 31 32 32 33 /* Index into ticket_tokens in nexus.c Keep updated! */ 33 34 typedef enum … … 187 188 "</Body>"\ 188 189 "</Envelope>" 189 190 191 struct _MsnUsrKey 192 { 193 int size; /* 28. Does not count data */ 194 int crypt_mode; /* CRYPT_MODE_CBC (1) */ 195 int cipher_type; /* TripleDES (0x6603) */ 196 int hash_type; /* SHA1 (0x8004) */ 197 int iv_len; /* 8 */ 198 int hash_len; /* 20 */ 199 int cipher_len; /* 72 */ 200 /* Data */ 201 char iv[8]; 202 char hash[20]; 203 char cipher[72]; 204 }; 205 190 206 struct _MsnTicketToken { 191 207 GHashTable *token; 192 208 char *secret; -
libpurple/protocols/msn/notification.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/notification.c libpurple/protocols/msn/notification.c
old new 195 195 { 196 196 /* RPS authentication */ 197 197 198 if (session->nexus)199 msn_nexus_destroy(session->nexus);200 201 198 session->nexus = msn_nexus_new(session); 202 199 203 200 session->nexus->policy = g_strdup(cmd->params[3]); … … 575 572 payload = xmlnode_to_str(adl_node, &payload_len); 576 573 msn_notification_post_adl(session->notification->cmdproc, payload, payload_len); 577 574 g_free(payload); 578 xmlnode_free(adl_node);579 575 } else { 580 576 purple_debug_error("msn", 581 577 "Got FQY update for unknown user %s on network %d.\n", … … 1592 1588 /* Disconnect others, if MPOP is disabled */ 1593 1589 if (is_me 1594 1590 && !session->enable_mpop 1595 && strncasecmp(id + 1, session->guid, 36) != 0) {1591 && g_ascii_strncasecmp(id + 1, session->guid, 36) != 0) { 1596 1592 purple_debug_info("msn", "Disconnecting Endpoint %s\n", id); 1597 1593 1598 1594 tmp = g_strdup_printf("%s;%s", user->passport, id); -
libpurple/protocols/msn/p2p.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/p2p.c libpurple/protocols/msn/p2p.c
old new 204 204 205 205 case MSN_P2P_VERSION_TWO: { 206 206 MsnP2Pv2Header *header = &info->header.v2; 207 char *header_wire = NULL;208 char *data_header_wire = NULL;209 207 210 208 if (header->header_tlv != NULL) 211 header _wire = msn_tlvlist_write(header->header_tlv, (size_t *)&header->header_len);209 header->header_len = msn_tlvlist_size(header->header_tlv) + 8; 212 210 else 213 header->header_len = 0;211 header->header_len = 8; 214 212 215 213 if (header->data_tlv != NULL) 216 data_header_wire = msn_tlvlist_write(header->data_tlv, (size_t *)&header->data_header_len);214 header->data_header_len = msn_tlvlist_size(header->data_tlv) + 8; 217 215 else 218 header->data_header_len = 0;216 header->data_header_len = 8; 219 217 220 tmp = wire = g_new(char, 16 +header->header_len + header->data_header_len);218 tmp = wire = g_new(char, header->header_len + header->data_header_len); 221 219 222 msn_push8(tmp, header->header_len + 8);220 msn_push8(tmp, header->header_len); 223 221 msn_push8(tmp, header->opcode); 224 msn_push16be(tmp, header->data_header_len + 8 +header->message_len);222 msn_push16be(tmp, header->data_header_len + header->message_len); 225 223 msn_push32be(tmp, header->base_id); 226 224 227 if (header _wire!= NULL) {228 m emcpy(tmp, header_wire, header->header_len);229 tmp += header->header_len ;225 if (header->header_tlv != NULL) { 226 msn_tlvlist_write(tmp, header->header_len - 8, header->header_tlv); 227 tmp += header->header_len - 8; 230 228 } 231 229 232 msn_push8(tmp, header->data_header_len + 8);230 msn_push8(tmp, header->data_header_len); 233 231 msn_push8(tmp, header->data_tf); 234 232 msn_push16be(tmp, header->package_number); 235 233 msn_push32be(tmp, header->session_id); 236 234 237 if ( data_header_wire!= NULL) {238 m emcpy(tmp, data_header_wire, header->data_header_len);239 tmp += header->data_header_len ;235 if (header->data_tlv != NULL) { 236 msn_tlvlist_write(tmp, header->data_header_len - 8, header->data_tlv); 237 tmp += header->data_header_len - 8; 240 238 } 241 239 242 240 if (len) 243 *len = header->header_len + header->data_header_len + 16;241 *len = header->header_len + header->data_header_len; 244 242 245 243 break; 246 244 } … … 250 248 } 251 249 252 250 return wire; 251 253 252 } 254 253 255 254 size_t … … 313 312 } 314 313 315 314 gboolean 316 msn_p2p_msg_is_data(const MsnP2P Info *info)315 msn_p2p_msg_is_data(const MsnP2PHeaderFlag flags) 317 316 { 318 gboolean data = FALSE; 319 320 switch (info->version) { 321 case MSN_P2P_VERSION_ONE: { 322 guint32 flags = info->header.v1.flags; 323 data = (flags == P2P_MSN_OBJ_DATA || 324 flags == (P2P_WLM2009_COMP | P2P_MSN_OBJ_DATA) || 325 flags == P2P_FILE_DATA); 326 break; 327 } 328 329 case MSN_P2P_VERSION_TWO: 330 data = info->header.v2.message_len > 0; 331 break; 332 333 default: 334 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->version); 335 } 336 337 return data; 317 return (flags == P2P_MSN_OBJ_DATA || 318 flags == (P2P_WLM2009_COMP | P2P_MSN_OBJ_DATA) || 319 flags == P2P_FILE_DATA); 338 320 } 339 321 340 322 gboolean … … 349 331 350 332 case MSN_P2P_VERSION_TWO: 351 333 /* Nothing to do! */ 352 valid = TRUE;353 334 break; 354 335 355 336 default: … … 360 341 } 361 342 362 343 gboolean 363 msn_p2p_info_is_first(MsnP2PInfo *info)364 {365 gboolean first = FALSE;366 367 switch (info->version) {368 case MSN_P2P_VERSION_ONE:369 first = info->header.v1.offset == 0;370 break;371 372 case MSN_P2P_VERSION_TWO:373 /* Nothing to do! */374 first = info->header.v2.data_tf & TF_FIRST;375 break;376 377 default:378 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->version);379 }380 381 return first;382 }383 384 gboolean385 344 msn_p2p_info_is_final(MsnP2PInfo *info) 386 345 { 387 346 gboolean final = FALSE; … … 392 351 break; 393 352 394 353 case MSN_P2P_VERSION_TWO: 395 final = msn_tlv_gettlv(info->header.v2.data_tlv, P2P_DATA_TLV_REMAINING, 1) == NULL;354 /* Nothing to do! */ 396 355 break; 397 356 398 357 default: … … 402 361 return final; 403 362 } 404 363 405 void406 msn_p2p_info_create_ack(MsnP2PInfo *old_info, MsnP2PInfo *new_info)407 {408 switch (old_info->version) {409 case MSN_P2P_VERSION_ONE: {410 MsnP2PHeader *old = &old_info->header.v1;411 MsnP2PHeader *new = &new_info->header.v1;412 413 new->session_id = old->session_id;414 new->flags = P2P_ACK;415 new->ack_id = old->id;416 new->ack_sub_id = old->ack_id;417 new->ack_size = old->total_size;418 break;419 }420 421 case MSN_P2P_VERSION_TWO: {422 MsnP2Pv2Header *old = &old_info->header.v2;423 MsnP2Pv2Header *new = &new_info->header.v2;424 425 msn_tlvlist_add_32(&new->header_tlv, P2P_HEADER_TLV_TYPE_ACK, old->base_id + old->message_len);426 new->opcode = P2P_OPCODE_NONE;427 428 if (old->message_len > 0) {429 if (!msn_tlv_gettlv(old->header_tlv, P2P_HEADER_TLV_TYPE_ACK, 1)) {430 if (old->opcode & P2P_OPCODE_SYN) {431 msn_tlv_t *ack_tlv;432 new->opcode |= P2P_OPCODE_RAK;433 434 ack_tlv = msn_tlv_gettlv(old->header_tlv, P2P_HEADER_TLV_TYPE_PEER_INFO, 1);435 if (ack_tlv) {436 msn_tlvlist_add_tlv(&new->header_tlv, ack_tlv);437 new->opcode |= P2P_OPCODE_SYN;438 }439 }440 }441 }442 break;443 }444 445 default:446 purple_debug_error("msn", "Invalid P2P Info version: %d\n", old_info->version);447 }448 }449 450 gboolean451 msn_p2p_info_require_ack(MsnP2PInfo *info)452 {453 gboolean ret = FALSE;454 455 switch (info->version) {456 case MSN_P2P_VERSION_ONE: {457 guint32 flags = msn_p2p_info_get_flags(info);458 459 ret = flags == P2P_NO_FLAG || flags == P2P_WLM2009_COMP ||460 msn_p2p_msg_is_data(info);461 break;462 }463 464 case MSN_P2P_VERSION_TWO:465 ret = (info->header.v2.opcode & P2P_OPCODE_RAK) > 0;466 break;467 468 default:469 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->version);470 }471 472 return ret;473 }474 475 gboolean476 msn_p2p_info_is_ack(MsnP2PInfo *info)477 {478 gboolean ret = FALSE;479 480 switch (info->version) {481 case MSN_P2P_VERSION_ONE: {482 ret = msn_p2p_info_get_flags(info) == P2P_ACK;483 break;484 }485 486 case MSN_P2P_VERSION_TWO:487 ret = msn_tlv_gettlv(info->header.v2.header_tlv, P2P_HEADER_TLV_TYPE_ACK, 1) != NULL;488 break;489 490 default:491 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->version);492 }493 494 return ret;495 }496 497 void498 msn_p2p_info_init_first(MsnP2PInfo *info, MsnP2PInfo *old_info)499 {500 switch (info->version) {501 case MSN_P2P_VERSION_ONE:502 info->header.v1.session_id = old_info->header.v1.session_id;503 info->header.v1.flags = old_info->header.v1.flags;504 break;505 506 case MSN_P2P_VERSION_TWO:507 info->header.v2.data_tf = TF_FIRST;508 break;509 510 default:511 purple_debug_error("msn", "Invalid P2P Info version: %d\n", info->version);512 }513 }514 515 364 guint32 516 365 msn_p2p_info_get_session_id(MsnP2PInfo *info) 517 366 { … … 523 372 break; 524 373 525 374 case MSN_P2P_VERSION_TWO: 526 session_id = info->header.v2.session_id;375 /* Nothing to do! */ 527 376 break; 528 377 529 378 default: … … 544 393 break; 545 394 546 395 case MSN_P2P_VERSION_TWO: 547 id = info->header.v2.base_id;396 /* Nothing to do! */ 548 397 break; 549 398 550 399 default: … … 628 477 break; 629 478 630 479 case MSN_P2P_VERSION_TWO: 631 flags = info->header.v2.data_tf;480 /* Nothing to do! */ 632 481 break; 633 482 634 483 default: … … 716 565 break; 717 566 718 567 case MSN_P2P_VERSION_TWO: 719 info->header.v2.session_id = session_id;568 /* Nothing to do! */ 720 569 break; 721 570 722 571 default: … … 734 583 break; 735 584 736 585 case MSN_P2P_VERSION_TWO: 737 info->header.v2.base_id = id;586 /* Nothing to do! */ 738 587 break; 739 588 740 589 default: … … 803 652 break; 804 653 805 654 case MSN_P2P_VERSION_TWO: 806 info->header.v2.data_tf = flags;655 /* Nothing to do! */ 807 656 break; 808 657 809 658 default: -
libpurple/protocols/msn/p2p.h
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/p2p.h libpurple/protocols/msn/p2p.h
old new 59 59 /* guint8 body[1]; */ 60 60 } MsnP2Pv2Header; 61 61 62 typedef struct {63 guint16 protocol_version;64 guint16 implementation_id;65 guint16 version;66 guint16 reserved;67 guint32 caps;68 } P2PPeerInfo;69 70 typedef enum71 {72 TF_FIRST = 0x01, /**< The first package. */73 TF_MSNOBJ = 0x04, /**< Payload contains binary data for MsnObject. */74 TF_FILE = 0x06 /**< Payload contains binary data. */75 } TF;76 77 typedef enum78 {79 P2P_HEADER_TLV_TYPE_PEER_INFO = 0x01, /**< Client peer info */80 P2P_HEADER_TLV_TYPE_ACK = 0x02, /**< ACK */81 P2P_HEADER_TLV_TYPE_NAK = 0x03 /**< NAK */82 } P2PHeaderTLVType;83 84 typedef enum85 {86 P2P_DATA_TLV_REMAINING = 0x01, /**< Indicates the remaining data to transfer.*/87 } P2PDataTLVType;88 89 typedef enum90 {91 P2P_PI_PVER = 0x0200,92 P2P_PI_IMP_ID = 0,93 P2P_PI_VER = 0x0e00,94 P2P_PI_RES = 0,95 P2P_PI_CAPS = 0x0000010f96 } P2PPeerInfoVal;97 98 62 typedef struct 99 63 { 100 64 guint32 value; … … 178 142 msn_p2p_info_to_string(MsnP2PInfo *info, GString *str); 179 143 180 144 gboolean 181 msn_p2p_msg_is_data(const MsnP2P Info *info);145 msn_p2p_msg_is_data(const MsnP2PHeaderFlag flags); 182 146 183 147 gboolean 184 148 msn_p2p_info_is_valid(MsnP2PInfo *info); 185 149 186 150 gboolean 187 msn_p2p_info_is_first(MsnP2PInfo *info);188 189 gboolean190 151 msn_p2p_info_is_final(MsnP2PInfo *info); 191 152 192 void193 msn_p2p_info_create_ack(MsnP2PInfo *old_info, MsnP2PInfo *new_info);194 195 gboolean196 msn_p2p_info_require_ack(MsnP2PInfo *info);197 198 gboolean199 msn_p2p_info_is_ack(MsnP2PInfo *info);200 201 void202 msn_p2p_info_init_first(MsnP2PInfo *new_info, MsnP2PInfo *old_info);203 204 153 guint32 205 154 msn_p2p_info_get_session_id(MsnP2PInfo *info); 206 155 … … 262 211 msn_p2p_info_set_app_id(MsnP2PInfo *info, guint32 app_id); 263 212 264 213 #endif /* MSN_P2P_H */ 214 -
libpurple/protocols/msn/session.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/session.c libpurple/protocols/msn/session.c
old new 263 263 { 264 264 swboard = msn_switchboard_new(session); 265 265 swboard->im_user = g_strdup(username); 266 if (msn_switchboard_request(swboard)) 267 msn_switchboard_request_add_user(swboard, username); 268 else 269 return NULL; 266 msn_switchboard_request(swboard); 267 msn_switchboard_request_add_user(swboard, username); 270 268 } 271 269 272 270 swboard->flag |= flag; … … 290 288 msn_session_activate_login_timeout(MsnSession *session) 291 289 { 292 290 if (!session->logged_in && session->connected) { 293 if (session->login_timeout)294 purple_timeout_remove(session->login_timeout);295 291 session->login_timeout = 296 292 purple_timeout_add_seconds(MSN_LOGIN_FQY_TIMEOUT, 297 293 msn_login_timeout_cb, session); -
libpurple/protocols/msn/slp.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/slp.c libpurple/protocols/msn/slp.c
old new 284 284 purple_xfer_unref(xfer); 285 285 286 286 slpmsg = msn_slpmsg_file_new(slpcall, purple_xfer_get_size(xfer)); 287 msn_slpmsg_set_slplink(slpmsg, slpcall->slplink); 287 288 288 289 msn_slplink_send_slpmsg(slpcall->slplink, slpmsg); 289 290 } -
libpurple/protocols/msn/slpcall.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/slpcall.c libpurple/protocols/msn/slpcall.c
old new 237 237 { 238 238 GList *smileys; 239 239 240 if (!purple_account_get_bool(account, "custom_smileys", TRUE))240 if (!purple_account_get_bool(account, "custom_smileys", FALSE)) 241 241 return NULL; 242 242 243 243 smileys = purple_smileys_get_all(); … … 328 328 dc->remote_nonce[36] = '\0'; 329 329 } 330 330 331 if (! strcasecmp(listening, "false")) {331 if (!g_ascii_strcasecmp(listening, "false")) { 332 332 if (dc->listen_data != NULL) { 333 333 /* 334 334 * We'll listen for incoming connections but … … 490 490 if (img != NULL) { 491 491 /* DATA PREP */ 492 492 slpmsg = msn_slpmsg_dataprep_new(slpcall); 493 msn_slpmsg_set_slplink(slpmsg, slplink); 493 494 msn_slplink_queue_slpmsg(slplink, slpmsg); 494 495 495 496 /* DATA */ 496 497 slpmsg = msn_slpmsg_obj_new(slpcall, img); 498 msn_slpmsg_set_slplink(slpmsg, slplink); 497 499 msn_slplink_queue_slpmsg(slplink, slpmsg); 498 500 purple_imgstore_unref(img); 499 501 … … 1128 1130 } 1129 1131 g_free(body_str); 1130 1132 } 1131 else if (msn_p2p_msg_is_data( slpmsg->p2p_info))1133 else if (msn_p2p_msg_is_data(flags)) 1132 1134 { 1133 1135 slpcall = msn_slplink_find_slp_call_with_session_id(slplink, session_id); 1134 1136 … … 1145 1147 slpcall->wasted = TRUE; 1146 1148 } 1147 1149 } 1148 else if ( msn_p2p_info_is_ack(slpmsg->p2p_info))1150 else if (flags == P2P_ACK) 1149 1151 { 1150 1152 /* Acknowledgement of previous message. Don't do anything currently. */ 1151 1153 } -
libpurple/protocols/msn/slpcall.h
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/slpcall.h libpurple/protocols/msn/slpcall.h
old new 65 65 gboolean wait_for_socket; 66 66 67 67 void (*progress_cb)(MsnSlpCall *slpcall, 68 gsize total_length, gsize len );68 gsize total_length, gsize len, gsize offset); 69 69 void (*session_init_cb)(MsnSlpCall *slpcall); 70 70 71 71 /* Can be checksum, or smile */ -
libpurple/protocols/msn/slplink.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/slplink.c libpurple/protocols/msn/slplink.c
old new 79 79 slplink->slp_seq_id = rand() % 0xFFFFFF00 + 4; 80 80 81 81 slplink->remote_user = g_strdup(username); 82 slplink->p2p_version = MSN_P2P_VERSION_ONE;83 82 84 83 slplink->slp_msg_queue = g_queue_new(); 85 84 … … 265 264 return NULL; 266 265 } 267 266 268 MsnP2PVersion269 msn_slplink_get_p2p_version(MsnSlpLink *slplink)270 {271 return slplink->p2p_version;272 }273 274 267 static void 275 268 msn_slplink_send_part(MsnSlpLink *slplink, MsnSlpMessagePart *part) 276 269 { … … 299 292 part = msn_slpmsgpart_new(msn_p2p_info_dup(info)); 300 293 part->ack_data = slpmsg; 301 294 302 real_size = msn_p2p_info_is_ack(info) ? 0 : slpmsg->size;295 real_size = (msn_p2p_info_get_flags(info) == P2P_ACK) ? 0 : slpmsg->size; 303 296 304 297 offset = msn_p2p_info_get_offset(info); 305 298 if (offset < real_size) … … 337 330 msn_slplink_send_part(slplink, part); 338 331 339 332 340 if (msn_p2p_msg_is_data(info) && slpmsg->slpcall != NULL) 333 if (msn_p2p_msg_is_data(msn_p2p_info_get_flags(info)) && 334 (slpmsg->slpcall != NULL)) 341 335 { 342 336 slpmsg->slpcall->progress = TRUE; 343 337 344 338 if (slpmsg->slpcall->progress_cb != NULL) 345 339 { 346 340 slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size, 347 len );341 len, offset); 348 342 } 349 343 } 350 344 … … 364 358 { 365 359 msn_p2p_info_set_ack_id(info, rand() % 0xFFFFFF00); 366 360 } 367 else if (msn_p2p_msg_is_data( info))361 else if (msn_p2p_msg_is_data(flags)) 368 362 { 369 363 MsnSlpCall *slpcall; 370 364 slpcall = slpmsg->slpcall; … … 412 406 } 413 407 } 414 408 409 static MsnSlpMessage * 410 msn_slplink_create_ack(MsnSlpLink *slplink, MsnP2PInfo *info) 411 { 412 MsnSlpMessage *slpmsg; 413 414 slpmsg = msn_slpmsg_ack_new(info); 415 msn_slpmsg_set_slplink(slpmsg, slplink); 416 417 return slpmsg; 418 } 419 415 420 static void 416 421 msn_slplink_send_ack(MsnSlpLink *slplink, MsnP2PInfo *info) 417 422 { 418 MsnSlpMessage *slpmsg = msn_slp msg_ack_new(slplink, info);423 MsnSlpMessage *slpmsg = msn_slplink_create_ack(slplink, info); 419 424 420 425 msn_slplink_send_slpmsg(slplink, slpmsg); 421 426 msn_slpmsg_destroy(slpmsg); … … 442 447 { 443 448 MsnSlpMessage *slpmsg; 444 449 guint32 session_id; 450 guint32 flags; 445 451 446 slpmsg = msn_slpmsg_new(slplink , NULL);452 slpmsg = msn_slpmsg_new(slplink); 447 453 slpmsg->id = msn_p2p_info_get_id(info); 448 454 session_id = msn_p2p_info_get_session_id(info); 455 msn_p2p_info_set_session_id(slpmsg->p2p_info, session_id); 449 456 slpmsg->size = msn_p2p_info_get_total_size(info); 450 msn_p2p_info_init_first(slpmsg->p2p_info, info); 457 flags = msn_p2p_info_get_flags(info); 458 msn_p2p_info_set_flags(slpmsg->p2p_info, flags); 451 459 452 460 if (session_id) 453 461 { 454 462 slpmsg->slpcall = msn_slplink_find_slp_call_with_session_id(slplink, session_id); 455 463 if (slpmsg->slpcall != NULL) 456 464 { 457 if (msn_p2p_msg_is_data( info))465 if (msn_p2p_msg_is_data(flags)) 458 466 { 459 467 PurpleXfer *xfer = slpmsg->slpcall->xfer; 460 468 if (xfer != NULL) … … 494 502 process_complete_msg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg, MsnP2PInfo *info) 495 503 { 496 504 MsnSlpCall *slpcall; 505 guint32 flags; 497 506 498 507 slpcall = msn_slp_process_msg(slplink, slpmsg); 499 508 … … 504 513 505 514 purple_debug_info("msn", "msn_slplink_process_msg: slpmsg complete\n"); 506 515 507 if (msn_p2p_info_require_ack(slpmsg->p2p_info)) 516 flags = msn_p2p_info_get_flags(slpmsg->p2p_info); 517 518 if (flags == P2P_NO_FLAG || flags == P2P_WLM2009_COMP || 519 msn_p2p_msg_is_data(flags)) 508 520 { 509 521 /* Release all the messages and send the ACK */ 510 522 … … 517 529 */ 518 530 purple_debug_info("msn", "msn_slplink_process_msg: save ACK\n"); 519 531 520 slpcall->slplink->dc->prev_ack = msn_slp msg_ack_new(slplink, info);532 slpcall->slplink->dc->prev_ack = msn_slplink_create_ack(slplink, info); 521 533 } else if (!slpcall->wasted) { 522 534 purple_debug_info("msn", "msn_slplink_process_msg: send ACK\n"); 523 535 … … 561 573 { 562 574 MsnSlpMessage *slpmsg; 563 575 MsnP2PInfo *info; 576 guint64 offset; 564 577 565 578 info = part->info; 566 579 … … 573 586 return; 574 587 } 575 588 576 if (msn_p2p_info_is_first(info)) 589 offset = msn_p2p_info_get_offset(info); 590 591 if (offset == 0) 577 592 slpmsg = init_first_msg(slplink, info); 578 593 else { 579 594 guint32 session_id, id; … … 590 605 591 606 slpmsg_add_part(slpmsg, part); 592 607 593 if (msn_p2p_msg_is_data(slpmsg->p2p_info) && slpmsg->slpcall != NULL) 608 if (msn_p2p_msg_is_data(msn_p2p_info_get_flags(slpmsg->p2p_info)) && 609 (slpmsg->slpcall != NULL)) 594 610 { 595 611 slpmsg->slpcall->progress = TRUE; 596 612 597 613 if (slpmsg->slpcall->progress_cb != NULL) 598 614 { 599 615 slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size, 600 part->size );616 part->size, offset); 601 617 } 602 618 } 603 619 -
libpurple/protocols/msn/slplink.h
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/slplink.h libpurple/protocols/msn/slplink.h
old new 45 45 guint refs; 46 46 47 47 char *remote_user; 48 MsnP2PVersion p2p_version;49 48 50 49 int slp_seq_id; 51 50 … … 76 75 MsnSlpCall *msn_slplink_find_slp_call(MsnSlpLink *slplink, 77 76 const char *id); 78 77 MsnSlpCall *msn_slplink_find_slp_call_with_session_id(MsnSlpLink *slplink, long id); 79 MsnP2PVersion msn_slplink_get_p2p_version(MsnSlpLink *slplink);80 81 78 void msn_slplink_queue_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg); 82 79 void msn_slplink_send_slpmsg(MsnSlpLink *slplink, 83 80 MsnSlpMessage *slpmsg); -
libpurple/protocols/msn/slpmsg.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/slpmsg.c libpurple/protocols/msn/slpmsg.c
old new 34 34 **************************************************************************/ 35 35 36 36 MsnSlpMessage * 37 msn_slpmsg_new(MsnSlpLink *slplink , MsnSlpCall *slpcall)37 msn_slpmsg_new(MsnSlpLink *slplink) 38 38 { 39 39 MsnSlpMessage *slpmsg; 40 MsnP2PVersion p2p;41 42 g_return_val_if_fail(slplink != NULL, NULL);43 40 44 41 slpmsg = g_new0(MsnSlpMessage, 1); 45 42 46 43 if (purple_debug_is_verbose()) 47 44 purple_debug_info("msn", "slpmsg new (%p)\n", slpmsg); 48 45 49 msn_slpmsg_set_slplink(slpmsg, slplink); 50 slpmsg->slpcall = slpcall; 46 if (slplink) 47 msn_slpmsg_set_slplink(slpmsg, slplink); 48 else 49 slpmsg->slplink = NULL; 51 50 52 p2p = msn_slplink_get_p2p_version(slplink); 53 slpmsg->p2p_info = msn_p2p_info_new(p2p); 51 slpmsg->p2p_info = msn_p2p_info_new(MSN_P2P_VERSION_ONE); 54 52 55 53 return slpmsg; 56 54 } … … 105 103 106 104 slplink->slp_msgs = 107 105 g_list_append(slplink->slp_msgs, slpmsg); 106 108 107 } 109 108 110 109 void … … 189 188 g_strlcat(body, content, body_len); 190 189 } 191 190 192 slpmsg = msn_slpmsg_new(slplink , slpcall);191 slpmsg = msn_slpmsg_new(slplink); 193 192 msn_slpmsg_set_body(slpmsg, body, body_len); 194 193 194 slpmsg->slpcall = slpcall; 195 195 196 g_free(body); 196 197 197 198 return slpmsg; 198 199 } 199 200 200 MsnSlpMessage *msn_slpmsg_ack_new(Msn SlpLink *slplink, MsnP2PInfo *ack_info)201 MsnSlpMessage *msn_slpmsg_ack_new(MsnP2PInfo *ack_info) 201 202 { 202 203 MsnSlpMessage *slpmsg; 203 204 MsnP2PInfo *new_info; 204 205 205 slpmsg = msn_slpmsg_new( slplink,NULL);206 slpmsg = msn_slpmsg_new(NULL); 206 207 207 208 new_info = slpmsg->p2p_info; 208 msn_p2p_info_ create_ack(ack_info, new_info);209 msn_p2p_info_set_session_id(new_info, msn_p2p_info_get_session_id(ack_info)); 209 210 slpmsg->size = msn_p2p_info_get_total_size(ack_info); 211 msn_p2p_info_set_flags(new_info, P2P_ACK); 212 msn_p2p_info_set_ack_id(new_info, msn_p2p_info_get_id(ack_info)); 213 msn_p2p_info_set_ack_sub_id(new_info, msn_p2p_info_get_ack_id(ack_info)); 214 msn_p2p_info_set_ack_size(new_info, msn_p2p_info_get_total_size(ack_info)); 210 215 slpmsg->info = "SLP ACK"; 211 216 212 217 return slpmsg; … … 216 221 { 217 222 MsnSlpMessage *slpmsg; 218 223 219 slpmsg = msn_slpmsg_new(slpcall->slplink, slpcall); 224 slpmsg = msn_slpmsg_new(NULL); 225 slpmsg->slpcall = slpcall; 220 226 msn_p2p_info_set_flags(slpmsg->p2p_info, P2P_MSN_OBJ_DATA); 221 227 slpmsg->info = "SLP DATA"; 222 228 … … 229 235 { 230 236 MsnSlpMessage *slpmsg; 231 237 232 slpmsg = msn_slpmsg_new( slpcall->slplink, slpcall);238 slpmsg = msn_slpmsg_new(NULL); 233 239 240 slpmsg->slpcall = slpcall; 234 241 msn_p2p_info_set_session_id(slpmsg->p2p_info, slpcall->session_id); 235 242 msn_slpmsg_set_body(slpmsg, NULL, 4); 236 243 slpmsg->info = "SLP DATA PREP"; … … 243 250 { 244 251 MsnSlpMessage *slpmsg; 245 252 246 slpmsg = msn_slpmsg_new( slpcall->slplink, slpcall);253 slpmsg = msn_slpmsg_new(NULL); 247 254 255 slpmsg->slpcall = slpcall; 248 256 msn_p2p_info_set_flags(slpmsg->p2p_info, P2P_FILE_DATA); 249 257 slpmsg->info = "SLP FILE"; 250 258 slpmsg->size = size; -
libpurple/protocols/msn/slpmsg.h
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/slpmsg.h libpurple/protocols/msn/slpmsg.h
old new 72 72 * If it's set to NULL, it is a temporary SlpMessage. 73 73 * @return The created slp message. 74 74 */ 75 MsnSlpMessage *msn_slpmsg_new(MsnSlpLink *slplink , MsnSlpCall *slpcall);75 MsnSlpMessage *msn_slpmsg_new(MsnSlpLink *slplink); 76 76 77 77 /** 78 78 * Destroys a slp message … … 104 104 * 105 105 * @return A new SlpMessage with ACK headers 106 106 */ 107 MsnSlpMessage *msn_slpmsg_ack_new(Msn SlpLink *slplink, MsnP2PInfo *info);107 MsnSlpMessage *msn_slpmsg_ack_new(MsnP2PInfo *info); 108 108 109 109 /** 110 110 * Create a new SLP message for MsnObject data. -
libpurple/protocols/msn/slpmsg_part.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/slpmsg_part.c libpurple/protocols/msn/slpmsg_part.c
old new 42 42 return msn_slpmsgpart_ref(part); 43 43 } 44 44 45 MsnSlpMessagePart * 46 msn_slpmsgpart_new_from_data(MsnP2PVersion p2p, const char *data, size_t data_len) 45 MsnSlpMessagePart *msn_slpmsgpart_new_from_data(const char *data, size_t data_len) 47 46 { 48 47 MsnSlpMessagePart *part; 49 48 MsnP2PInfo *info; 50 49 size_t len; 51 50 int body_len; 52 51 53 info = msn_p2p_info_new( p2p);52 info = msn_p2p_info_new(MSN_P2P_VERSION_ONE); 54 53 55 54 /* Extract the binary SLP header */ 56 55 len = msn_p2p_header_from_wire(info, data, data_len); … … 176 175 177 176 slpmsg = data; 178 177 179 real_size = msn_p2p_info_is_ack(slpmsg->p2p_info) ? 0 : slpmsg->size;178 real_size = (msn_p2p_info_get_flags(slpmsg->p2p_info) == P2P_ACK) ? 0 : slpmsg->size; 180 179 181 180 offset = msn_p2p_info_get_offset(slpmsg->p2p_info); 182 181 offset += msn_p2p_info_get_length(part->info); … … 198 197 else 199 198 { 200 199 /* The whole message has been sent */ 201 if (msn_p2p_msg_is_data( slpmsg->p2p_info))200 if (msn_p2p_msg_is_data(msn_p2p_info_get_flags(slpmsg->p2p_info))) 202 201 { 203 202 if (slpmsg->slpcall != NULL) 204 203 { -
libpurple/protocols/msn/slpmsg_part.h
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/slpmsg_part.h libpurple/protocols/msn/slpmsg_part.h
old new 46 46 47 47 MsnSlpMessagePart *msn_slpmsgpart_new(MsnP2PInfo *info); 48 48 49 MsnSlpMessagePart *msn_slpmsgpart_new_from_data( MsnP2PVersion p2p,const char *data, size_t data_len);49 MsnSlpMessagePart *msn_slpmsgpart_new_from_data(const char *data, size_t data_len); 50 50 51 51 MsnSlpMessagePart *msn_slpmsgpart_ref(MsnSlpMessagePart *part); 52 52 -
libpurple/protocols/msn/switchboard.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/switchboard.c libpurple/protocols/msn/switchboard.c
old new 421 421 422 422 purple_debug_info("msn", "unqueuing unsent message to %s\n", swboard->im_user); 423 423 424 if (msn_switchboard_request(swboard)) { 425 msn_switchboard_request_add_user(swboard, swboard->im_user); 426 swboard->reconn_timeout_h = 0; 427 } 424 msn_switchboard_request(swboard); 425 msn_switchboard_request_add_user(swboard, swboard->im_user); 426 swboard->reconn_timeout_h = 0; 428 427 return FALSE; 429 428 } 430 429 … … 1073 1072 swboard_error_helper(swboard, reason, swboard->im_user); 1074 1073 } 1075 1074 1076 gboolean 1075 void 1077 1076 msn_switchboard_request(MsnSwitchBoard *swboard) 1078 1077 { 1079 1078 MsnCmdProc *cmdproc; 1080 1079 MsnTransaction *trans; 1081 1080 1082 g_return_ val_if_fail(swboard != NULL, FALSE);1081 g_return_if_fail(swboard != NULL); 1083 1082 1084 1083 cmdproc = swboard->session->notification->cmdproc; 1085 1084 … … 1089 1088 msn_transaction_set_data(trans, swboard); 1090 1089 msn_transaction_set_error_cb(trans, xfr_error); 1091 1090 1092 returnmsn_cmdproc_send_trans(cmdproc, trans);1091 msn_cmdproc_send_trans(cmdproc, trans); 1093 1092 } 1094 1093 1095 1094 void -
libpurple/protocols/msn/switchboard.h
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/switchboard.h libpurple/protocols/msn/switchboard.h
old new 250 250 gboolean msn_switchboard_chat_leave(MsnSwitchBoard *swboard); 251 251 gboolean msn_switchboard_chat_invite(MsnSwitchBoard *swboard, const char *who); 252 252 253 gbooleanmsn_switchboard_request(MsnSwitchBoard *swboard);253 void msn_switchboard_request(MsnSwitchBoard *swboard); 254 254 void msn_switchboard_request_add_user(MsnSwitchBoard *swboard, const char *user); 255 255 256 256 /** -
libpurple/protocols/msn/tlv.c
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/tlv.c libpurple/protocols/msn/tlv.c
old new 45 45 g_free(oldtlv); 46 46 } 47 47 48 GSList *49 msn_tlv list_read(const char *bs, size_tbs_len)48 static GSList * 49 msn_tlv_read(GSList *list, const char *bs, size_t *bs_len) 50 50 { 51 GSList *list = NULL; 51 guint8 type, length; 52 msn_tlv_t *tlv; 52 53 53 while (bs_len > 0) {54 guint8 type, length;55 msn_tlv_t *tlv;54 type = msn_read8(bs); 55 length = msn_read8(bs); 56 *bs_len -= 2; 56 57 57 if (bs_len == 3 && *bs == 0) { 58 /* Padding to multiple of 4 */ 59 break; 60 } else if (bs_len == 2 && *bs == 0) { 61 /* Padding to multiple of 4 */ 62 break; 63 } else if (bs_len == 1) { 64 if (*bs == 0) { 65 /* Padding to multiple of 4 */ 66 break; 67 } else { 68 /* TLV is not small enough to fit here */ 69 msn_tlvlist_free(list); 70 return NULL; 71 } 72 } 73 74 type = msn_pop8(bs); 75 length = msn_pop8(bs); 76 bs_len -= 2; 58 if (length > *bs_len) { 59 msn_tlvlist_free(list); 60 return NULL; 61 } 77 62 78 if (length > bs_len) { 63 tlv = createtlv(type, length, NULL); 64 if (length > 0) { 65 tlv->value = g_memdup(bs, length); 66 if (!tlv->value) { 67 freetlv(tlv); 79 68 msn_tlvlist_free(list); 80 69 return NULL; 81 70 } 71 } 82 72 83 tlv = createtlv(type, length, NULL); 84 if (length > 0) { 85 tlv->value = g_memdup(bs, length); 86 if (!tlv->value) { 87 freetlv(tlv); 88 msn_tlvlist_free(list); 89 return NULL; 90 } 91 } 73 *bs_len -= length; 74 75 return g_slist_prepend(list, tlv); 76 } 92 77 93 bs_len -= length; 94 bs += length; 78 GSList * 79 msn_tlvlist_read(const char *bs, size_t bs_len) 80 { 81 GSList *list = NULL; 95 82 96 list = g_slist_prepend(list, tlv); 83 while (bs_len > 0) { 84 list = msn_tlv_read(list, bs, &bs_len); 85 if (list == NULL) 86 return NULL; 97 87 } 98 88 99 89 return g_slist_reverse(list); 100 90 } 101 91 102 GSList * 103 msn_tlvlist_copy(GSList *orig) 92 GSList *msn_tlvlist_copy(GSList *orig) 104 93 { 105 94 GSList *new = NULL; 106 95 msn_tlv_t *tlv; … … 169 158 } 170 159 171 160 int 172 msn_tlvlist_add_raw(GSList **list, const guint 8 type, const guint8length, const char *value)161 msn_tlvlist_add_raw(GSList **list, const guint16 type, const guint16 length, const char *value) 173 162 { 174 163 msn_tlv_t *tlv; 175 164 … … 186 175 } 187 176 188 177 int 189 msn_tlvlist_add_8(GSList **list, const guint 8type, const guint8 value)178 msn_tlvlist_add_8(GSList **list, const guint16 type, const guint8 value) 190 179 { 191 180 char v8[1]; 192 181 … … 196 185 } 197 186 198 187 int 199 msn_tlvlist_add_16(GSList **list, const guint 8type, const guint16 value)188 msn_tlvlist_add_16(GSList **list, const guint16 type, const guint16 value) 200 189 { 201 190 char v16[2]; 202 191 … … 206 195 } 207 196 208 197 int 209 msn_tlvlist_add_32(GSList **list, const guint 8type, const guint32 value)198 msn_tlvlist_add_32(GSList **list, const guint16 type, const guint32 value) 210 199 { 211 200 char v32[4]; 212 201 … … 216 205 } 217 206 218 207 int 219 msn_tlvlist_add_str(GSList **list, const guint 8type, const char *value)208 msn_tlvlist_add_str(GSList **list, const guint16 type, const char *value) 220 209 { 221 210 return msn_tlvlist_add_raw(list, type, strlen(value), value); 222 211 } 223 212 224 213 int 225 msn_tlvlist_add_empty(GSList **list, const guint 8type)214 msn_tlvlist_add_empty(GSList **list, const guint16 type) 226 215 { 227 216 return msn_tlvlist_add_raw(list, type, 0, NULL); 228 217 } 229 218 230 219 int 231 msn_tlvlist_add_tlv(GSList **list, const msn_tlv_t *tlv) 232 { 233 return msn_tlvlist_add_raw(list, tlv->type, tlv->length, (const char *)tlv->value); 234 } 235 236 int 237 msn_tlvlist_replace_raw(GSList **list, const guint8 type, const guint8 length, const char *value) 220 msn_tlvlist_replace_raw(GSList **list, const guint16 type, const guint16 length, const char *value) 238 221 { 239 222 GSList *cur; 240 223 msn_tlv_t *tlv; … … 263 246 } 264 247 265 248 int 266 msn_tlvlist_replace_str(GSList **list, const guint 8type, const char *str)249 msn_tlvlist_replace_str(GSList **list, const guint16 type, const char *str) 267 250 { 268 251 return msn_tlvlist_replace_raw(list, type, strlen(str), str); 269 252 } 270 253 271 254 int 272 msn_tlvlist_replace_empty(GSList **list, const guint 8type)255 msn_tlvlist_replace_empty(GSList **list, const guint16 type) 273 256 { 274 257 return msn_tlvlist_replace_raw(list, type, 0, NULL); 275 258 } 276 259 277 260 int 278 msn_tlvlist_replace_8(GSList **list, const guint 8type, const guint8 value)261 msn_tlvlist_replace_8(GSList **list, const guint16 type, const guint8 value) 279 262 { 280 263 char v8[1]; 281 264 … … 285 268 } 286 269 287 270 int 288 msn_tlvlist_replace_32(GSList **list, const guint 8type, const guint32 value)271 msn_tlvlist_replace_32(GSList **list, const guint16 type, const guint32 value) 289 272 { 290 273 char v32[4]; 291 274 … … 294 277 return msn_tlvlist_replace_raw(list, type, 4, v32); 295 278 } 296 279 297 int298 msn_tlvlist_replace_tlv(GSList **list, const msn_tlv_t *tlv)299 {300 return msn_tlvlist_replace_raw(list, tlv->type, tlv->length, (const char *)tlv->value);301 }302 303 280 void 304 msn_tlvlist_remove(GSList **list, const guint 8type)281 msn_tlvlist_remove(GSList **list, const guint16 type) 305 282 { 306 283 GSList *cur, *next; 307 284 msn_tlv_t *tlv; … … 325 302 } 326 303 } 327 304 328 char * 329 msn_tlvlist_write( GSList *list, size_t *out_len)305 int 306 msn_tlvlist_write(char *bs, size_t bs_len, GSList *list) 330 307 { 331 char *buf; 332 char *tmp; 333 size_t bytes_left; 334 size_t total_len; 335 336 tmp = buf = g_malloc(256); 337 bytes_left = total_len = 256; 338 339 for (; list; list = g_slist_next(list)) { 340 msn_tlv_t *tlv = (msn_tlv_t *)list->data; 341 342 if (G_UNLIKELY(tlv->length + 2 > bytes_left)) { 343 buf = g_realloc(buf, total_len + 256); 344 bytes_left += 256; 345 total_len += 256; 346 tmp = buf + (total_len - bytes_left); 347 } 348 349 msn_push8(tmp, tlv->type); 350 msn_push8(tmp, tlv->length); 351 memcpy(tmp, tlv->value, tlv->length); 352 tmp += tlv->length; 308 #if 0 309 int goodbuflen; 310 GSList *cur; 311 msn_tlv_t *tlv; 353 312 354 bytes_left -= (tlv->length + 2);355 }313 /* do an initial run to test total length */ 314 goodbuflen = msn_tlvlist_size(*list); 356 315 357 /* Align length to multiple of 4 */ 358 total_len = total_len - bytes_left; 359 bytes_left = 4 - total_len % 4; 360 if (bytes_left != 4) 361 memset(tmp, 0, bytes_left); 362 else 363 bytes_left = 0; 316 if (goodbuflen > byte_stream_bytes_left(bs)) 317 return 0; /* not enough buffer */ 364 318 365 *out_len = total_len + bytes_left; 319 /* do the real write-out */ 320 for (cur = *list; cur; cur = cur->next) { 321 tlv = cur->data; 322 byte_stream_put16(bs, tlv->type); 323 byte_stream_put16(bs, tlv->length); 324 if (tlv->length > 0) 325 byte_stream_putraw(bs, tlv->value, tlv->length); 326 } 366 327 367 return buf; 328 #endif 329 return 0; /* TODO: This is a nonsensical return */ 368 330 } 369 331 370 332 msn_tlv_t * 371 msn_tlv_gettlv(GSList *list, const guint 8type, const int nth)333 msn_tlv_gettlv(GSList *list, const guint16 type, const int nth) 372 334 { 373 335 msn_tlv_t *tlv; 374 336 int i; … … 385 347 } 386 348 387 349 int 388 msn_tlv_getlength(GSList *list, const guint 8type, const int nth)350 msn_tlv_getlength(GSList *list, const guint16 type, const int nth) 389 351 { 390 352 msn_tlv_t *tlv; 391 353 … … 409 371 } 410 372 411 373 char * 412 msn_tlv_getstr(GSList *list, const guint 8type, const int nth)374 msn_tlv_getstr(GSList *list, const guint16 type, const int nth) 413 375 { 414 376 msn_tlv_t *tlv; 415 377 … … 421 383 } 422 384 423 385 guint8 424 msn_tlv_get8(GSList *list, const guint 8type, const int nth)386 msn_tlv_get8(GSList *list, const guint16 type, const int nth) 425 387 { 426 388 msn_tlv_t *tlv; 427 389 … … 433 395 } 434 396 435 397 guint16 436 msn_tlv_get16(GSList *list, const guint 8type, const int nth)398 msn_tlv_get16(GSList *list, const guint16 type, const int nth) 437 399 { 438 400 msn_tlv_t *tlv; 439 401 … … 445 407 } 446 408 447 409 guint32 448 msn_tlv_get32(GSList *list, const guint 8type, const int nth)410 msn_tlv_get32(GSList *list, const guint16 type, const int nth) 449 411 { 450 412 msn_tlv_t *tlv; 451 413 -
libpurple/protocols/msn/tlv.h
diff -ru extract/pidgin-2.10.9/libpurple/protocols/msn/tlv.h libpurple/protocols/msn/tlv.h
old new 38 38 /* TLV handling functions */ 39 39 char *msn_tlv_getvalue_as_string(msn_tlv_t *tlv); 40 40 41 msn_tlv_t *msn_tlv_gettlv(GSList *list, const guint 8type, const int nth);42 int msn_tlv_getlength(GSList *list, const guint 8type, const int nth);43 char *msn_tlv_getstr(GSList *list, const guint 8type, const int nth);44 guint8 msn_tlv_get8(GSList *list, const guint 8type, const int nth);45 guint16 msn_tlv_get16(GSList *list, const guint 8type, const int nth);46 guint32 msn_tlv_get32(GSList *list, const guint 8type, const int nth);41 msn_tlv_t *msn_tlv_gettlv(GSList *list, const guint16 type, const int nth); 42 int msn_tlv_getlength(GSList *list, const guint16 type, const int nth); 43 char *msn_tlv_getstr(GSList *list, const guint16 type, const int nth); 44 guint8 msn_tlv_get8(GSList *list, const guint16 type, const int nth); 45 guint16 msn_tlv_get16(GSList *list, const guint16 type, const int nth); 46 guint32 msn_tlv_get32(GSList *list, const guint16 type, const int nth); 47 47 48 48 /* TLV list handling functions */ 49 49 GSList *msn_tlvlist_read(const char *bs, size_t bs_len); … … 52 52 int msn_tlvlist_count(GSList *list); 53 53 size_t msn_tlvlist_size(GSList *list); 54 54 gboolean msn_tlvlist_equal(GSList *one, GSList *two); 55 char *msn_tlvlist_write(GSList *list, size_t *out_len);55 int msn_tlvlist_write(char *bs, size_t bs_len, GSList *list); 56 56 void msn_tlvlist_free(GSList *list); 57 57 58 int msn_tlvlist_add_raw(GSList **list, const guint8 type, const guint8 length, const char *value); 59 int msn_tlvlist_add_empty(GSList **list, const guint8 type); 60 int msn_tlvlist_add_8(GSList **list, const guint8 type, const guint8 value); 61 int msn_tlvlist_add_16(GSList **list, const guint8 type, const guint16 value); 62 int msn_tlvlist_add_32(GSList **list, const guint8 type, const guint32 value); 63 int msn_tlvlist_add_str(GSList **list, const guint8 type, const char *value); 64 int msn_tlvlist_add_tlv(GSList **list, const msn_tlv_t *tlv); 65 66 int msn_tlvlist_replace_raw(GSList **list, const guint8 type, const guint8 lenth, const char *value); 67 int msn_tlvlist_replace_str(GSList **list, const guint8 type, const char *str); 68 int msn_tlvlist_replace_empty(GSList **list, const guint8 type); 69 int msn_tlvlist_replace_8(GSList **list, const guint8 type, const guint8 value); 70 int msn_tlvlist_replace_16(GSList **list, const guint8 type, const guint16 value); 71 int msn_tlvlist_replace_32(GSList **list, const guint8 type, const guint32 value); 72 int msn_tlvlist_replace_tlv(GSList **list, const msn_tlv_t *tlv); 58 int msn_tlvlist_add_raw(GSList **list, const guint16 type, const guint16 length, const char *value); 59 int msn_tlvlist_add_empty(GSList **list, const guint16 type); 60 int msn_tlvlist_add_8(GSList **list, const guint16 type, const guint8 value); 61 int msn_tlvlist_add_16(GSList **list, const guint16 type, const guint16 value); 62 int msn_tlvlist_add_32(GSList **list, const guint16 type, const guint32 value); 63 int msn_tlvlist_add_str(GSList **list, const guint16 type, const char *value); 64 65 int msn_tlvlist_replace_raw(GSList **list, const guint16 type, const guint16 lenth, const char *value); 66 int msn_tlvlist_replace_str(GSList **list, const guint16 type, const char *str); 67 int msn_tlvlist_replace_empty(GSList **list, const guint16 type); 68 int msn_tlvlist_replace_8(GSList **list, const guint16 type, const guint8 value); 69 int msn_tlvlist_replace_16(GSList **list, const guint16 type, const guint16 value); 70 int msn_tlvlist_replace_32(GSList **list, const guint16 type, const guint32 value); 73 71 74 void msn_tlvlist_remove(GSList **list, const guint 8type);72 void msn_tlvlist_remove(GSList **list, const guint16 type); 75 73 76 74 #endif /* MSN_TLV_H */ 77 75 -
libpurple/protocols/novell/nmconn.c
Only in extract/pidgin-2.10.9/libpurple/protocols: mxit 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.9/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.9/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
diff -ru extract/pidgin-2.10.9/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.9/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.9/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.9/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: Makefile.in Only in libpurple/protocols/oscar: moz.build diff -ru extract/pidgin-2.10.9/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; … … 3982 3982 const char *idle_reporting_pref; 3983 3983 gboolean report_idle; 3984 3984 3985 idle_reporting_pref = purple_prefs_get_string("/purple/away/idle_reporting"); 3986 report_idle = strcmp(idle_reporting_pref, "none") != 0; 3985 report_idle = purple_prefs_get_bool("/messenger/status/reportIdle"); 3987 3986 3988 3987 if (report_idle) 3989 3988 aim_ssi_setpresence(od, tmp | AIM_SSI_PRESENCE_FLAG_SHOWIDLE); … … 4025 4024 b = purple_find_buddy_in_group(account, curitem->name, g); 4026 4025 if (b) { 4027 4026 /* Get server stored alias */ 4028 purple_blist_alias_buddy(b, alias_utf8); 4027 if (!purple_strequal(curitem->name, alias_utf8)) 4028 purple_blist_alias_buddy(b, alias_utf8); 4029 4029 } else { 4030 4030 b = purple_buddy_new(account, curitem->name, alias_utf8); 4031 4031 … … 5767 5767 prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); 5768 5768 5769 5769 option = purple_account_option_bool_new(_("Use clientLogin"), "use_clientlogin", 5770 OSCAR_DEFAULT_USE_CLIENTLOGIN);5770 is_icq ? ICQ_DEFAULT_USE_CLIENTLOGIN : AIM_DEFAULT_USE_CLIENTLOGIN); 5771 5771 prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); 5772 5772 5773 5773 option = purple_account_option_bool_new( -
libpurple/protocols/oscar/oscarcommon.h
diff -ru extract/pidgin-2.10.9/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.mk Only in libpurple/protocols: prpl.py Only in libpurple/protocols: prpl-rules.mk 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.9/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 extract/pidgin-2.10.9/libpurple/protocols: silc Only in extract/pidgin-2.10.9/libpurple/protocols: silc10 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 diff -ru extract/pidgin-2.10.9/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.9/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.9/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: Makefile.in Only in libpurple/protocols/yahoo: moz.build diff -ru extract/pidgin-2.10.9/libpurple/protocols/yahoo/util.c libpurple/protocols/yahoo/util.c
old new 498 498 */ 499 499 int size, htmlsize; 500 500 gchar tmp[11]; 501 gchar *tmp2 = g_strdup_printf("font-size: %spt", fontsize); 501 502 size = strtol(fontsize, NULL, 10); 502 503 htmlsize = point_to_html(size); 503 504 sprintf(tmp, "%u", htmlsize); 504 505 xmlnode_set_attrib(*cur, "size", tmp); 505 xmlnode_set_attrib(*cur, "absz", fontsize); 506 xmlnode_set_attrib(*cur, "style", tmp2); 507 g_free(tmp2); 506 508 #endif /* !USE_CSS_FORMATTING */ 507 509 g_free(fontsize); 508 510 } -
libpurple/proxy.c
Only in extract/pidgin-2.10.9/libpurple/protocols: zephyr diff -ru extract/pidgin-2.10.9/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 … … 2265 2267 gpi = NULL; 2266 2268 } 2267 2269 if (gpi == NULL) { 2270 #if 0 2268 2271 if (purple_running_gnome()) 2269 2272 gpi = purple_gnome_proxy_get_info(); 2270 2273 else 2274 #endif 2271 2275 gpi = purple_global_proxy_get_info(); 2272 2276 } 2273 2277 … … 2589 2593 } 2590 2594 } 2591 2595 2596 #if 0 2592 2597 static void 2593 2598 proxy_pref_cb(const char *name, PurplePrefType type, 2594 2599 gconstpointer value, gpointer data) … … 2624 2629 else if (purple_strequal(name, "/purple/proxy/password")) 2625 2630 purple_proxy_info_set_password(info, value); 2626 2631 } 2632 #endif 2627 2633 2628 2634 void * 2629 2635 purple_proxy_get_handle() … … 2643 2649 2644 2650 /* Proxy */ 2645 2651 purple_prefs_add_none("/purple/proxy"); 2652 #if 0 2646 2653 purple_prefs_add_string("/purple/proxy/type", "none"); 2647 2654 purple_prefs_add_string("/purple/proxy/host", ""); 2648 2655 purple_prefs_add_int("/purple/proxy/port", 0); 2649 2656 purple_prefs_add_string("/purple/proxy/username", ""); 2650 2657 purple_prefs_add_string("/purple/proxy/password", ""); 2658 #endif 2651 2659 purple_prefs_add_bool("/purple/proxy/socks4_remotedns", FALSE); 2652 2660 2661 #if 0 2653 2662 /* Setup callbacks for the preferences. */ 2654 2663 handle = purple_proxy_get_handle(); 2655 2664 purple_prefs_connect_callback(handle, "/purple/proxy/type", proxy_pref_cb, … … 2669 2678 purple_prefs_trigger_callback("/purple/proxy/port"); 2670 2679 purple_prefs_trigger_callback("/purple/proxy/username"); 2671 2680 purple_prefs_trigger_callback("/purple/proxy/password"); 2681 #endif 2672 2682 } 2673 2683 2674 2684 void -
libpurple/proxy.h
diff -ru extract/pidgin-2.10.9/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.9/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.9/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 extract/pidgin-2.10.9/libpurple: purple.h Only in extract/pidgin-2.10.9/libpurple: purple.h.in Only in extract/pidgin-2.10.9/libpurple: purple.pc.in Only in libpurple: purple-prefs.js diff -ru extract/pidgin-2.10.9/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
Only in extract/pidgin-2.10.9/libpurple: savedstatuses.c Only in extract/pidgin-2.10.9/libpurple: savedstatuses.h diff -ru extract/pidgin-2.10.9/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.9/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/sslconn.c
Only in extract/pidgin-2.10.9/libpurple: sound.c Only in extract/pidgin-2.10.9/libpurple: sound.h Only in extract/pidgin-2.10.9/libpurple: sound-theme.c Only in extract/pidgin-2.10.9/libpurple: sound-theme.h Only in extract/pidgin-2.10.9/libpurple: sound-theme-loader.c Only in extract/pidgin-2.10.9/libpurple: sound-theme-loader.h diff -ru extract/pidgin-2.10.9/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.9/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/ssl-nss.c
diff -ru extract/pidgin-2.10.9/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" … … 64 63 65 64 #define PURPLE_SSL_NSS_DATA(gsc) ((PurpleSslNssData *)gsc->private_data) 66 65 67 static const PRIOMethods *_nss_methods = NULL; 68 static PRDescIdentity _identity; 69 static PurpleCertificateScheme x509_nss; 66 /* static const PRIOMethods *_nss_methods = NULL; */ 67 /* static PRDescIdentity _identity; */ 68 /* static PurpleCertificateScheme x509_nss; */ 70 69 71 70 /* Thank you, Evolution */ 72 71 static void … … 133 132 static void 134 133 ssl_nss_init_nss(void) 135 134 { 135 #if 0 136 136 PR_Init(PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1); 137 137 NSS_NoDB_Init("."); 138 138 NSS_SetDomesticPolicy(); … … 152 152 153 153 _identity = PR_GetUniqueIdentity("Purple"); 154 154 _nss_methods = PR_GetDefaultIOMethods(); 155 #endif 155 156 } 156 157 157 158 static SECStatus … … 183 184 static void 184 185 ssl_nss_uninit(void) 185 186 { 187 #if 0 186 188 NSS_Shutdown(); 187 189 PR_Cleanup(); 188 190 189 191 _nss_methods = NULL; 192 #endif 190 193 } 191 194 195 #if 0 192 196 static void 193 197 ssl_nss_verified_cb(PurpleCertificateVerificationStatus st, 194 198 gpointer userdata) … … 265 269 266 270 return peer_certs; 267 271 } 272 #endif 268 273 269 274 static void 270 275 ssl_nss_handshake_cb(gpointer data, int fd, PurpleInputCondition cond) … … 296 301 purple_input_remove(nss_data->handshake_handler); 297 302 nss_data->handshake_handler = 0; 298 303 304 gsc->connect_cb(gsc->connect_cb_data, gsc, cond); 305 306 #if 0 299 307 /* If a Verifier was given, hand control over to it */ 300 308 if (gsc->verifier) { 301 309 GList *peers; … … 318 326 */ 319 327 gsc->connect_cb(gsc->connect_cb_data, gsc, cond); 320 328 } 329 #endif 321 330 } 322 331 323 332 static gboolean … … 379 388 380 389 SSL_OptionSet(nss_data->in, SSL_SECURITY, PR_TRUE); 381 390 SSL_OptionSet(nss_data->in, SSL_HANDSHAKE_AS_CLIENT, PR_TRUE); 391 SSL_OptionSet(nss_data->in, SSL_ENABLE_SESSION_TICKETS, PR_FALSE); 382 392 383 393 /* If we have our internal verifier set up, use it. Otherwise, 384 394 * use default. */ 385 if (gsc->verifier != NULL )395 if (gsc->verifier != NULL && !purple_prefs_get_bool("/purple/ssl/check_certificates")) 386 396 SSL_AuthCertificateHook(nss_data->in, ssl_auth_cert, NULL); 387 397 388 398 if(gsc->host) … … 434 444 PRInt32 ret; 435 445 PurpleSslNssData *nss_data = PURPLE_SSL_NSS_DATA(gsc); 436 446 447 if (nss_data->handshake_handler != 0) { 448 purple_debug_error("nss", "attempting to read from an ssl socket before the end of the handshake\n"); 449 return -1; 450 } 451 437 452 ret = PR_Read(nss_data->in, data, len); 438 453 439 454 if (ret == -1) … … 451 466 if(!nss_data) 452 467 return 0; 453 468 469 if (nss_data->handshake_handler != 0) { 470 purple_debug_error("nss", "attempting to write to an ssl socket before the end of the handshake\n"); 471 return -1; 472 } 473 454 474 ret = PR_Write(nss_data->in, data, len); 455 475 456 476 if (ret == -1) … … 483 503 return NULL; 484 504 } 485 505 506 #if 0 507 /* No purple_certificate_* stuff for Instantbird */ 508 486 509 /************************************************************************/ 487 510 /* X.509 functionality */ 488 511 /************************************************************************/ … … 936 959 NULL, 937 960 NULL 938 961 }; 962 #endif 939 963 940 964 static PurpleSslOps ssl_ops = 941 965 { … … 954 978 }; 955 979 956 980 981 void purple_nss_init(void) 982 { 983 purple_ssl_set_ops(&ssl_ops); 984 } 985 986 #if 0 987 /* Instantbird does not need the plugin stuff for NSS */ 957 988 static gboolean 958 989 plugin_load(PurplePlugin *plugin) 959 990 { … … 1026 1057 } 1027 1058 1028 1059 PURPLE_INIT_PLUGIN(ssl_nss, init_plugin, info) 1060 #endif -
libpurple/status.c
diff -ru extract/pidgin-2.10.9/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
Only in extract/pidgin-2.10.9/libpurple: tests Only in extract/pidgin-2.10.9/libpurple: theme.c Only in extract/pidgin-2.10.9/libpurple: theme.h Only in extract/pidgin-2.10.9/libpurple: theme-loader.c Only in extract/pidgin-2.10.9/libpurple: theme-loader.h Only in extract/pidgin-2.10.9/libpurple: theme-manager.c Only in extract/pidgin-2.10.9/libpurple: theme-manager.h diff -ru extract/pidgin-2.10.9/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.9/libpurple/util.c libpurple/util.c
old new 2495 2495 /************************************************************************** 2496 2496 * Path/Filename Functions 2497 2497 **************************************************************************/ 2498 #ifdef PURPLE_PLUGINS 2498 2499 const char * 2499 2500 purple_home_dir(void) 2500 2501 { … … 2504 2505 return wpurple_data_dir(); 2505 2506 #endif 2506 2507 } 2508 #endif 2507 2509 2508 2510 /* Returns the argument passed to -c IFF it was present, or ~/.purple. */ 2509 2511 const char * 2510 2512 purple_user_dir(void) 2511 2513 { 2512 if (custom_user_dir != NULL) 2513 return custom_user_dir; 2514 else if (!user_dir) 2515 user_dir = g_build_filename(purple_home_dir(), ".purple", NULL); 2516 2517 return user_dir; 2514 g_return_val_if_fail(custom_user_dir != NULL, NULL); 2515 return custom_user_dir; 2518 2516 } 2519 2517 2520 2518 void purple_util_set_user_dir(const char *dir) … … 2715 2713 return xmlnode_from_file(purple_user_dir(), filename, description, "util"); 2716 2714 } 2717 2715 2716 #if 0 2718 2717 /* 2719 2718 * Like mkstemp() but returns a file pointer, uses a pre-set template, 2720 2719 * uses the semantics of tempnam() for the directory to use and allocates … … 2763 2762 2764 2763 return fp; 2765 2764 } 2765 #endif 2766 2766 2767 2767 const char * 2768 2768 purple_util_get_image_extension(gconstpointer data, size_t len) … … 2830 2830 return filename; 2831 2831 } 2832 2832 2833 #if 0 2833 2834 gboolean 2834 2835 purple_program_is_valid(const char *program) 2835 2836 { … … 2865 2866 2866 2867 return is_valid; 2867 2868 } 2868 2869 #endif 2869 2870 2870 2871 gboolean 2871 2872 purple_running_gnome(void) 2872 2873 { 2873 #if ndef _WIN322874 #if !defined(_WIN32) && !defined(__APPLE__) 2874 2875 gchar *tmp = g_find_program_in_path("gnome-open"); 2875 2876 2876 2877 if (tmp == NULL) … … 2888 2889 gboolean 2889 2890 purple_running_kde(void) 2890 2891 { 2891 #if ndef _WIN322892 #if !defined(_WIN32) && !defined(__APPLE__) 2892 2893 gchar *tmp = g_find_program_in_path("kfmclient"); 2893 2894 const char *session; 2894 2895 -
libpurple/util.h
diff -ru extract/pidgin-2.10.9/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 extract/pidgin-2.10.9/libpurple: valgrind.h Only in extract/pidgin-2.10.9/libpurple/win32: giowin32.c Only in extract/pidgin-2.10.9/libpurple/win32: global.mak diff -ru extract/pidgin-2.10.9/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
Only in extract/pidgin-2.10.9/libpurple/win32: libpurplerc.rc.in Only in extract/pidgin-2.10.9/libpurple/win32: rules.mak Only in extract/pidgin-2.10.9/libpurple/win32: targets.mak diff -ru extract/pidgin-2.10.9/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.9/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.9/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 37 #undef ENETDOWN 38 #undef EAFNOSUPPORT 39 #undef EINPROGRESS 40 #undef ENOBUFS 41 #undef EPROTONOSUPPORT 42 #undef EPROTOTYPE 43 #undef ESOCKTNOSUPPORT 44 45 #undef EADDRINUSE 46 #undef EALREADY 47 #undef EADDRNOTAVAIL 48 #undef ECONNREFUSED 49 #undef EISCONN 50 #undef ENETUNREACH 51 #undef ENOTSOCK 52 #undef ETIMEDOUT 53 #undef EWOULDBLOCK 54 55 #undef ENOTCONN 56 #undef ENETRESET 57 #undef EOPNOTSUPP 58 #undef EMSGSIZE 59 #undef ECONNABORTED 60 #undef ECONNRESET 61 #undef EHOSTUNREACH 62 #endif 63 28 64 /* Here we define unix socket errors as windows socket errors */ 29 65 30 66 #define ENETDOWN WSAENETDOWN … … 36 72 #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT 37 73 38 74 #define EADDRINUSE WSAEADDRINUSE 39 #define EINPROGRESS WSAEINPROGRESS40 75 #define EALREADY WSAEALREADY 41 76 #define EADDRNOTAVAIL WSAEADDRNOTAVAIL 42 77 #define ECONNREFUSED WSAECONNREFUSED