soylent r288 - trunk/libsoylent
- From: svenp svn gnome org
- To: svn-commits-list gnome org
- Subject: soylent r288 - trunk/libsoylent
- Date: Mon, 18 Aug 2008 10:19:31 +0000 (UTC)
Author: svenp
Date: Mon Aug 18 10:19:31 2008
New Revision: 288
URL: http://svn.gnome.org/viewvc/soylent?rev=288&view=rev
Log:
discovery of IM-protocols / attributes works
Modified:
trunk/libsoylent/soylent.c
trunk/libsoylent/soylent.h
Modified: trunk/libsoylent/soylent.c
==============================================================================
--- trunk/libsoylent/soylent.c (original)
+++ trunk/libsoylent/soylent.c Mon Aug 18 10:19:31 2008
@@ -22,14 +22,76 @@
*/
#include "soylent.h"
+#include "sl-priv-util.h"
#include <glib-object.h>
+#include <libempathy/empathy-utils.h>
+#include <libmissioncontrol/mc-account-monitor.h>
+
+/* TODO: the whole communications stuff probably should go into its own
+ * file */
+
+static EmpathyContactManager *contactmgr = NULL;
+static McAccountMonitor *account_monitor = NULL;
+static GHashTable *im_protocols = NULL;
+
+static void
+mc_account_created (McAccountMonitor *account_manager, gchar *name, gpointer user_data)
+{
+ McAccount *account = mc_account_lookup (name);
+ const gchar *protocol_name = sl_priv_util_get_protocol_name_from_account (account);
+ g_hash_table_insert (im_protocols, (gpointer) protocol_name, NULL);
+ sl_debug_book ("discovered im attribute \"%s\"", protocol_name);
+}
+
+static void
+sl_im_init (void)
+{
+ MissionControl *mc = empathy_mission_control_new ();
+
+ im_protocols = g_hash_table_new (g_str_hash, g_str_equal);
+ GList *accounts = mc_accounts_list ();
+ for (; accounts != NULL; accounts = accounts->next)
+ {
+ const gchar *protocol_name = sl_priv_util_get_protocol_name_from_account (accounts->data);
+ g_hash_table_insert (im_protocols, (gpointer) protocol_name, NULL);
+ sl_debug_book ("discovered im attribute \"%s\"", protocol_name);
+ }
+ accounts = g_list_first (accounts);
+ mc_accounts_list_free (accounts);
+
+ account_monitor = mc_account_monitor_new ();
+ g_signal_connect (account_monitor, "account-created",
+ G_CALLBACK (mc_account_created), NULL);
+
+
+ /*DBusGConnection *dbus_con = dbus_g_bus_get(DBUS_BUS_SESSION, error);
+ if (dbus_con == NULL) {
+ g_error("fail");
+ }
+ mc = mission_control_new(dbus_con);*/
+ contactmgr = empathy_contact_manager_new ();
+ mission_control_set_presence(mc, MC_PRESENCE_AVAILABLE, NULL, NULL, NULL);
+}
+
+EmpathyContactManager *
+sl_im_get_contact_manager (void)
+{
+ return contactmgr;
+}
+
+gboolean
+sl_im_is_im_attribute (const gchar *attrname)
+{
+ return (g_hash_table_lookup (im_protocols, attrname) != NULL);
+}
gboolean
sl_init (GError **error)
{
g_type_init ();
sl_attributes_init ();
+ sl_im_init ();
return sl_book_setup (error);
}
Modified: trunk/libsoylent/soylent.h
==============================================================================
--- trunk/libsoylent/soylent.h (original)
+++ trunk/libsoylent/soylent.h Mon Aug 18 10:19:31 2008
@@ -45,6 +45,11 @@
#include "sl-attributes.h"
#include "sl-group.h"
+#include <libempathy/empathy-contact-manager.h>
+
+EmpathyContactManager *sl_im_get_contact_manager (void);
+gboolean sl_im_is_im_attribute (const gchar *attrname);
+
gboolean sl_init (GError **error);
void sl_cleanup (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]