diff options
author | Siraj Razick <siraj.razick@collabora.co.uk> | 2012-01-20 18:22:24 -0500 |
---|---|---|
committer | Siraj Razick <siraj.razick@collabora.co.uk> | 2012-02-01 14:48:43 -0500 |
commit | 3e1d4d08094fa6b9d7d8ecfe5e0495f0379e5f3a (patch) | |
tree | 9e96f157567d2b8a7bc331d87473b2bdc7da118e | |
parent | 4f94ae6e1f8cadad7922ba9d669aac8fcdbf186a (diff) |
Updates the Code to match the New Gabble Plugin API
Use GabblePluginConnection instead of GabbleConnection
-rw-r--r-- | gabble/message-channel.c | 31 | ||||
-rw-r--r-- | gabble/message-channel.h | 4 | ||||
-rw-r--r-- | gabble/status.c | 18 | ||||
-rw-r--r-- | gabble/status.h | 4 | ||||
-rw-r--r-- | plugin-base/channel-manager.c | 8 | ||||
-rw-r--r-- | plugin-base/ytstenut.c | 16 |
6 files changed, 47 insertions, 34 deletions
diff --git a/gabble/message-channel.c b/gabble/message-channel.c index f72eddc..42925a6 100644 --- a/gabble/message-channel.c +++ b/gabble/message-channel.c @@ -23,11 +23,18 @@ #include "message-channel.h" #include <errno.h> -#include <netdb.h> #include <stdio.h> #include <stdlib.h> #include <string.h> + +#include <glib.h> + +#ifdef G_OS_WIN32 +#include <windows.h> +#else +#include <netdb.h> #include <sys/socket.h> +#endif #include <dbus/dbus-glib.h> #include <telepathy-glib/channel.h> @@ -49,7 +56,7 @@ #include <wocky/wocky-xmpp-error-enumtypes.h> #include <wocky/wocky-session.h> -#include <gabble/connection.h> +#include <gabble/plugin-connection.h> #define DEBUG(msg, ...) \ g_debug ("%s: " msg, G_STRFUNC, ##__VA_ARGS__) @@ -333,8 +340,8 @@ ytst_message_channel_close (TpBaseChannel *chan) { TpBaseConnection *conn = tp_base_channel_get_connection ( TP_BASE_CHANNEL (self)); - WockySession *session = gabble_connection_get_session ( - GABBLE_CONNECTION (conn)); + WockySession *session = gabble_plugin_connection_get_session ( + GABBLE_PLUGIN_CONNECTION (conn)); wocky_porter_send_iq_error ( wocky_session_get_porter (session), @@ -590,7 +597,7 @@ ytst_message_channel_request (TpYtsSvcChannel *channel, return; } - session = gabble_connection_get_session (GABBLE_CONNECTION ( + session = gabble_plugin_connection_get_session (GABBLE_PLUGIN_CONNECTION ( tp_base_channel_get_connection (TP_BASE_CHANNEL (self)))); wocky_porter_send_iq_async (wocky_session_get_porter (session), @@ -618,9 +625,9 @@ ytst_message_channel_reply (TpYtsSvcChannel *channel, { YtstMessageChannel *self = YTST_MESSAGE_CHANNEL (channel); YtstMessageChannelPrivate *priv = self->priv; - GabbleConnection *conn = GABBLE_CONNECTION (tp_base_channel_get_connection ( + GabblePluginConnection *conn = GABBLE_PLUGIN_CONNECTION (tp_base_channel_get_connection ( TP_BASE_CHANNEL (self))); - WockySession *session = gabble_connection_get_session (conn); + WockySession *session = gabble_plugin_connection_get_session (conn); WockyNodeTree *body_tree = NULL; WockyNode *msg_node; WockyStanza *reply; @@ -690,9 +697,9 @@ ytst_message_channel_fail (TpYtsSvcChannel *channel, YtstMessageChannelPrivate *priv = self->priv; const gchar *type; GError *error = NULL; - GabbleConnection *conn = GABBLE_CONNECTION (tp_base_channel_get_connection ( - TP_BASE_CHANNEL (self))); - WockySession *session = gabble_connection_get_session (conn); + GabblePluginConnection *conn = GABBLE_PLUGIN_CONNECTION ( + tp_base_channel_get_connection (TP_BASE_CHANNEL (self))); + WockySession *session = gabble_plugin_connection_get_session (conn); WockyStanza *reply; /* Can't call this method from this side */ @@ -768,7 +775,7 @@ channel_ytstenut_iface_init (gpointer g_iface, */ YtstMessageChannel * -ytst_message_channel_new (GabbleConnection *connection, +ytst_message_channel_new (GabblePluginConnection *connection, const gchar *contact, WockyStanza *request, TpHandle handle, @@ -777,7 +784,7 @@ ytst_message_channel_new (GabbleConnection *connection, { YtstMessageChannel *channel; - g_return_val_if_fail (GABBLE_IS_CONNECTION (connection), NULL); + g_return_val_if_fail (GABBLE_IS_PLUGIN_CONNECTION (connection), NULL); g_return_val_if_fail (!tp_str_empty (contact), NULL); g_return_val_if_fail (WOCKY_IS_STANZA (request), NULL); diff --git a/gabble/message-channel.h b/gabble/message-channel.h index ee8340a..07e956d 100644 --- a/gabble/message-channel.h +++ b/gabble/message-channel.h @@ -27,7 +27,7 @@ #include <wocky/wocky-stanza.h> -#include <gabble/connection.h> +#include <gabble/plugin-connection.h> G_BEGIN_DECLS @@ -62,7 +62,7 @@ GType ytst_message_channel_get_type (void); (G_TYPE_INSTANCE_GET_CLASS ((obj), YTST_TYPE_MESSAGE_CHANNEL, \ YtstMessageChannelClass)) -YtstMessageChannel* ytst_message_channel_new (GabbleConnection *connection, +YtstMessageChannel* ytst_message_channel_new (GabblePluginConnection *connection, const gchar *contact, WockyStanza *request, TpHandle handle, diff --git a/gabble/status.c b/gabble/status.c index 0947ecf..1ede46a 100644 --- a/gabble/status.c +++ b/gabble/status.c @@ -68,7 +68,7 @@ enum struct _YtstStatusPrivate { WockySession *session; - GabbleConnection *connection; + GabblePluginConnection *connection; guint handler_id; gulong capabilities_changed_id; @@ -323,7 +323,7 @@ contact_capabilities_changed (YtstStatus *self, data_forms = wocky_xep_0115_capabilities_get_data_forms ( WOCKY_XEP_0115_CAPABILITIES (contact)); - jid = gabble_connection_get_jid_for_caps (priv->connection, + jid = gabble_plugin_connection_get_jid_for_caps (priv->connection, WOCKY_XEP_0115_CAPABILITIES (contact)); if (jid == NULL) @@ -460,7 +460,7 @@ check_contact_capabilities (TpHandleSet *set, YtstStatusPrivate *priv = self->priv; WockyXep0115Capabilities *caps; - caps = gabble_connection_get_caps (priv->connection, + caps = gabble_plugin_connection_get_caps (priv->connection, handle); if (caps != NULL) @@ -468,7 +468,7 @@ check_contact_capabilities (TpHandleSet *set, } static void -contact_list_state_changed_cb (GabbleConnection *connection, +contact_list_state_changed_cb (GabblePluginConnection *connection, TpContactListState state, YtstStatus *self) { @@ -478,7 +478,7 @@ contact_list_state_changed_cb (GabbleConnection *connection, if (state != TP_CONTACT_LIST_STATE_SUCCESS) return; - contact_list = gabble_connection_get_contact_list (connection); + contact_list = gabble_plugin_connection_get_contact_list (connection); contacts = tp_base_contact_list_dup_contacts (contact_list); tp_handle_set_foreach (contacts, @@ -502,7 +502,7 @@ capabilities_idle_cb (gpointer data) /* and now look through all the contacts that had caps before this * sidecar was ensured */ - contact_list = gabble_connection_get_contact_list (priv->connection); + contact_list = gabble_plugin_connection_get_contact_list (priv->connection); contact_list_state = tp_base_contact_list_get_state (contact_list, NULL); if (contact_list_state == TP_CONTACT_LIST_STATE_SUCCESS) @@ -628,8 +628,8 @@ ytst_status_class_init (YtstStatusClass *klass) param_spec = g_param_spec_object ( "connection", "Gabble connection", - "GabbleConnection object", - GABBLE_TYPE_CONNECTION, + "GabblePluginConnection object", + GABBLE_TYPE_PLUGIN_CONNECTION, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_CONNECTION, param_spec); @@ -777,7 +777,7 @@ sidecar_iface_init (GabbleSidecarInterface *iface) YtstStatus * ytst_status_new (WockySession *session, - GabbleConnection *connection) + GabblePluginConnection *connection) { return g_object_new (YTST_TYPE_STATUS, "session", session, diff --git a/gabble/status.h b/gabble/status.h index 24adbc6..9b77d0a 100644 --- a/gabble/status.h +++ b/gabble/status.h @@ -27,7 +27,7 @@ #include <wocky/wocky-session.h> -#include <gabble/connection.h> +#include <gabble/plugin-connection.h> G_BEGIN_DECLS @@ -63,7 +63,7 @@ GType ytst_status_get_type (void); (G_TYPE_INSTANCE_GET_CLASS ((obj), YTST_TYPE_STATUS, YtstStatusClass)) YtstStatus * ytst_status_new (WockySession *session, - GabbleConnection *connection); + GabblePluginConnection *connection); G_END_DECLS diff --git a/plugin-base/channel-manager.c b/plugin-base/channel-manager.c index 0cf6e97..5dcc003 100644 --- a/plugin-base/channel-manager.c +++ b/plugin-base/channel-manager.c @@ -40,8 +40,8 @@ typedef SalutConnection FooConnection; #define foo_connection_get_session salut_connection_get_session #else #include <gabble/caps-channel-manager.h> -typedef GabbleConnection FooConnection; -#define foo_connection_get_session gabble_connection_get_session +typedef GabblePluginConnection FooConnection; +#define foo_connection_get_session gabble_plugin_connection_get_session #endif #include <telepathy-ytstenut-glib/telepathy-ytstenut-glib.h> @@ -498,7 +498,7 @@ ytst_channel_manager_create_channel (TpChannelManager *manager, tp_asv_get_string (request_properties, TP_YTS_IFACE_CHANNEL ".TargetService")); - resource = gabble_connection_pick_best_resource_for_caps (priv->connection, + resource = gabble_plugin_connection_pick_best_resource_for_caps (priv->connection, name, gabble_capability_set_predicate_has, service); g_free (service); @@ -511,7 +511,7 @@ ytst_channel_manager_create_channel (TpChannelManager *manager, jid = g_strdup_printf ("%s/%s", name, resource); - full_jid = gabble_connection_get_full_jid (priv->connection); + full_jid = gabble_plugin_connection_get_full_jid (priv->connection); #endif request = ytst_message_channel_build_request (request_properties, diff --git a/plugin-base/ytstenut.c b/plugin-base/ytstenut.c index e293354..965ca32 100644 --- a/plugin-base/ytstenut.c +++ b/plugin-base/ytstenut.c @@ -19,6 +19,7 @@ */ #include "config.h" +#include <stdio.h> #include "ytstenut.h" @@ -34,8 +35,9 @@ typedef SalutConnection FooConnection; typedef SalutSidecar FooSidecar; #else #include <gabble/plugin.h> +#include <gabble/plugin-connection.h> typedef GabblePlugin FooPlugin; -typedef GabbleConnection FooConnection; +typedef GabblePluginConnection FooConnection; typedef GabbleSidecar FooSidecar; #endif @@ -86,7 +88,7 @@ ytstenut_plugin_initialize (SalutPlugin *plugin, #endif static void -ytstenut_plugin_create_sidecar ( +ytstenut_plugin_create_sidecar_async ( FooPlugin *plugin, const gchar *sidecar_interface, FooConnection *connection, @@ -102,7 +104,7 @@ ytstenut_plugin_create_sidecar ( #ifdef SALUT salut_plugin_create_sidecar_async #else - gabble_plugin_create_sidecar + ytstenut_plugin_create_sidecar_async #endif ); FooSidecar *sidecar = NULL; @@ -122,17 +124,21 @@ ytstenut_plugin_create_sidecar ( g_simple_async_result_set_op_res_gpointer (result, sidecar, g_object_unref); g_simple_async_result_complete_in_idle (result); + + g_simple_async_result_is_valid ((GAsyncResult*) result, G_OBJECT (plugin), NULL); + g_object_unref (result); } static GPtrArray * ytstenut_plugin_create_channel_managers ( FooPlugin *plugin, + FooConnection *plugin_connection, TpBaseConnection *connection) { GPtrArray *ret = g_ptr_array_sized_new (1); - DEBUG ("%p on connection %p", plugin, connection); + DEBUG ("%p on connection %p", plugin, plugin_connection); g_ptr_array_add (ret, g_object_new (YTST_TYPE_CAPS_MANAGER, NULL)); g_ptr_array_add (ret, ytst_channel_manager_new (connection)); @@ -159,7 +165,7 @@ plugin_iface_init (gpointer g_iface, iface->version = PACKAGE_VERSION; iface->sidecar_interfaces = sidecar_interfaces; - iface->create_sidecar = ytstenut_plugin_create_sidecar; + iface->create_sidecar_async = ytstenut_plugin_create_sidecar_async; iface->create_channel_managers = ytstenut_plugin_create_channel_managers; } |