# HG changeset patch # User andrew.victor@mxit.com # Date 1314989824 0 # Node ID d66ce874075a8aaafbb010c3d0b55264caf9ac8c # Parent b814c2878d1265b866981aa7246a56e7e2df93d9# Parent c200251415d3865b103a8065ad908135fe6aecbe merge of '4550b9538730036d9023f75e224ffb15f50f020f' and '75ec74edcc85a4e376ccf3c424deb66d64db6ba9' diff -r b814c2878d12 -r d66ce874075a ChangeLog.API --- a/ChangeLog.API Thu Sep 01 18:26:08 2011 +0000 +++ b/ChangeLog.API Fri Sep 02 18:57:04 2011 +0000 @@ -61,6 +61,9 @@ the first parameter * PurpleConnectionUiOps.report_disconnect now passes a PurpleConnectionError as the second parameter + * purple_dnsquery_a now takes a PurpleAccount as the first parameter + * purple_srv_resolve now takes a PurpleAccount as the first parameter + * purple_txt_resolve now takes a PurpleAccount as the first parameter Removed: * _GntFileType @@ -96,22 +99,44 @@ * pidgin_set_custom_buddy_icon * pidgin_setup_screenname_autocomplete * PidginConversation.sg + * purple_buddy_icons_has_custom_icon + * purple_buddy_icons_find_custom_icon + * purple_buddy_icons_set_custom_icon * purple_connection_error_reason * purple_core_migrate + * purple_dnsquery_a_account * purple_notify_searchresults_column_get_title * purple_notify_searchresults_get_columns_count * purple_notify_searchresults_get_rows_count * purple_notify_searchresults_row_get + * purple_presence_add_status + * purple_presence_add_list + * purple_srv_cancel + * purple_srv_resolve_account + * purple_status_set_attr_boolean + * purple_status_set_attr_int + * purple_status_set_attr_string + * purple_status_type_add_attr + * purple_status_type_add_attrs + * purple_status_type_add_attrs_vargs * purple_status_type_get_primary_attr * purple_status_type_set_primary_attr * purple_strlcat * purple_strlcpy + * purple_txt_cancel + * purple_txt_resolve_account * purple_util_fetch_url_request_len_with_account. Use - purple_util_fetch_url_request_len, insetad. + purple_util_fetch_url_request_len, instead. * PurpleConnectionUiOps.report_disconnect_reason + * serv_got_attention + * serv_send_attention * struct _GtkIMHtmlFontDetail + * struct _PidginChatPane + * struct _PidginImPane + * struct _PurpleAttentionType * struct _PurpleMenuAction * struct _PurplePounce + * struct _PurpleProxyInfo * struct _PurpleRequestField * struct _PurpleRoomlist * struct _PurpleRoomlistField diff -r b814c2878d12 -r d66ce874075a libpurple/buddyicon.c --- a/libpurple/buddyicon.c Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/buddyicon.c Fri Sep 02 18:57:04 2011 +0000 @@ -955,25 +955,6 @@ return purple_buddy_icons_node_set_custom_icon(node, data, len); } -gboolean -purple_buddy_icons_has_custom_icon(PurpleContact *contact) -{ - return purple_buddy_icons_node_has_custom_icon((PurpleBlistNode*)contact); -} - -PurpleStoredImage * -purple_buddy_icons_find_custom_icon(PurpleContact *contact) -{ - return purple_buddy_icons_node_find_custom_icon((PurpleBlistNode*)contact); -} - -PurpleStoredImage * -purple_buddy_icons_set_custom_icon(PurpleContact *contact, guchar *icon_data, - size_t icon_len) -{ - return purple_buddy_icons_node_set_custom_icon((PurpleBlistNode*)contact, icon_data, icon_len); -} - static void delete_buddy_icon_settings(PurpleBlistNode *node, const char *setting_name) { diff -r b814c2878d12 -r d66ce874075a libpurple/buddyicon.h --- a/libpurple/buddyicon.h Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/buddyicon.h Fri Sep 02 18:57:04 2011 +0000 @@ -275,7 +275,6 @@ * @param node The blist node. * * @return A boolean indicating if @a node has a custom buddy icon. - * @since 2.5.0 */ gboolean purple_buddy_icons_node_has_custom_icon(PurpleBlistNode *node); @@ -293,7 +292,6 @@ * @param node The node. * * @return The custom buddy icon. - * @since 2.5.0 */ PurpleStoredImage * purple_buddy_icons_node_find_custom_icon(PurpleBlistNode *node); @@ -311,7 +309,6 @@ * * @return The icon that was set. The caller does NOT own a reference to this, * and must call purple_imgstore_ref() if it wants one. - * @since 2.5.0 */ PurpleStoredImage * purple_buddy_icons_node_set_custom_icon(PurpleBlistNode *node, @@ -329,45 +326,11 @@ * * @return The icon that was set. The caller does NOT own a reference to this, * and must call purple_imgstore_ref() if it wants one. - * @since 2.5.0 */ PurpleStoredImage * purple_buddy_icons_node_set_custom_icon_from_file(PurpleBlistNode *node, const gchar *filename); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_BUDDYICON_C_) -/** - * PurpleContact version of purple_buddy_icons_node_has_custom_icon. - * - * @copydoc purple_buddy_icons_node_has_custom_icon() - * - * @deprecated Use purple_buddy_icons_node_has_custom_icon instead. - */ -gboolean -purple_buddy_icons_has_custom_icon(PurpleContact *contact); - -/** - * PurpleContact version of purple_buddy_icons_node_find_custom_icon. - * - * @copydoc purple_buddy_icons_node_find_custom_icon() - * - * @deprecated Use purple_buddy_icons_node_find_custom_icon instead. - */ -PurpleStoredImage * -purple_buddy_icons_find_custom_icon(PurpleContact *contact); - -/** - * PurpleContact version of purple_buddy_icons_node_set_custom_icon. - * - * @copydoc purple_buddy_icons_node_set_custom_icon() - * - * @deprecated Use purple_buddy_icons_node_set_custom_icon instead. - */ -PurpleStoredImage * -purple_buddy_icons_set_custom_icon(PurpleContact *contact, - guchar *icon_data, size_t icon_len); -#endif - /** * Sets whether or not buddy icon caching is enabled. * diff -r b814c2878d12 -r d66ce874075a libpurple/dnsquery.c --- a/libpurple/dnsquery.c Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/dnsquery.c Fri Sep 02 18:57:04 2011 +0000 @@ -914,7 +914,7 @@ } PurpleDnsQueryData * -purple_dnsquery_a_account(PurpleAccount *account, const char *hostname, int port, +purple_dnsquery_a(PurpleAccount *account, const char *hostname, int port, PurpleDnsQueryConnectFunction callback, gpointer data) { PurpleDnsQueryData *query_data; @@ -944,13 +944,6 @@ return query_data; } -PurpleDnsQueryData * -purple_dnsquery_a(const char *hostname, int port, - PurpleDnsQueryConnectFunction callback, gpointer data) -{ - return purple_dnsquery_a_account(NULL, hostname, port, callback, data); -} - void purple_dnsquery_destroy(PurpleDnsQueryData *query_data) { diff -r b814c2878d12 -r d66ce874075a libpurple/dnsquery.h --- a/libpurple/dnsquery.h Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/dnsquery.h Fri Sep 02 18:57:04 2011 +0000 @@ -88,7 +88,7 @@ /** * Perform an asynchronous DNS query. * - * @param account the account that the query is being done for (or NULL) + * @param account The account that the query is being done for (or NULL) * @param hostname The hostname to resolve. * @param port A port number which is stored in the struct sockaddr. * @param callback The callback function to call after resolving. @@ -98,27 +98,8 @@ * a data structure that can be used to cancel the pending * DNS query, if needed. * - * @since 2.8.0 */ -PurpleDnsQueryData *purple_dnsquery_a_account(PurpleAccount *account, const char *hostname, int port, PurpleDnsQueryConnectFunction callback, gpointer data); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_DNSQUERY_C_) -/** - * Perform an asynchronous DNS query. - * - * @param hostname The hostname to resolve. - * @param port A port number which is stored in the struct sockaddr. - * @param callback The callback function to call after resolving. - * @param data Extra data to pass to the callback function. - * - * @return NULL if there was an error, otherwise return a reference to - * a data structure that can be used to cancel the pending - * DNS query, if needed. - * - * @deprecated Use purple_dnsquery_a_account instead - */ -PurpleDnsQueryData *purple_dnsquery_a(const char *hostname, int port, PurpleDnsQueryConnectFunction callback, gpointer data); -#endif +PurpleDnsQueryData *purple_dnsquery_a(PurpleAccount *account, const char *hostname, int port, PurpleDnsQueryConnectFunction callback, gpointer data); /** * Cancel a DNS query and destroy the associated data structure. diff -r b814c2878d12 -r d66ce874075a libpurple/dnssrv.c --- a/libpurple/dnssrv.c Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/dnssrv.c Fri Sep 02 18:57:04 2011 +0000 @@ -725,15 +725,7 @@ #endif PurpleSrvTxtQueryData * -purple_srv_resolve(const char *protocol, const char *transport, - const char *domain, PurpleSrvCallback cb, gpointer extradata) -{ - return purple_srv_resolve_account(NULL, protocol, transport, domain, - cb, extradata); -} - -PurpleSrvTxtQueryData * -purple_srv_resolve_account(PurpleAccount *account, const char *protocol, +purple_srv_resolve(PurpleAccount *account, const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata) { @@ -869,13 +861,7 @@ #endif } -PurpleSrvTxtQueryData *purple_txt_resolve(const char *owner, - const char *domain, PurpleTxtCallback cb, gpointer extradata) -{ - return purple_txt_resolve_account(NULL, owner, domain, cb, extradata); -} - -PurpleSrvTxtQueryData *purple_txt_resolve_account(PurpleAccount *account, +PurpleSrvTxtQueryData *purple_txt_resolve(PurpleAccount *account, const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata) { @@ -1006,18 +992,6 @@ #endif } -void -purple_txt_cancel(PurpleSrvTxtQueryData *query_data) -{ - purple_srv_txt_query_destroy(query_data); -} - -void -purple_srv_cancel(PurpleSrvTxtQueryData *query_data) -{ - purple_srv_txt_query_destroy(query_data); -} - const gchar * purple_txt_response_get_content(PurpleTxtResponse *resp) { diff -r b814c2878d12 -r d66ce874075a libpurple/dnssrv.h --- a/libpurple/dnssrv.h Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/dnssrv.h Fri Sep 02 18:57:04 2011 +0000 @@ -99,86 +99,40 @@ /** * Queries an SRV record. * - * @param account the account that the query is being done for (or NULL) - * @param protocol Name of the protocol (e.g. "sip") + * @param account The account that the query is being done for (or NULL) + * @param protocol Name of the protocol (e.g. "sip") * @param transport Name of the transport ("tcp" or "udp") - * @param domain Domain name to query (e.g. "blubb.com") - * @param cb A callback which will be called with the results + * @param domain Domain name to query (e.g. "blubb.com") + * @param cb A callback which will be called with the results * @param extradata Extra data to be passed to the callback * - * @since 2.8.0 + * @return NULL if there was an error, otherwise return a reference to + * a data structure that can be used to cancel the pending + * DNS query, if needed. */ -PurpleSrvTxtQueryData *purple_srv_resolve_account(PurpleAccount *account, const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_DNSSRV_C_) -/** - * Queries an SRV record. - * - * @param protocol Name of the protocol (e.g. "sip") - * @param transport Name of the transport ("tcp" or "udp") - * @param domain Domain name to query (e.g. "blubb.com") - * @param cb A callback which will be called with the results - * @param extradata Extra data to be passed to the callback - * - * @deprecated Use purple_srv_resolve_account instead - */ -PurpleSrvTxtQueryData *purple_srv_resolve(const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata); -#endif - -/** - * Cancel an SRV or DNS query. - * - * @param query_data The request to cancel. - * - * @deprecated Use purple_srv_txt_query_destroy instead - */ -void purple_srv_cancel(PurpleSrvTxtQueryData *query_data); +PurpleSrvTxtQueryData *purple_srv_resolve(PurpleAccount *account, const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata); /** * Queries an TXT record. * - * @param account the account that the query is being done for (or NULL) - * @param owner Name of the protocol (e.g. "_xmppconnect") - * @param domain Domain name to query (e.g. "blubb.com") - * @param cb A callback which will be called with the results + * @param account The account that the query is being done for (or NULL) + * @param owner Name of the protocol (e.g. "_xmppconnect") + * @param domain Domain name to query (e.g. "blubb.com") + * @param cb A callback which will be called with the results * @param extradata Extra data to be passed to the callback * - * @since 2.8.0 + * @return NULL if there was an error, otherwise return a reference to + * a data structure that can be used to cancel the pending + * DNS query, if needed. */ -PurpleSrvTxtQueryData *purple_txt_resolve_account(PurpleAccount *account, const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_DNSSRV_C_) -/** - * Queries an TXT record. - * - * @param owner Name of the protocol (e.g. "_xmppconnect") - * @param domain Domain name to query (e.g. "blubb.com") - * @param cb A callback which will be called with the results - * @param extradata Extra data to be passed to the callback - * - * @deprecated Use purple_txt_resolve_account instead - * - * @since 2.6.0 - */ -PurpleSrvTxtQueryData *purple_txt_resolve(const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata); -#endif - -/** - * Cancel an TXT DNS query. - * - * @param query_data The request to cancel. - * @since 2.6.0 - * - * @deprecated Use purple_srv_txt_query_destroy instead - */ -void purple_txt_cancel(PurpleSrvTxtQueryData *query_data); +PurpleSrvTxtQueryData *purple_txt_resolve(PurpleAccount *account, const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata); /** * Get the value of the current TXT record. * * @param response The TXT response record - * @returns The value of the current TXT record. - * @since 2.6.0 + * + * @return The value of the current TXT record. */ const gchar *purple_txt_response_get_content(PurpleTxtResponse *response); @@ -186,7 +140,6 @@ * Destroy a TXT DNS response object. * * @param response The PurpleTxtResponse to destroy. - * @since 2.6.0 */ void purple_txt_response_destroy(PurpleTxtResponse *response); @@ -216,7 +169,7 @@ PurpleSrvTxtQueryUiOps *purple_srv_txt_query_get_ui_ops(void); /** - * Get the query from a PurpleDnsQueryData + * Get the query from a PurpleSrvTxtQueryData * * @param query_data The SRV/TXT query * @return The query. @@ -224,7 +177,7 @@ char *purple_srv_txt_query_get_query(PurpleSrvTxtQueryData *query_data); /** - * Get the type from a PurpleDnsQueryData (TXT or SRV) + * Get the type from a PurpleSrvTxtQueryData (TXT or SRV) * * @param query_data The query * @return The query. @@ -236,3 +189,4 @@ #endif #endif /* _PURPLE_DNSSRV_H */ + diff -r b814c2878d12 -r d66ce874075a libpurple/imgstore.h --- a/libpurple/imgstore.h Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/imgstore.h Fri Sep 02 18:57:04 2011 +0000 @@ -68,7 +68,6 @@ * @param path The path to the image. * * @return The stored image. - * @since 2.X.X */ PurpleStoredImage * purple_imgstore_new_from_file(const char *path); diff -r b814c2878d12 -r d66ce874075a libpurple/network.c --- a/libpurple/network.c Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/network.c Fri Sep 02 18:57:04 2011 +0000 @@ -991,7 +991,7 @@ if (stun_server && stun_server[0] != '\0') { if (purple_network_is_available()) { purple_debug_info("network", "running DNS query for STUN server\n"); - purple_dnsquery_a_account(NULL, stun_server, 3478, purple_network_ip_lookup_cb, + purple_dnsquery_a(NULL, stun_server, 3478, purple_network_ip_lookup_cb, &stun_ip); } else { purple_debug_info("network", @@ -1009,7 +1009,7 @@ if (turn_server && turn_server[0] != '\0') { if (purple_network_is_available()) { purple_debug_info("network", "running DNS query for TURN server\n"); - purple_dnsquery_a_account(NULL, turn_server, + purple_dnsquery_a(NULL, turn_server, purple_prefs_get_int("/purple/network/turn_port"), purple_network_ip_lookup_cb, &turn_ip); } else { diff -r b814c2878d12 -r d66ce874075a libpurple/plugins/perl/common/Status.xs --- a/libpurple/plugins/perl/common/Status.xs Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/plugins/perl/common/Status.xs Fri Sep 02 18:57:04 2011 +0000 @@ -74,28 +74,6 @@ newCONSTSUB(primitive_stash, (char *)civ->name, newSViv(civ->iv)); } -void -purple_presence_add_list(presence, source_list) - Purple::Presence presence - SV *source_list -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(source_list)); - - for (i = 0; i <= t_len; i++) { - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(source_list), i, 0))); - } - purple_presence_add_list(presence, t_GL); - g_list_free(t_GL); - -void -purple_presence_add_status(presence, status) - Purple::Presence presence - Purple::Status status - gint purple_presence_compare(presence1, presence2) Purple::Presence presence1 @@ -329,29 +307,10 @@ Purple::Status status gboolean active -void -purple_status_set_attr_boolean(status, id, value) - Purple::Status status - const char *id - gboolean value - -void -purple_status_set_attr_string(status, id, value) - Purple::Status status - const char *id - const char *value - MODULE = Purple::Status PACKAGE = Purple::StatusType PREFIX = purple_status_type_ PROTOTYPES: ENABLE void -purple_status_type_add_attr(status_type, id, name, value) - Purple::StatusType status_type - const char *id - const char *name - Purple::Value value - -void purple_status_type_destroy(status_type) Purple::StatusType status_type diff -r b814c2878d12 -r d66ce874075a libpurple/protocols/jabber/disco.c --- a/libpurple/protocols/jabber/disco.c Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/protocols/jabber/disco.c Fri Sep 02 18:57:04 2011 +0000 @@ -485,7 +485,7 @@ resp[0].hostname, resp[0].port); account = purple_connection_get_account(js->gc); js->stun_query = - purple_dnsquery_a_account(account, resp[0].hostname, resp[0].port, + purple_dnsquery_a(account, resp[0].hostname, resp[0].port, jabber_disco_stun_lookup_cb, js); } } @@ -550,7 +550,7 @@ } else if (purple_network_get_stun_ip() == NULL || purple_strequal(purple_network_get_stun_ip(), "")) { js->srv_query_data = - purple_srv_resolve_account( + purple_srv_resolve( purple_connection_get_account(js->gc), "stun", "udp", js->user->domain, jabber_disco_stun_srv_resolve_cb, js); diff -r b814c2878d12 -r d66ce874075a libpurple/protocols/jabber/google/jingleinfo.c --- a/libpurple/protocols/jabber/google/jingleinfo.c Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/protocols/jabber/google/jingleinfo.c Fri Sep 02 18:57:04 2011 +0000 @@ -117,7 +117,7 @@ purple_dnsquery_destroy(js->stun_query); account = purple_connection_get_account(js->gc); - js->stun_query = purple_dnsquery_a_account(account, host, port, + js->stun_query = purple_dnsquery_a(account, host, port, jabber_google_stun_lookup_cb, js); } } diff -r b814c2878d12 -r d66ce874075a libpurple/protocols/jabber/jabber.c --- a/libpurple/protocols/jabber/jabber.c Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/protocols/jabber/jabber.c Fri Sep 02 18:57:04 2011 +0000 @@ -813,7 +813,7 @@ try_srv_connect(js); } else { purple_debug_info("jabber","Couldn't connect directly to %s. Trying to find alternative connection methods, like BOSH.\n", js->user->domain); - js->srv_query_data = purple_txt_resolve_account( + js->srv_query_data = purple_txt_resolve( purple_connection_get_account(gc), "_xmppconnect", js->user->domain, txt_resolved_cb, js); } @@ -1074,7 +1074,7 @@ jabber_login_connect(js, js->user->domain, connect_server, purple_account_get_int(account, "port", 5222), TRUE); } else { - js->srv_query_data = purple_srv_resolve_account(account, "xmpp-client", + js->srv_query_data = purple_srv_resolve(account, "xmpp-client", "tcp", js->user->domain, srv_resolved_cb, js); } } @@ -1599,7 +1599,7 @@ jabber_send_raw(js, "", -1); if (js->srv_query_data) - purple_srv_cancel(js->srv_query_data); + purple_srv_txt_query_destroy(js->srv_query_data); if(js->gsc) { purple_ssl_close(js->gsc); diff -r b814c2878d12 -r d66ce874075a libpurple/protocols/simple/simple.c --- a/libpurple/protocols/simple/simple.c Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/protocols/simple/simple.c Fri Sep 02 18:57:04 2011 +0000 @@ -1904,7 +1904,7 @@ } else { /* UDP */ purple_debug_info("simple", "using udp with server %s and port %d\n", hostname, port); - sip->query_data = purple_dnsquery_a_account(sip->account, hostname, + sip->query_data = purple_dnsquery_a(sip->account, hostname, port, simple_udp_host_resolved, sip); if (sip->query_data == NULL) { purple_connection_error(sip->gc, @@ -1970,7 +1970,7 @@ hosttoconnect = purple_account_get_string(account, "proxy", sip->servername); } - sip->srv_query_data = purple_srv_resolve_account(account, "sip", + sip->srv_query_data = purple_srv_resolve(account, "sip", sip->udp ? "udp" : "tcp", hosttoconnect, srvresolved, sip); } @@ -2007,7 +2007,7 @@ purple_dnsquery_destroy(sip->query_data); if (sip->srv_query_data != NULL) - purple_srv_cancel(sip->srv_query_data); + purple_srv_txt_query_destroy(sip->srv_query_data); if (sip->listen_data != NULL) purple_network_listen_cancel(sip->listen_data); diff -r b814c2878d12 -r d66ce874075a libpurple/protocols/yahoo/libymsg.c --- a/libpurple/protocols/yahoo/libymsg.c Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/protocols/yahoo/libymsg.c Fri Sep 02 18:57:04 2011 +0000 @@ -4476,7 +4476,7 @@ YAHOO_CLIENT_VERSION, yd->cookie_t, yd->cookie_y, strlen(validate_request_str), validate_request_str); /* use whole URL if using HTTP Proxy */ - if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP)) + if ((gc->account->proxy_info) && (purple_proxy_info_get_type(gc->account->proxy_info) == PURPLE_PROXY_HTTP)) use_whole_url = TRUE; url_data = purple_util_fetch_url_request_len( diff -r b814c2878d12 -r d66ce874075a libpurple/protocols/yahoo/yahoo_filexfer.c --- a/libpurple/protocols/yahoo/yahoo_filexfer.c Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/protocols/yahoo/yahoo_filexfer.c Fri Sep 02 18:57:04 2011 +0000 @@ -1681,13 +1681,13 @@ account = purple_connection_get_account(gc); if (yd->jp) { - purple_dnsquery_a_account(account, YAHOOJP_XFER_RELAY_HOST, + purple_dnsquery_a(account, YAHOOJP_XFER_RELAY_HOST, YAHOOJP_XFER_RELAY_PORT, yahoo_xfer_dns_connected_15, xfer); } else { - purple_dnsquery_a_account(account, YAHOO_XFER_RELAY_HOST, + purple_dnsquery_a(account, YAHOO_XFER_RELAY_HOST, YAHOO_XFER_RELAY_PORT, yahoo_xfer_dns_connected_15, xfer); } diff -r b814c2878d12 -r d66ce874075a libpurple/proxy.c --- a/libpurple/proxy.c Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/proxy.c Fri Sep 02 18:57:04 2011 +0000 @@ -41,6 +41,16 @@ #include "proxy.h" #include "util.h" +struct _PurpleProxyInfo +{ + PurpleProxyType type; /**< The proxy type. */ + + char *host; /**< The host. */ + int port; /**< The port number. */ + char *username; /**< The username. */ + char *password; /**< The password. */ +}; + struct _PurpleProxyConnectData { void *handle; PurpleProxyConnectFunction connect_cb; @@ -1369,7 +1379,7 @@ proxy_do_write(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); } else { - connect_data->query_data = purple_dnsquery_a_account( + connect_data->query_data = purple_dnsquery_a( connect_data->account, connect_data->host, connect_data->port, s4_host_resolved, connect_data); @@ -2088,7 +2098,7 @@ /** * This function attempts to connect to the next IP address in the list - * of IP addresses returned to us by purple_dnsquery_a() and attemps + * of IP addresses returned to us by purple_dnsquery_a() and attempts * to connect to each one. This is called after the hostname is * resolved, and each time a connection attempt fails (assuming there * is another IP address to try). @@ -2317,7 +2327,7 @@ return NULL; } - connect_data->query_data = purple_dnsquery_a_account(account, connecthost, + connect_data->query_data = purple_dnsquery_a(account, connecthost, connectport, connection_host_resolved, connect_data); if (connect_data->query_data == NULL) { @@ -2385,7 +2395,7 @@ return NULL; } - connect_data->query_data = purple_dnsquery_a_account(account, connecthost, + connect_data->query_data = purple_dnsquery_a(account, connecthost, connectport, connection_host_resolved, connect_data); if (connect_data->query_data == NULL) { diff -r b814c2878d12 -r d66ce874075a libpurple/proxy.h --- a/libpurple/proxy.h Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/proxy.h Fri Sep 02 18:57:04 2011 +0000 @@ -47,16 +47,7 @@ /** * Information on proxy settings. */ -typedef struct -{ - PurpleProxyType type; /**< The proxy type. */ - - char *host; /**< The host. */ - int port; /**< The port number. */ - char *username; /**< The username. */ - char *password; /**< The password. */ - -} PurpleProxyInfo; +typedef struct _PurpleProxyInfo PurpleProxyInfo; typedef struct _PurpleProxyConnectData PurpleProxyConnectData; diff -r b814c2878d12 -r d66ce874075a libpurple/prpl.c --- a/libpurple/prpl.c Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/prpl.c Fri Sep 02 18:57:04 2011 +0000 @@ -32,6 +32,20 @@ /**************************************************************************/ /** @name Attention Type API */ /**************************************************************************/ + +/** Represents "nudges" and "buzzes" that you may send to a buddy to attract + * their attention (or vice-versa). + */ +struct _PurpleAttentionType +{ + const char *name; /**< Shown in GUI elements */ + const char *incoming_description; /**< Shown when sent */ + const char *outgoing_description; /**< Shown when receied */ + const char *icon_name; /**< Icon to display (optional) */ + const char *unlocalized_name; /**< Unlocalized name for UIs needing it */ +}; + + PurpleAttentionType * purple_attention_type_new(const char *ulname, const char *name, const char *inc_desc, const char *out_desc) diff -r b814c2878d12 -r d66ce874075a libpurple/prpl.h --- a/libpurple/prpl.h Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/prpl.h Fri Sep 02 18:57:04 2011 +0000 @@ -111,23 +111,6 @@ gboolean secret; /**< True if the entry is secret (password) */ }; -/** Represents "nudges" and "buzzes" that you may send to a buddy to attract - * their attention (or vice-versa). - */ -struct _PurpleAttentionType -{ - const char *name; /**< Shown in GUI elements */ - const char *incoming_description; /**< Shown when sent */ - const char *outgoing_description; /**< Shown when receied */ - const char *icon_name; /**< Icon to display (optional) */ - const char *unlocalized_name; /**< Unlocalized name for UIs needing it */ - - /* Reserved fields for future purposes */ - gpointer _reserved2; - gpointer _reserved3; - gpointer _reserved4; -}; - /** * Protocol options * @@ -680,8 +663,8 @@ * should be the same string as @a ulname, with localization. * @param inc_desc A localized description shown when the event is received. * @param out_desc A localized description shown when the event is sent. + * * @return A pointer to the new object. - * @since 2.4.0 */ PurpleAttentionType *purple_attention_type_new(const char *ulname, const char *name, const char *inc_desc, const char *out_desc); @@ -693,7 +676,6 @@ * @param name The localized name that will be displayed by UIs. This should be * the same string given as the unlocalized name, but with * localization. - * @since 2.4.0 */ void purple_attention_type_set_name(PurpleAttentionType *type, const char *name); @@ -703,7 +685,6 @@ * * @param type The attention type. * @param desc The localized description for incoming events. - * @since 2.4.0 */ void purple_attention_type_set_incoming_desc(PurpleAttentionType *type, const char *desc); @@ -713,7 +694,6 @@ * * @param type The attention type. * @param desc The localized description for outgoing events. - * @since 2.4.0 */ void purple_attention_type_set_outgoing_desc(PurpleAttentionType *type, const char *desc); @@ -723,7 +703,6 @@ * @param type The attention type. * @param name The icon's name. * @note Icons are optional for attention events. - * @since 2.4.0 */ void purple_attention_type_set_icon_name(PurpleAttentionType *type, const char *name); @@ -734,7 +713,6 @@ * @param type The attention type. * @param ulname The unlocalized name. This should be the same string given as * the localized name, but without localization. - * @since 2.4.0 */ void purple_attention_type_set_unlocalized_name(PurpleAttentionType *type, const char *ulname); @@ -742,8 +720,8 @@ * Get the attention type's name as displayed by the UI. * * @param type The attention type. + * * @return The name. - * @since 2.4.0 */ const char *purple_attention_type_get_name(const PurpleAttentionType *type); @@ -752,7 +730,6 @@ * * @param type The attention type. * @return The description. - * @since 2.4.0 */ const char *purple_attention_type_get_incoming_desc(const PurpleAttentionType *type); @@ -761,7 +738,6 @@ * * @param type The attention type. * @return The description. - * @since 2.4.0 */ const char *purple_attention_type_get_outgoing_desc(const PurpleAttentionType *type); @@ -771,7 +747,6 @@ * @param type The attention type. * @return The icon name or @c NULL if unset/empty. * @note Icons are optional for attention events. - * @since 2.4.0 */ const char *purple_attention_type_get_icon_name(const PurpleAttentionType *type); @@ -780,7 +755,6 @@ * * @param type The attention type * @return The unlocalized name. - * @since 2.4.0 */ const char *purple_attention_type_get_unlocalized_name(const PurpleAttentionType *type); diff -r b814c2878d12 -r d66ce874075a libpurple/server.c --- a/libpurple/server.c Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/server.c Fri Sep 02 18:57:04 2011 +0000 @@ -325,18 +325,6 @@ return attn; } -void -serv_send_attention(PurpleConnection *gc, const char *who, guint type_code) -{ - purple_prpl_send_attention(gc, who, type_code); -} - -void -serv_got_attention(PurpleConnection *gc, const char *who, guint type_code) -{ - purple_prpl_got_attention(gc, who, type_code); -} - /* * Move a buddy from one group to another on server. diff -r b814c2878d12 -r d66ce874075a libpurple/server.h --- a/libpurple/server.h Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/server.h Fri Sep 02 18:57:04 2011 +0000 @@ -61,32 +61,6 @@ */ PurpleAttentionType *purple_get_attention_type_from_code(PurpleAccount *account, guint type_code); -/** Send an attention request message. - * - * @deprecated Use purple_prpl_send_attention() instead. - * - * @param gc The connection to send the message on. - * @param who Whose attention to request. - * @param type_code An index into the prpl's attention_types list determining the type - * of the attention request command to send. 0 if prpl only defines one - * (for example, Yahoo and MSN), but some protocols define more (MySpaceIM). - * - * Note that you can't send arbitrary PurpleAttentionType's, because there is - * only a fixed set of attention commands. - */ -void serv_send_attention(PurpleConnection *gc, const char *who, guint type_code); - -/** Process an incoming attention message. - * - * @deprecated Use purple_prpl_got_attention() instead. - * - * @param gc The connection that received the attention message. - * @param who Who requested your attention. - * @param type_code An index into the prpl's attention_types list determining the type - * of the attention request command to send. - */ -void serv_got_attention(PurpleConnection *gc, const char *who, guint type_code); - void serv_get_info(PurpleConnection *, const char *); void serv_set_info(PurpleConnection *, const char *); diff -r b814c2878d12 -r d66ce874075a libpurple/status.c --- a/libpurple/status.c Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/status.c Fri Sep 02 18:57:04 2011 +0000 @@ -257,6 +257,42 @@ user_settable, FALSE); } +static void +status_type_add_attr(PurpleStatusType *status_type, const char *id, + const char *name, PurpleValue *value) +{ + PurpleStatusAttr *attr; + + g_return_if_fail(status_type != NULL); + g_return_if_fail(id != NULL); + g_return_if_fail(name != NULL); + g_return_if_fail(value != NULL); + + attr = purple_status_attr_new(id, name, value); + + status_type->attrs = g_list_append(status_type->attrs, attr); +} + +static void +status_type_add_attrs_vargs(PurpleStatusType *status_type, va_list args) +{ + const char *id, *name; + PurpleValue *value; + + g_return_if_fail(status_type != NULL); + + while ((id = va_arg(args, const char *)) != NULL) + { + name = va_arg(args, const char *); + g_return_if_fail(name != NULL); + + value = va_arg(args, PurpleValue *); + g_return_if_fail(value != NULL); + + status_type_add_attr(status_type, id, name, value); + } +} + PurpleStatusType * purple_status_type_new_with_attrs(PurpleStatusPrimitive primitive, const char *id, const char *name, @@ -277,10 +313,10 @@ user_settable, independent); /* Add the first attribute */ - purple_status_type_add_attr(status_type, attr_id, attr_name, attr_value); + status_type_add_attr(status_type, attr_id, attr_name, attr_value); va_start(args, attr_value); - purple_status_type_add_attrs_vargs(status_type, args); + status_type_add_attrs_vargs(status_type, args); va_end(args); return status_type; @@ -301,61 +337,6 @@ g_free(status_type); } -void -purple_status_type_add_attr(PurpleStatusType *status_type, const char *id, - const char *name, PurpleValue *value) -{ - PurpleStatusAttr *attr; - - g_return_if_fail(status_type != NULL); - g_return_if_fail(id != NULL); - g_return_if_fail(name != NULL); - g_return_if_fail(value != NULL); - - attr = purple_status_attr_new(id, name, value); - - status_type->attrs = g_list_append(status_type->attrs, attr); -} - -void -purple_status_type_add_attrs_vargs(PurpleStatusType *status_type, va_list args) -{ - const char *id, *name; - PurpleValue *value; - - g_return_if_fail(status_type != NULL); - - while ((id = va_arg(args, const char *)) != NULL) - { - name = va_arg(args, const char *); - g_return_if_fail(name != NULL); - - value = va_arg(args, PurpleValue *); - g_return_if_fail(value != NULL); - - purple_status_type_add_attr(status_type, id, name, value); - } -} - -void -purple_status_type_add_attrs(PurpleStatusType *status_type, const char *id, - const char *name, PurpleValue *value, ...) -{ - va_list args; - - g_return_if_fail(status_type != NULL); - g_return_if_fail(id != NULL); - g_return_if_fail(name != NULL); - g_return_if_fail(value != NULL); - - /* Add the first attribute */ - purple_status_type_add_attr(status_type, id, name, value); - - va_start(args, value); - purple_status_type_add_attrs_vargs(status_type, args); - va_end(args); -} - PurpleStatusPrimitive purple_status_type_get_primitive(const PurpleStatusType *status_type) { @@ -687,6 +668,68 @@ notify_status_update(presence, old_status, status); } +static void +status_set_attr_boolean(PurpleStatus *status, const char *id, + gboolean value) +{ + PurpleValue *attr_value; + + g_return_if_fail(status != NULL); + g_return_if_fail(id != NULL); + + /* Make sure this attribute exists and is the correct type. */ + attr_value = purple_status_get_attr_value(status, id); + g_return_if_fail(attr_value != NULL); + g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_BOOLEAN); + + purple_value_set_boolean(attr_value, value); +} + +static void +status_set_attr_int(PurpleStatus *status, const char *id, int value) +{ + PurpleValue *attr_value; + + g_return_if_fail(status != NULL); + g_return_if_fail(id != NULL); + + /* Make sure this attribute exists and is the correct type. */ + attr_value = purple_status_get_attr_value(status, id); + g_return_if_fail(attr_value != NULL); + g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_INT); + + purple_value_set_int(attr_value, value); +} + +static void +status_set_attr_string(PurpleStatus *status, const char *id, + const char *value) +{ + PurpleValue *attr_value; + + g_return_if_fail(status != NULL); + g_return_if_fail(id != NULL); + + /* Make sure this attribute exists and is the correct type. */ + attr_value = purple_status_get_attr_value(status, id); + /* This used to be g_return_if_fail, but it's failing a LOT, so + * let's generate a log error for now. */ + /* g_return_if_fail(attr_value != NULL); */ + if (attr_value == NULL) { + purple_debug_error("status", + "Attempted to set status attribute '%s' for " + "status '%s', which is not legal. Fix " + "this!\n", id, + purple_status_type_get_name(purple_status_get_type(status))); + return; + } + g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_STRING); + + /* XXX: Check if the value has actually changed. If it has, and the status + * is active, should this trigger 'status_has_changed'? */ + purple_value_set_string(attr_value, value); +} + void purple_status_set_active(PurpleStatus *status, gboolean active) { @@ -769,7 +812,7 @@ l = l->next; if (purple_strequal(string_data, purple_value_get_string(value))) continue; - purple_status_set_attr_string(status, id, string_data); + status_set_attr_string(status, id, string_data); changed = TRUE; } else if (purple_value_get_type(value) == PURPLE_TYPE_INT) @@ -778,7 +821,7 @@ l = l->next; if (int_data == purple_value_get_int(value)) continue; - purple_status_set_attr_int(status, id, int_data); + status_set_attr_int(status, id, int_data); changed = TRUE; } else if (purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN) @@ -787,7 +830,7 @@ l = l->next; if (boolean_data == purple_value_get_boolean(value)) continue; - purple_status_set_attr_boolean(status, id, boolean_data); + status_set_attr_boolean(status, id, boolean_data); changed = TRUE; } else @@ -818,21 +861,21 @@ continue; } - purple_status_set_attr_string(status, attr->id, def); + status_set_attr_string(status, attr->id, def); } else if (purple_value_get_type(default_value) == PURPLE_TYPE_INT) { int cur = purple_status_get_attr_int(status, attr->id); int def = purple_value_get_int(default_value); if (cur == def) continue; - purple_status_set_attr_int(status, attr->id, def); + status_set_attr_int(status, attr->id, def); } else if (purple_value_get_type(default_value) == PURPLE_TYPE_BOOLEAN) { gboolean cur = purple_status_get_attr_boolean(status, attr->id); gboolean def = purple_value_get_boolean(default_value); if (cur == def) continue; - purple_status_set_attr_boolean(status, attr->id, def); + status_set_attr_boolean(status, attr->id, def); } changed = TRUE; } @@ -844,68 +887,6 @@ status_has_changed(status); } -void -purple_status_set_attr_boolean(PurpleStatus *status, const char *id, - gboolean value) -{ - PurpleValue *attr_value; - - g_return_if_fail(status != NULL); - g_return_if_fail(id != NULL); - - /* Make sure this attribute exists and is the correct type. */ - attr_value = purple_status_get_attr_value(status, id); - g_return_if_fail(attr_value != NULL); - g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_BOOLEAN); - - purple_value_set_boolean(attr_value, value); -} - -void -purple_status_set_attr_int(PurpleStatus *status, const char *id, int value) -{ - PurpleValue *attr_value; - - g_return_if_fail(status != NULL); - g_return_if_fail(id != NULL); - - /* Make sure this attribute exists and is the correct type. */ - attr_value = purple_status_get_attr_value(status, id); - g_return_if_fail(attr_value != NULL); - g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_INT); - - purple_value_set_int(attr_value, value); -} - -void -purple_status_set_attr_string(PurpleStatus *status, const char *id, - const char *value) -{ - PurpleValue *attr_value; - - g_return_if_fail(status != NULL); - g_return_if_fail(id != NULL); - - /* Make sure this attribute exists and is the correct type. */ - attr_value = purple_status_get_attr_value(status, id); - /* This used to be g_return_if_fail, but it's failing a LOT, so - * let's generate a log error for now. */ - /* g_return_if_fail(attr_value != NULL); */ - if (attr_value == NULL) { - purple_debug_error("status", - "Attempted to set status attribute '%s' for " - "status '%s', which is not legal. Fix " - "this!\n", id, - purple_status_type_get_name(purple_status_get_type(status))); - return; - } - g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_STRING); - - /* XXX: Check if the value has actually changed. If it has, and the status - * is active, should this trigger 'status_has_changed'? */ - purple_value_set_string(attr_value, value); -} - PurpleStatusType * purple_status_get_type(const PurpleStatus *status) { @@ -1167,30 +1148,6 @@ } void -purple_presence_add_status(PurplePresence *presence, PurpleStatus *status) -{ - g_return_if_fail(presence != NULL); - g_return_if_fail(status != NULL); - - presence->statuses = g_list_append(presence->statuses, status); - - g_hash_table_insert(presence->status_table, - g_strdup(purple_status_get_id(status)), status); -} - -void -purple_presence_add_list(PurplePresence *presence, GList *source_list) -{ - GList *l; - - g_return_if_fail(presence != NULL); - g_return_if_fail(source_list != NULL); - - for (l = source_list; l != NULL; l = l->next) - purple_presence_add_status(presence, (PurpleStatus *)l->data); -} - -void purple_presence_set_status_active(PurplePresence *presence, const char *status_id, gboolean active) { diff -r b814c2878d12 -r d66ce874075a libpurple/status.h --- a/libpurple/status.h Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/status.h Fri Sep 02 18:57:04 2011 +0000 @@ -271,56 +271,6 @@ */ void purple_status_type_destroy(PurpleStatusType *status_type); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds an attribute to a status type. - * - * @param status_type The status type to add the attribute to. - * @param id The ID of the attribute. - * @param name The name presented to the user. - * @param value The value type of this attribute. - * - * @deprecated This function isn't needed and should be removed in 3.0.0. - * Status type attributes should be set when the status type - * is created, in the call to purple_status_type_new_with_attrs. - */ -void purple_status_type_add_attr(PurpleStatusType *status_type, const char *id, - const char *name, PurpleValue *value); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds multiple attributes to a status type. - * - * @param status_type The status type to add the attribute to. - * @param id The ID of the first attribute. - * @param name The description of the first attribute. - * @param value The value type of the first attribute attribute. - * @param ... Additional attribute information. - * - * @deprecated This function isn't needed and should be removed in 3.0.0. - * Status type attributes should be set when the status type - * is created, in the call to purple_status_type_new_with_attrs. - */ -void purple_status_type_add_attrs(PurpleStatusType *status_type, const char *id, - const char *name, PurpleValue *value, ...) G_GNUC_NULL_TERMINATED; -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds multiple attributes to a status type using a va_list. - * - * @param status_type The status type to add the attribute to. - * @param args The va_list of attributes. - * - * @deprecated This function isn't needed and should be removed in 3.0.0. - * Status type attributes should be set when the status type - * is created, in the call to purple_status_type_new_with_attrs. - */ -void purple_status_type_add_attrs_vargs(PurpleStatusType *status_type, - va_list args); -#endif - /** * Returns the primitive type of a status type. * @@ -552,51 +502,6 @@ void purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active, GList *attrs); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Sets the boolean value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * @param value The boolean value. - * - * @deprecated This function is only used by status.c and should be made - * static in 3.0.0. - */ -void purple_status_set_attr_boolean(PurpleStatus *status, const char *id, - gboolean value); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Sets the integer value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * @param value The integer value. - * - * @deprecated This function is only used by status.c and should be made - * static in 3.0.0. - */ -void purple_status_set_attr_int(PurpleStatus *status, const char *id, - int value); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Sets the string value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * @param value The string value. - * - * @deprecated This function is only used by status.c and should be made - * static in 3.0.0. - */ -void purple_status_set_attr_string(PurpleStatus *status, const char *id, - const char *value); -#endif - /** * Returns the status's type. * @@ -803,32 +708,6 @@ */ void purple_presence_destroy(PurplePresence *presence); -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds a status to a presence. - * - * @param presence The presence. - * @param status The status to add. - * - * @deprecated This function is only used by purple_presence_add_list, - * and both should be removed in 3.0.0. - */ -void purple_presence_add_status(PurplePresence *presence, PurpleStatus *status); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds a list of statuses to the presence. - * - * @param presence The presence. - * @param source_list The source list of statuses to add, which is not - * modified or freed by this function. - * - * @deprecated This function isn't used and should be removed in 3.0.0. - */ -void purple_presence_add_list(PurplePresence *presence, GList *source_list); -#endif - /** * Sets the active state of a status in a presence. * diff -r b814c2878d12 -r d66ce874075a libpurple/stun.c --- a/libpurple/stun.c Thu Sep 01 18:26:08 2011 +0000 +++ b/libpurple/stun.c Fri Sep 02 18:57:04 2011 +0000 @@ -365,7 +365,7 @@ purple_debug_info("stun", "got %d SRV responses, server: %s, port: %d\n", results, servername, port); - purple_dnsquery_a_account(NULL, servername, port, hbn_cb, NULL); + purple_dnsquery_a(NULL, servername, port, hbn_cb, NULL); g_free(resp); } @@ -424,7 +424,7 @@ nattype.servername = g_strdup(servername); callbacks = g_slist_append(callbacks, cb); - purple_srv_resolve_account(NULL, "stun", "udp", servername, do_test1, + purple_srv_resolve(NULL, "stun", "udp", servername, do_test1, (gpointer) servername); return &nattype; diff -r b814c2878d12 -r d66ce874075a pidgin/Makefile.am --- a/pidgin/Makefile.am Thu Sep 01 18:26:08 2011 +0000 +++ b/pidgin/Makefile.am Fri Sep 02 18:57:04 2011 +0000 @@ -52,7 +52,6 @@ gtkdialogs.c \ gtkdnd-hints.c \ gtkdocklet.c \ - gtkdocklet-gtk.c \ gtkeventloop.c \ gtkft.c \ gtkicon-theme.c \ @@ -181,3 +180,4 @@ $(LIBXML_CFLAGS) \ $(INTGG_CFLAGS) endif # ENABLE_GTK + diff -r b814c2878d12 -r d66ce874075a pidgin/gtkcertmgr.c --- a/pidgin/gtkcertmgr.c Thu Sep 01 18:26:08 2011 +0000 +++ b/pidgin/gtkcertmgr.c Fri Sep 02 18:57:04 2011 +0000 @@ -333,6 +333,12 @@ } static void +tls_peers_mgmt_activated_cb(GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *column, gpointer data) +{ + tls_peers_mgmt_info_cb(NULL, NULL); +} + +static void tls_peers_mgmt_delete_confirm_cb(gchar *id, gint choice) { if (1 == choice) { @@ -452,6 +458,9 @@ g_signal_connect(G_OBJECT(select), "changed", G_CALLBACK(tls_peers_mgmt_select_chg_cb), NULL); + g_signal_connect(G_OBJECT(listview), "row-activated", + G_CALLBACK(tls_peers_mgmt_activated_cb), NULL); + gtk_box_pack_start(GTK_BOX(mgmt_widget), pidgin_make_scrollable(GTK_WIDGET(listview), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS, GTK_SHADOW_IN, -1, -1), TRUE, TRUE, /* Take up lots of space */ @@ -471,9 +480,8 @@ gtk_widget_show(bbox); /* Import button */ - /* TODO: This is the wrong stock button */ tpm_dat->importbutton = importbutton = - gtk_button_new_from_stock(GTK_STOCK_ADD); + gtk_button_new_from_stock(GTK_STOCK_OPEN); gtk_box_pack_start(GTK_BOX(bbox), importbutton, FALSE, FALSE, 0); gtk_widget_show(importbutton); g_signal_connect(G_OBJECT(importbutton), "clicked", @@ -481,9 +489,8 @@ /* Export button */ - /* TODO: This is the wrong stock button */ tpm_dat->exportbutton = exportbutton = - gtk_button_new_from_stock(GTK_STOCK_SAVE); + gtk_button_new_from_stock(GTK_STOCK_SAVE_AS); gtk_box_pack_start(GTK_BOX(bbox), exportbutton, FALSE, FALSE, 0); gtk_widget_show(exportbutton); g_signal_connect(G_OBJECT(exportbutton), "clicked", diff -r b814c2878d12 -r d66ce874075a pidgin/gtkconv.c --- a/pidgin/gtkconv.c Thu Sep 01 18:26:08 2011 +0000 +++ b/pidgin/gtkconv.c Fri Sep 02 18:57:04 2011 +0000 @@ -74,6 +74,39 @@ #include "gtknickcolors.h" +/** + * A GTK+ Instant Message pane. + */ +struct _PidginImPane +{ + GtkWidget *block; + GtkWidget *send_file; + GtkWidget *sep1; + GtkWidget *sep2; + GtkWidget *check; + GtkWidget *progress; + guint32 typing_timer; + + /* Buddy icon stuff */ + GtkWidget *icon_container; + GtkWidget *icon; + gboolean show_icon; + gboolean animate; + GdkPixbufAnimation *anim; + GdkPixbufAnimationIter *iter; + guint32 icon_timer; +}; + +/** + * GTK+ Chat panes. + */ +struct _PidginChatPane +{ + GtkWidget *count; + GtkWidget *list; + GtkWidget *topic_text; +}; + #define CLOSE_CONV_TIMEOUT_SECS (10 * 60) #define AUTO_RESPONSE "<AUTO-REPLY> : " diff -r b814c2878d12 -r d66ce874075a pidgin/gtkconv.h --- a/pidgin/gtkconv.h Thu Sep 01 18:26:08 2011 +0000 +++ b/pidgin/gtkconv.h Fri Sep 02 18:57:04 2011 +0000 @@ -77,39 +77,6 @@ */ /** - * A GTK+ Instant Message pane. - */ -struct _PidginImPane -{ - GtkWidget *block; - GtkWidget *send_file; - GtkWidget *sep1; - GtkWidget *sep2; - GtkWidget *check; - GtkWidget *progress; - guint32 typing_timer; - - /* Buddy icon stuff */ - GtkWidget *icon_container; - GtkWidget *icon; - gboolean show_icon; - gboolean animate; - GdkPixbufAnimation *anim; - GdkPixbufAnimationIter *iter; - guint32 icon_timer; -}; - -/** - * GTK+ Chat panes. - */ -struct _PidginChatPane -{ - GtkWidget *count; - GtkWidget *list; - GtkWidget *topic_text; -}; - -/** * A GTK+ conversation pane. */ struct _PidginConversation diff -r b814c2878d12 -r d66ce874075a pidgin/gtkdocklet-gtk.c --- a/pidgin/gtkdocklet-gtk.c Thu Sep 01 18:26:08 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,296 +0,0 @@ -/* - * System tray icon (aka docklet) plugin for Purple - * - * Copyright (C) 2007 Anders Hasselqvist - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include "internal.h" -#include "pidgin.h" -#include "debug.h" -#include "prefs.h" -#include "pidginstock.h" -#include "gtkdocklet.h" - -#define SHORT_EMBED_TIMEOUT 5 -#define LONG_EMBED_TIMEOUT 15 - -/* globals */ -static GtkStatusIcon *docklet = NULL; -static guint embed_timeout = 0; - -/* protos */ -static void docklet_gtk_status_create(gboolean); - -static gboolean -docklet_gtk_recreate_cb(gpointer data) -{ - docklet_gtk_status_create(TRUE); - - return FALSE; -} - -static gboolean -docklet_gtk_embed_timeout_cb(gpointer data) -{ -#if !GTK_CHECK_VERSION(2,12,0) - if (gtk_status_icon_is_embedded(docklet)) { - /* Older GTK+ (<2.12) don't implement the embedded signal, but the - information is still accessable through the above function. */ - purple_debug_info("docklet", "embedded\n"); - - pidgin_docklet_embedded(); - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); - } - else -#endif - { - /* The docklet was not embedded within the timeout. - * Remove it as a visibility manager, but leave the plugin - * loaded so that it can embed automatically if/when a notification - * area becomes available. - */ - purple_debug_info("docklet", "failed to embed within timeout\n"); - pidgin_docklet_remove(); - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); - } - -#if GTK_CHECK_VERSION(2,12,0) - embed_timeout = 0; - return FALSE; -#else - return TRUE; -#endif -} - -#if GTK_CHECK_VERSION(2,12,0) -static gboolean -docklet_gtk_embedded_cb(GtkWidget *widget, gpointer data) -{ - if (embed_timeout) { - purple_timeout_remove(embed_timeout); - embed_timeout = 0; - } - - if (gtk_status_icon_is_embedded(docklet)) { - purple_debug_info("docklet", "embedded\n"); - - pidgin_docklet_embedded(); - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); - } else { - purple_debug_info("docklet", "detached\n"); - - pidgin_docklet_remove(); - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); - } - - return TRUE; -} -#endif - -static void -docklet_gtk_destroyed_cb(GtkWidget *widget, gpointer data) -{ - purple_debug_info("docklet", "destroyed\n"); - - pidgin_docklet_remove(); - - g_object_unref(G_OBJECT(docklet)); - docklet = NULL; - - g_idle_add(docklet_gtk_recreate_cb, NULL); -} - -static void -docklet_gtk_status_activated_cb(GtkStatusIcon *status_icon, gpointer user_data) -{ - pidgin_docklet_clicked(1); -} - -static void -docklet_gtk_status_clicked_cb(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data) -{ - purple_debug_info("docklet", "The button is %u\n", button); -#ifdef GDK_WINDOWING_QUARTZ - /* You can only click left mouse button on MacOSX native GTK. Let that be the menu */ - pidgin_docklet_clicked(3); -#else - pidgin_docklet_clicked(button); -#endif -} - -static void -docklet_gtk_status_update_icon(PurpleStatusPrimitive status, gboolean connecting, gboolean pending) -{ - const gchar *icon_name = NULL; - - switch (status) { - case PURPLE_STATUS_OFFLINE: - icon_name = PIDGIN_STOCK_TRAY_OFFLINE; - break; - case PURPLE_STATUS_AWAY: - icon_name = PIDGIN_STOCK_TRAY_AWAY; - break; - case PURPLE_STATUS_UNAVAILABLE: - icon_name = PIDGIN_STOCK_TRAY_BUSY; - break; - case PURPLE_STATUS_EXTENDED_AWAY: - icon_name = PIDGIN_STOCK_TRAY_XA; - break; - case PURPLE_STATUS_INVISIBLE: - icon_name = PIDGIN_STOCK_TRAY_INVISIBLE; - break; - default: - icon_name = PIDGIN_STOCK_TRAY_AVAILABLE; - break; - } - - if (pending) - icon_name = PIDGIN_STOCK_TRAY_PENDING; - if (connecting) - icon_name = PIDGIN_STOCK_TRAY_CONNECT; - - if (icon_name) { - gtk_status_icon_set_from_icon_name(docklet, icon_name); - } - - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink")) { - gtk_status_icon_set_blinking(docklet, (pending && !connecting)); - } else if (gtk_status_icon_get_blinking(docklet)) { - gtk_status_icon_set_blinking(docklet, FALSE); - } -} - -static void -docklet_gtk_status_set_tooltip(gchar *tooltip) -{ - gtk_status_icon_set_tooltip(docklet, tooltip); -} - -static void -docklet_gtk_status_position_menu(GtkMenu *menu, - int *x, int *y, gboolean *push_in, - gpointer user_data) -{ - gtk_status_icon_position_menu(menu, x, y, push_in, docklet); -} - -static void -docklet_gtk_status_destroy(void) -{ - g_return_if_fail(docklet != NULL); - - pidgin_docklet_remove(); - - if (embed_timeout) { - purple_timeout_remove(embed_timeout); - embed_timeout = 0; - } - - gtk_status_icon_set_visible(docklet, FALSE); - g_signal_handlers_disconnect_by_func(G_OBJECT(docklet), G_CALLBACK(docklet_gtk_destroyed_cb), NULL); - g_object_unref(G_OBJECT(docklet)); - docklet = NULL; - - purple_debug_info("docklet", "GTK+ destroyed\n"); -} - -static void -docklet_gtk_status_create(gboolean recreate) -{ - if (docklet) { - /* if this is being called when a tray icon exists, it's because - something messed up. try destroying it before we proceed, - although docklet_refcount may be all hosed. hopefully won't happen. */ - purple_debug_warning("docklet", "trying to create icon but it already exists?\n"); - docklet_gtk_status_destroy(); - } - - docklet = gtk_status_icon_new(); - g_return_if_fail(docklet != NULL); - - g_signal_connect(G_OBJECT(docklet), "activate", G_CALLBACK(docklet_gtk_status_activated_cb), NULL); - g_signal_connect(G_OBJECT(docklet), "popup-menu", G_CALLBACK(docklet_gtk_status_clicked_cb), NULL); -#if GTK_CHECK_VERSION(2,12,0) - g_signal_connect(G_OBJECT(docklet), "notify::embedded", G_CALLBACK(docklet_gtk_embedded_cb), NULL); -#endif - g_signal_connect(G_OBJECT(docklet), "destroy", G_CALLBACK(docklet_gtk_destroyed_cb), NULL); - - gtk_status_icon_set_visible(docklet, TRUE); - - /* This is a hack to avoid a race condition between the docklet getting - * embedded in the notification area and the gtkblist restoring its - * previous visibility state. If the docklet does not get embedded within - * the timeout, it will be removed as a visibility manager until it does - * get embedded. Ideally, we would only call docklet_embedded() when the - * icon was actually embedded. This only happens when the docklet is first - * created, not when being recreated. - * - * The gtk docklet tracks whether it successfully embedded in a pref and - * allows for a longer timeout period if it successfully embedded the last - * time it was run. This should hopefully solve problems with the buddy - * list not properly starting hidden when Pidgin is started on login. - */ - if (!recreate) { - pidgin_docklet_embedded(); -#if GTK_CHECK_VERSION(2,12,0) - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded")) { - embed_timeout = purple_timeout_add_seconds(LONG_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); - } else { - embed_timeout = purple_timeout_add_seconds(SHORT_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); - } -#else - embed_timeout = purple_timeout_add_seconds(SHORT_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); -#endif - } - - purple_debug_info("docklet", "GTK+ created\n"); -} - -static void -docklet_gtk_status_create_ui_op(void) -{ - docklet_gtk_status_create(FALSE); -} - -static struct docklet_ui_ops ui_ops = -{ - docklet_gtk_status_create_ui_op, - docklet_gtk_status_destroy, - docklet_gtk_status_update_icon, - NULL, - docklet_gtk_status_set_tooltip, - docklet_gtk_status_position_menu -}; - -void -docklet_ui_init(void) -{ - pidgin_docklet_set_ui_ops(&ui_ops); - - purple_prefs_add_none(PIDGIN_PREFS_ROOT "/docklet/gtk"); - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/x11/embedded")) { - purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); - purple_prefs_remove(PIDGIN_PREFS_ROOT "/docklet/x11/embedded"); - } else { - purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); - } - - gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), - DATADIR G_DIR_SEPARATOR_S "pixmaps" G_DIR_SEPARATOR_S "pidgin" G_DIR_SEPARATOR_S "tray"); -} - diff -r b814c2878d12 -r d66ce874075a pidgin/gtkdocklet.c --- a/pidgin/gtkdocklet.c Thu Sep 01 18:26:08 2011 +0000 +++ b/pidgin/gtkdocklet.c Fri Sep 02 18:57:04 2011 +0000 @@ -30,6 +30,7 @@ #include "prefs.h" #include "signals.h" #include "sound.h" +#include "status.h" #include "gtkaccount.h" #include "gtkblist.h" @@ -48,8 +49,12 @@ #define DOCKLET_TOOLTIP_LINE_LIMIT 5 #endif +#define SHORT_EMBED_TIMEOUT 5 +#define LONG_EMBED_TIMEOUT 15 + /* globals */ -static struct docklet_ui_ops *ui_ops = NULL; +static GtkStatusIcon *docklet = NULL; +static guint embed_timeout = 0; static PurpleStatusPrimitive status = PURPLE_STATUS_OFFLINE; static gboolean pending = FALSE; static gboolean connecting = FALSE; @@ -58,9 +63,55 @@ static gboolean visible = FALSE; static gboolean visibility_manager = FALSE; +/* protos */ +static void docklet_gtk_status_create(gboolean); +static void docklet_gtk_status_destroy(void); + /************************************************************************** * docklet status and utility functions **************************************************************************/ +static void +docklet_gtk_status_update_icon(PurpleStatusPrimitive status, gboolean connecting, gboolean pending) +{ + const gchar *icon_name = NULL; + + switch (status) { + case PURPLE_STATUS_OFFLINE: + icon_name = PIDGIN_STOCK_TRAY_OFFLINE; + break; + case PURPLE_STATUS_AWAY: + icon_name = PIDGIN_STOCK_TRAY_AWAY; + break; + case PURPLE_STATUS_UNAVAILABLE: + icon_name = PIDGIN_STOCK_TRAY_BUSY; + break; + case PURPLE_STATUS_EXTENDED_AWAY: + icon_name = PIDGIN_STOCK_TRAY_XA; + break; + case PURPLE_STATUS_INVISIBLE: + icon_name = PIDGIN_STOCK_TRAY_INVISIBLE; + break; + default: + icon_name = PIDGIN_STOCK_TRAY_AVAILABLE; + break; + } + + if (pending) + icon_name = PIDGIN_STOCK_TRAY_PENDING; + if (connecting) + icon_name = PIDGIN_STOCK_TRAY_CONNECT; + + if (icon_name) { + gtk_status_icon_set_from_icon_name(docklet, icon_name); + } + + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink")) { + gtk_status_icon_set_blinking(docklet, (pending && !connecting)); + } else if (gtk_status_icon_get_blinking(docklet)) { + gtk_status_icon_set_blinking(docklet, FALSE); + } +} + static gboolean docklet_blink_icon(gpointer data) { @@ -70,11 +121,8 @@ blinked = !blinked; if(pending && !connecting) { - if (blinked) { - if (ui_ops && ui_ops->blank_icon) - ui_ops->blank_icon(); - } else { - pidgin_docklet_update_icon(); + if (!blinked) { + docklet_gtk_status_update_icon(status, connecting, pending); } ret = TRUE; /* keep blinking */ } else { @@ -126,12 +174,12 @@ convs = get_pending_list(DOCKLET_TOOLTIP_LINE_LIMIT); if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "pending")) { - if (convs && ui_ops->create && !visible) { + if (convs && !visible) { g_list_free(convs); - ui_ops->create(); + docklet_gtk_status_create(FALSE); return FALSE; - } else if (!convs && ui_ops->destroy && visible) { - ui_ops->destroy(); + } else if (!convs && visible) { + docklet_gtk_status_destroy(); return FALSE; } } @@ -142,46 +190,43 @@ } if (convs != NULL) { + /* set tooltip if messages are pending */ + GString *tooltip_text = g_string_new(""); newpending = TRUE; - /* set tooltip if messages are pending */ - if (ui_ops->set_tooltip) { - GString *tooltip_text = g_string_new(""); - for (l = convs, count = 0 ; l != NULL ; l = l->next, count++) { - PurpleConversation *conv = (PurpleConversation *)l->data; - PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); + for (l = convs, count = 0 ; l != NULL ; l = l->next, count++) { + PurpleConversation *conv = (PurpleConversation *)l->data; + PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); - if (count == DOCKLET_TOOLTIP_LINE_LIMIT - 1) { - g_string_append(tooltip_text, _("Right-click for more unread messages...\n")); - } else if(gtkconv) { - g_string_append_printf(tooltip_text, - ngettext("%d unread message from %s\n", "%d unread messages from %s\n", gtkconv->unseen_count), - gtkconv->unseen_count, - purple_conversation_get_title(conv)); - } else { - g_string_append_printf(tooltip_text, - ngettext("%d unread message from %s\n", "%d unread messages from %s\n", - GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count"))), - GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count")), - purple_conversation_get_title(conv)); - } + if (count == DOCKLET_TOOLTIP_LINE_LIMIT - 1) { + g_string_append(tooltip_text, _("Right-click for more unread messages...\n")); + } else if(gtkconv) { + g_string_append_printf(tooltip_text, + ngettext("%d unread message from %s\n", "%d unread messages from %s\n", gtkconv->unseen_count), + gtkconv->unseen_count, + purple_conversation_get_title(conv)); + } else { + g_string_append_printf(tooltip_text, + ngettext("%d unread message from %s\n", "%d unread messages from %s\n", + GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count"))), + GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count")), + purple_conversation_get_title(conv)); } - - /* get rid of the last newline */ - if (tooltip_text->len > 0) - tooltip_text = g_string_truncate(tooltip_text, tooltip_text->len - 1); - - ui_ops->set_tooltip(tooltip_text->str); - - g_string_free(tooltip_text, TRUE); } + /* get rid of the last newline */ + if (tooltip_text->len > 0) + tooltip_text = g_string_truncate(tooltip_text, tooltip_text->len - 1); + + gtk_status_icon_set_tooltip(docklet, tooltip_text->str); + + g_string_free(tooltip_text, TRUE); g_list_free(convs); - } else if (ui_ops->set_tooltip) { + } else { char *tooltip_text = g_strconcat(PIDGIN_NAME, " - ", purple_savedstatus_get_title(saved_status), NULL); - ui_ops->set_tooltip(tooltip_text); + gtk_status_icon_set_tooltip(docklet, tooltip_text); g_free(tooltip_text); } @@ -207,7 +252,7 @@ pending = newpending; connecting = newconnecting; - pidgin_docklet_update_icon(); + docklet_gtk_status_update_icon(status, connecting, pending); /* and schedule the blinker function if messages are pending */ if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink") @@ -286,17 +331,15 @@ { const char *val = value; if (!strcmp(val, "always")) { - if (ui_ops->create) { - if (!visible) - ui_ops->create(); - else if (!visibility_manager) { - pidgin_blist_visibility_manager_add(); - visibility_manager = TRUE; - } + if (!visible) + docklet_gtk_status_create(FALSE); + else if (!visibility_manager) { + pidgin_blist_visibility_manager_add(); + visibility_manager = TRUE; } } else if (!strcmp(val, "never")) { - if (visible && ui_ops->destroy) - ui_ops->destroy(); + if (visible) + docklet_gtk_status_destroy(); } else { if (visibility_manager) { pidgin_blist_visibility_manager_remove(); @@ -750,21 +793,11 @@ #endif gtk_widget_show_all(menu); gtk_menu_popup(GTK_MENU(menu), NULL, NULL, - ui_ops->position_menu, - NULL, 0, gtk_get_current_event_time()); + gtk_status_icon_position_menu, + docklet, 0, gtk_get_current_event_time()); } -/************************************************************************** - * public api for ui_ops - **************************************************************************/ -void -pidgin_docklet_update_icon() -{ - if (ui_ops && ui_ops->update_icon) - ui_ops->update_icon(status, connecting, pending); -} - -void +static void pidgin_docklet_clicked(int button_type) { switch (button_type) { @@ -785,8 +818,8 @@ } } -void -pidgin_docklet_embedded() +static void +pidgin_docklet_embedded(void) { if (!visibility_manager && strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "pending")) { @@ -795,11 +828,11 @@ } visible = TRUE; docklet_update_status(); - pidgin_docklet_update_icon(); + docklet_gtk_status_update_icon(status, connecting, pending); } -void -pidgin_docklet_remove() +static void +pidgin_docklet_remove(void) { if (visible) { if (visibility_manager) { @@ -815,12 +848,179 @@ } } -void -pidgin_docklet_set_ui_ops(struct docklet_ui_ops *ops) +static gboolean +docklet_gtk_recreate_cb(gpointer data) +{ + docklet_gtk_status_create(TRUE); + + return FALSE; +} + +static gboolean +docklet_gtk_embed_timeout_cb(gpointer data) { - ui_ops = ops; +#if !GTK_CHECK_VERSION(2,12,0) + if (gtk_status_icon_is_embedded(docklet)) { + /* Older GTK+ (<2.12) don't implement the embedded signal, but the + information is still accessible through the above function. */ + purple_debug_info("docklet", "embedded\n"); + + pidgin_docklet_embedded(); + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); + } + else +#endif + { + /* The docklet was not embedded within the timeout. + * Remove it as a visibility manager, but leave the plugin + * loaded so that it can embed automatically if/when a notification + * area becomes available. + */ + purple_debug_info("docklet", "failed to embed within timeout\n"); + pidgin_docklet_remove(); + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); + } + +#if GTK_CHECK_VERSION(2,12,0) + embed_timeout = 0; + return FALSE; +#else + return TRUE; +#endif +} + +#if GTK_CHECK_VERSION(2,12,0) +static gboolean +docklet_gtk_embedded_cb(GtkWidget *widget, gpointer data) +{ + if (embed_timeout) { + purple_timeout_remove(embed_timeout); + embed_timeout = 0; + } + + if (gtk_status_icon_is_embedded(docklet)) { + purple_debug_info("docklet", "embedded\n"); + + pidgin_docklet_embedded(); + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); + } else { + purple_debug_info("docklet", "detached\n"); + + pidgin_docklet_remove(); + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); + } + + return TRUE; +} +#endif + +static void +docklet_gtk_destroyed_cb(GtkWidget *widget, gpointer data) +{ + purple_debug_info("docklet", "destroyed\n"); + + pidgin_docklet_remove(); + + g_object_unref(G_OBJECT(docklet)); + docklet = NULL; + + g_idle_add(docklet_gtk_recreate_cb, NULL); +} + +static void +docklet_gtk_status_activated_cb(GtkStatusIcon *status_icon, gpointer user_data) +{ + pidgin_docklet_clicked(1); } +static void +docklet_gtk_status_clicked_cb(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data) +{ + purple_debug_info("docklet", "The button is %u\n", button); +#ifdef GDK_WINDOWING_QUARTZ + /* You can only click left mouse button on MacOSX native GTK. Let that be the menu */ + pidgin_docklet_clicked(3); +#else + pidgin_docklet_clicked(button); +#endif +} + +static void +docklet_gtk_status_destroy(void) +{ + g_return_if_fail(docklet != NULL); + + pidgin_docklet_remove(); + + if (embed_timeout) { + purple_timeout_remove(embed_timeout); + embed_timeout = 0; + } + + gtk_status_icon_set_visible(docklet, FALSE); + g_signal_handlers_disconnect_by_func(G_OBJECT(docklet), G_CALLBACK(docklet_gtk_destroyed_cb), NULL); + g_object_unref(G_OBJECT(docklet)); + docklet = NULL; + + purple_debug_info("docklet", "GTK+ destroyed\n"); +} + +static void +docklet_gtk_status_create(gboolean recreate) +{ + if (docklet) { + /* if this is being called when a tray icon exists, it's because + something messed up. try destroying it before we proceed, + although docklet_refcount may be all hosed. hopefully won't happen. */ + purple_debug_warning("docklet", "trying to create icon but it already exists?\n"); + docklet_gtk_status_destroy(); + } + + docklet = gtk_status_icon_new(); + g_return_if_fail(docklet != NULL); + + g_signal_connect(G_OBJECT(docklet), "activate", G_CALLBACK(docklet_gtk_status_activated_cb), NULL); + g_signal_connect(G_OBJECT(docklet), "popup-menu", G_CALLBACK(docklet_gtk_status_clicked_cb), NULL); +#if GTK_CHECK_VERSION(2,12,0) + g_signal_connect(G_OBJECT(docklet), "notify::embedded", G_CALLBACK(docklet_gtk_embedded_cb), NULL); +#endif + g_signal_connect(G_OBJECT(docklet), "destroy", G_CALLBACK(docklet_gtk_destroyed_cb), NULL); + + gtk_status_icon_set_visible(docklet, TRUE); + + /* This is a hack to avoid a race condition between the docklet getting + * embedded in the notification area and the gtkblist restoring its + * previous visibility state. If the docklet does not get embedded within + * the timeout, it will be removed as a visibility manager until it does + * get embedded. Ideally, we would only call docklet_embedded() when the + * icon was actually embedded. This only happens when the docklet is first + * created, not when being recreated. + * + * The gtk docklet tracks whether it successfully embedded in a pref and + * allows for a longer timeout period if it successfully embedded the last + * time it was run. This should hopefully solve problems with the buddy + * list not properly starting hidden when Pidgin is started on login. + */ + if (!recreate) { + pidgin_docklet_embedded(); +#if GTK_CHECK_VERSION(2,12,0) + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded")) { + embed_timeout = purple_timeout_add_seconds(LONG_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); + } else { + embed_timeout = purple_timeout_add_seconds(SHORT_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); + } +#else + embed_timeout = purple_timeout_add_seconds(SHORT_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); +#endif + } + + purple_debug_info("docklet", "GTK+ created\n"); +} + +/************************************************************************** + * public api + **************************************************************************/ + void* pidgin_docklet_get_handle() { @@ -843,9 +1043,19 @@ purple_prefs_connect_callback(docklet_handle, PIDGIN_PREFS_ROOT "/docklet/show", docklet_show_pref_changed_cb, NULL); - docklet_ui_init(); - if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "always") && ui_ops && ui_ops->create) - ui_ops->create(); + purple_prefs_add_none(PIDGIN_PREFS_ROOT "/docklet/gtk"); + if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/x11/embedded")) { + purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); + purple_prefs_remove(PIDGIN_PREFS_ROOT "/docklet/x11/embedded"); + } else { + purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); + } + + gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), + DATADIR G_DIR_SEPARATOR_S "pixmaps" G_DIR_SEPARATOR_S "pidgin" G_DIR_SEPARATOR_S "tray"); + + if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "always")) + docklet_gtk_status_create(FALSE); purple_signal_connect(conn_handle, "signed-on", docklet_handle, PURPLE_CALLBACK(docklet_signed_on_cb), NULL); @@ -874,6 +1084,7 @@ void pidgin_docklet_uninit() { - if (visible && ui_ops && ui_ops->destroy) - ui_ops->destroy(); + if (visible) + docklet_gtk_status_destroy(); } + diff -r b814c2878d12 -r d66ce874075a pidgin/gtkdocklet.h --- a/pidgin/gtkdocklet.h Thu Sep 01 18:26:08 2011 +0000 +++ b/pidgin/gtkdocklet.h Fri Sep 02 18:57:04 2011 +0000 @@ -25,31 +25,9 @@ #ifndef _GTKDOCKLET_H_ #define _GTKDOCKLET_H_ -#include "status.h" - -struct docklet_ui_ops -{ - void (*create)(void); - void (*destroy)(void); - void (*update_icon)(PurpleStatusPrimitive, gboolean, gboolean); - void (*blank_icon)(void); - void (*set_tooltip)(gchar *); - GtkMenuPositionFunc position_menu; -}; - - -/* functions in gtkdocklet.c */ -void pidgin_docklet_update_icon(void); -void pidgin_docklet_clicked(int); -void pidgin_docklet_embedded(void); -void pidgin_docklet_remove(void); -void pidgin_docklet_set_ui_ops(struct docklet_ui_ops *); -void pidgin_docklet_unload(void); void pidgin_docklet_init(void); void pidgin_docklet_uninit(void); void*pidgin_docklet_get_handle(void); -/* function in gtkdocklet-{gtk,x11,win32}.c */ -void docklet_ui_init(void); +#endif /* _GTKDOCKLET_H_ */ -#endif /* _GTKDOCKLET_H_ */