Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/EionRobb/skype4pidgin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEion Robb <eion@robbmob.com>2007-11-19 07:34:15 +0300
committerEion Robb <eion@robbmob.com>2007-11-19 07:34:15 +0300
commit58aa01c1b79dd471c580780921c8246a2307a40c (patch)
treeb60e8880c18d726a784801522838f0805a69b7ff /skype_messaging_dbus.c
parent27519c62c04073bbcff7cb97ba01a5cf8f9891fb (diff)
Handled dbus connection errors better
Diffstat (limited to 'skype_messaging_dbus.c')
-rw-r--r--skype_messaging_dbus.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/skype_messaging_dbus.c b/skype_messaging_dbus.c
index 6246a1f..8bbf151 100644
--- a/skype_messaging_dbus.c
+++ b/skype_messaging_dbus.c
@@ -8,12 +8,14 @@ static DBusGConnection *connection = NULL;
static DBusGProxy *proxy = NULL;
static DBusGProxy *proxy_receive = NULL;
-static void notify_handler(DBusGProxy *object, const char *message, gpointer user_data)
+static void
+notify_handler(DBusGProxy *object, const char *message, gpointer user_data)
{
purple_debug_info("skype_dbus", "notify_handler called: %s\n", message);
}
-static gboolean skype_connect()
+static gboolean
+skype_connect()
{
GError *error = NULL;
connection = dbus_g_bus_get (SKYPE_DBUS_BUS, &error);
@@ -39,22 +41,40 @@ static gboolean skype_connect()
return TRUE;
}
-static void skype_disconnect()
-{
- g_free(connection);
- g_free(proxy);
+static void
+skype_disconnect()
+{
+ /*if (connection != NULL)
+ g_free(connection);
+ if (proxy != NULL)
+ g_free(proxy);
+ if (proxy_receive != NULL)
+ g_free(proxy_receive);*/
}
-static void send_message(char* message)
+static void
+send_message(char* message)
{
GError *error = NULL;
gchar *str = NULL;
+ int message_num;
+ gchar error_return[30];
+
purple_debug_info("skype_dbus", "con %d, proxy %d, rec %d\n", connection, proxy, proxy_receive);
if (!dbus_g_proxy_call (proxy, "Invoke", &error, G_TYPE_STRING, message, G_TYPE_INVALID,
G_TYPE_STRING, &str, G_TYPE_INVALID))
{
- if (error && error->message)
+ if (error && error->message)
+ {
purple_debug_info("skype_dbus", "Error: %s\n", error->message);
+ if (message[0] == '#')
+ {
+ //We're expecting a response
+ sscanf(message, "#%d ", &message_num);
+ sprintf(error_return, "#%d ERROR", message_num);
+ g_thread_create((GThreadFunc)skype_message_received, (void *)g_strdup(error_return), FALSE, NULL);
+ }
+ }
else
purple_debug_info("skype_dbus", "no response\n");
}