r6892 - dumbhippo/trunk/client/linux/src
- From: commits mugshot org
- To: online-desktop-list gnome org
- Subject: r6892 - dumbhippo/trunk/client/linux/src
- Date: Mon, 12 Nov 2007 12:41:06 -0600 (CST)
Author: otaylor
Date: 2007-11-12 12:41:06 -0600 (Mon, 12 Nov 2007)
New Revision: 6892
Modified:
dumbhippo/trunk/client/linux/src/hippo-dbus-im-client.c
dumbhippo/trunk/client/linux/src/hippo-dbus-im.c
dumbhippo/trunk/client/linux/src/hippo-dbus-im.h
dumbhippo/trunk/client/linux/src/hippo-dbus-local.c
dumbhippo/trunk/client/linux/src/hippo-dbus-server.c
dumbhippo/trunk/client/linux/src/main.c
Log:
hippo-dbus-im.c: Strip out custom D-BUS export of IM buddies; we just need
the data model export.
hippo-dbus-im.[ch] hippo-debus-local.c hippo-dbus-im-client.c: Remove usage
of DDMNotificationSet ... no longer needed.
hippo-dbus-server.c main.c: Move hippo_dbus_im_init() out of the D-BUS server
code, since it has little to do with D-BUS. (rename upcoming)
Modified: dumbhippo/trunk/client/linux/src/hippo-dbus-im-client.c
===================================================================
--- dumbhippo/trunk/client/linux/src/hippo-dbus-im-client.c 2007-11-12 17:16:10 UTC (rev 6891)
+++ dumbhippo/trunk/client/linux/src/hippo-dbus-im-client.c 2007-11-12 18:41:06 UTC (rev 6892)
@@ -37,7 +37,6 @@
const char *content_type;
const char *bytes;
int bytes_len;
- DDMNotificationSet *notifications;
g_debug("Received icon %s for %s", ir->hash, ir->buddy_id);
@@ -59,14 +58,10 @@
dbus_message_iter_get_fixed_array(&byte_array_iter, &bytes, &bytes_len);
- notifications = hippo_dbus_im_start_notifications();
-
- hippo_dbus_im_update_buddy_icon(notifications, ir->buddy_id,
+ hippo_dbus_im_update_buddy_icon(ir->buddy_id,
ir->hash, content_type,
bytes, bytes_len);
- hippo_dbus_im_send_notifications(notifications);
-
g_hash_table_remove(ir->id->icon_requests,
ir->hash);
@@ -126,7 +121,6 @@
static void
notify_buddy(ImData *id,
DBusMessageIter *buddy_iter,
- DDMNotificationSet *notifications,
GHashTable *new_resource_ids /* may be NULL */)
{
char *resource_id = NULL;
@@ -183,8 +177,7 @@
resource_id = make_buddy_resource_id(id, protocol, name);
- hippo_dbus_im_update_buddy(notifications,
- resource_id,
+ hippo_dbus_im_update_buddy(resource_id,
protocol,
name, alias,
is_online,
@@ -216,7 +209,6 @@
{
ImData *id = data;
DBusMessageIter toplevel_iter, buddy_iter;
- DDMNotificationSet *notifications;
if (id->reload_idle != 0)
return; /* no point doing any work if we're going to do a full reload anyway */
@@ -225,16 +217,11 @@
g_assert(dbus_message_iter_get_arg_type(&toplevel_iter) == DBUS_TYPE_ARRAY);
dbus_message_iter_recurse(&toplevel_iter, &buddy_iter);
- notifications = hippo_dbus_im_start_notifications();
-
- notify_buddy(id, &buddy_iter, notifications, NULL);
-
- hippo_dbus_im_send_notifications(notifications);
+ notify_buddy(id, &buddy_iter, NULL);
}
typedef struct {
- DDMNotificationSet *notifications;
GHashTable *new_resource_ids;
} FindRemovedResourcesClosure;
@@ -248,17 +235,15 @@
if (closure->new_resource_ids == NULL ||
g_hash_table_lookup(closure->new_resource_ids, old_resource_id) == NULL)
- hippo_dbus_im_remove_buddy(closure->notifications, old_resource_id);
+ hippo_dbus_im_remove_buddy(old_resource_id);
}
static void
remove_old_resources(GHashTable *old_resource_ids,
- DDMNotificationSet *notifications,
GHashTable *new_resource_ids /* may be NULL */)
{
FindRemovedResourcesClosure closure;
- closure.notifications = notifications;
closure.new_resource_ids = new_resource_ids;
g_hash_table_foreach(old_resource_ids,
@@ -271,10 +256,7 @@
DBusMessageIter *buddy_array_iter)
{
GHashTable *new_buddy_resource_ids;
- DDMNotificationSet *notifications;
- notifications = hippo_dbus_im_start_notifications();
-
new_buddy_resource_ids = g_hash_table_new_full(g_str_hash, g_str_equal,
g_free, NULL);
@@ -284,18 +266,16 @@
g_assert(dbus_message_iter_get_arg_type(buddy_array_iter) == DBUS_TYPE_ARRAY);
dbus_message_iter_recurse(buddy_array_iter, &buddy_iter);
- notify_buddy(id, &buddy_iter, notifications, new_buddy_resource_ids);
+ notify_buddy(id, &buddy_iter, new_buddy_resource_ids);
dbus_message_iter_next(buddy_array_iter);
}
/* Figure out what we removed */
- remove_old_resources(id->resource_ids, notifications, new_buddy_resource_ids);
+ remove_old_resources(id->resource_ids, new_buddy_resource_ids);
g_hash_table_destroy(id->resource_ids);
id->resource_ids = new_buddy_resource_ids;
-
- hippo_dbus_im_send_notifications(notifications);
}
static void
@@ -380,7 +360,6 @@
void *data)
{
ImData *id = data;
- DDMNotificationSet *notifications;
if (id->im_proxy == NULL)
return;
@@ -393,13 +372,9 @@
id->reload_idle = 0;
}
- notifications = hippo_dbus_im_start_notifications();
+ remove_old_resources(id->resource_ids, NULL);
- remove_old_resources(id->resource_ids, notifications, NULL);
-
g_hash_table_remove_all(id->resource_ids);
-
- hippo_dbus_im_send_notifications(notifications);
}
static const HippoDBusSignalTracker signal_handlers[] = {
Modified: dumbhippo/trunk/client/linux/src/hippo-dbus-im.c
===================================================================
--- dumbhippo/trunk/client/linux/src/hippo-dbus-im.c 2007-11-12 17:16:10 UTC (rev 6891)
+++ dumbhippo/trunk/client/linux/src/hippo-dbus-im.c 2007-11-12 18:41:06 UTC (rev 6892)
@@ -6,7 +6,6 @@
#include <ddm/ddm.h>
-#include "hippo-dbus-helper.h"
#include "hippo-dbus-im.h"
#include "main.h"
@@ -28,9 +27,6 @@
char *icon_data_url;
} HippoDBusImBuddy;
-static void hippo_dbus_im_append_buddy(DBusMessageIter *append_iter,
- const HippoDBusImBuddy *buddy);
-
static void
hippo_dbus_im_buddy_destroy(HippoDBusImBuddy *buddy)
{
@@ -66,147 +62,11 @@
return im;
}
-static void
-get_buddies_foreach(gpointer key,
- gpointer value,
- gpointer data)
-{
- HippoDBusImBuddy *buddy = value;
- DBusMessageIter *append_iter = data;
-
- hippo_dbus_im_append_buddy(append_iter, buddy);
-}
-
-static DBusMessage*
-handle_get_buddies(void *object,
- DBusMessage *message,
- DBusError *error)
-{
- HippoDataCache *cache = hippo_app_get_data_cache(hippo_get_app());
- HippoDBusIm *im = hippo_dbus_im_get(cache);
- DBusMessage *reply;
- DBusMessageIter iter, array_iter;
-
- reply = dbus_message_new_method_return(message);
-
- dbus_message_iter_init_append(reply, &iter);
-
- /* open an array of dict */
- dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "a{sv}", &array_iter);
-
- g_hash_table_foreach(im->buddies, get_buddies_foreach, &array_iter);
-
- dbus_message_iter_close_container(&iter, &array_iter);
-
- return reply;
-}
-
-static DBusMessage*
-handle_get_icon(void *object,
- DBusMessage *message,
- DBusError *error)
-{
- dbus_set_error(error, DBUS_ERROR_NOT_SUPPORTED,
- "Have not implemented GetIcon yet");
-
- return NULL;
-}
-
-/* Hmm, I guess this is obsoleted by a data model approach */
-static const HippoDBusMember im_members[] = {
- { HIPPO_DBUS_MEMBER_METHOD, "GetBuddyList", "", "aa{sv}", handle_get_buddies },
-
- /* args are "s" icon ID, and returns "s" content-type and "ay" the
- * icon in PNG or other common format. the icon ID would be in
- * the key-value dict for a buddy, under key "icon"
- */
-
- { HIPPO_DBUS_MEMBER_METHOD, "GetIcon", "s", "say", handle_get_icon },
- { HIPPO_DBUS_MEMBER_SIGNAL, "BuddyListChanged", "", "", NULL },
- { HIPPO_DBUS_MEMBER_SIGNAL, "BuddyChanged", "", "a{sv}", NULL },
- { 0, NULL }
-};
-
void
-hippo_dbus_init_im(DBusConnection *connection,
- gboolean replace)
+hippo_dbus_init_im(void)
{
- hippo_dbus_helper_register_interface(connection, HIPPO_DBUS_IM_INTERFACE,
- im_members, NULL);
-
- hippo_dbus_helper_register_object(connection, HIPPO_DBUS_IM_PATH,
- NULL, HIPPO_DBUS_IM_INTERFACE,
- NULL);
}
-static void
-hippo_dbus_im_emit_buddy_list_changed (DBusConnection *connection)
-{
- hippo_dbus_helper_emit_signal(connection, HIPPO_DBUS_IM_PATH, HIPPO_DBUS_IM_INTERFACE,
- "BuddyListChanged", DBUS_TYPE_INVALID);
-}
-
-static void
-hippo_dbus_im_emit_buddy_changed(DBusConnection *connection,
- const HippoDBusImBuddy *buddy)
-{
- DBusMessage *message;
- DBusMessageIter iter;
-
- message = dbus_message_new_signal(HIPPO_DBUS_IM_PATH, HIPPO_DBUS_IM_INTERFACE,
- "BuddyChanged");
-
- dbus_message_iter_init_append(message, &iter);
-
- hippo_dbus_im_append_buddy(&iter, buddy);
-
- dbus_connection_send(connection, message, NULL);
-
- dbus_message_unref(message);
-}
-
-static void
-append_basic_entry(DBusMessageIter *dict_iter,
- const char *key,
- int type,
- const void *value)
-{
- DBusMessageIter entry_iter, variant_iter;
- char type_str[2];
- type_str[0] = type;
- type_str[1] = '\0';
-
- dbus_message_iter_open_container(dict_iter, DBUS_TYPE_DICT_ENTRY, NULL, &entry_iter);
-
- dbus_message_iter_append_basic(&entry_iter, DBUS_TYPE_STRING, &key);
-
- dbus_message_iter_open_container(&entry_iter, DBUS_TYPE_VARIANT, type_str, &variant_iter);
-
- dbus_message_iter_append_basic(&variant_iter, type, value);
-
- dbus_message_iter_close_container(&entry_iter, &variant_iter);
-
- dbus_message_iter_close_container(dict_iter, &entry_iter);
-}
-
-static void
-hippo_dbus_im_append_buddy(DBusMessageIter *append_iter,
- const HippoDBusImBuddy *buddy)
-{
- DBusMessageIter dict_iter;
-
- dbus_message_iter_open_container(append_iter, DBUS_TYPE_ARRAY, "{sv}", &dict_iter);
-
- append_basic_entry(&dict_iter, "protocol", DBUS_TYPE_STRING, &buddy->protocol);
- append_basic_entry(&dict_iter, "name", DBUS_TYPE_STRING, &buddy->name);
- append_basic_entry(&dict_iter, "online", DBUS_TYPE_BOOLEAN, &buddy->is_online);
-
- if (buddy->status)
- append_basic_entry(&dict_iter, "status", DBUS_TYPE_STRING, &buddy->status);
-
- dbus_message_iter_close_container(append_iter, &dict_iter);
-}
-
static DDMDataResource *
get_system_resource(DDMDataModel *model)
{
@@ -225,38 +85,6 @@
return strcmp(a, b) == 0;
}
-DDMNotificationSet *
-hippo_dbus_im_start_notifications(void)
-{
- HippoApp *app = hippo_get_app();
- HippoDataCache *cache;
- DDMDataModel *model;
-
- if (!app)
- return NULL;
-
- cache = hippo_app_get_data_cache(hippo_get_app());
- model = hippo_data_cache_get_model(cache);
-
- return ddm_notification_set_new(model);
-}
-
-static void
-update_property (DDMDataResource *resource,
- DDMQName *property_id,
- DDMDataUpdate update,
- DDMDataCardinality cardinality,
- gboolean default_include,
- const char *default_children,
- DDMDataValue *value,
- DDMNotificationSet *notifications)
-{
- if (ddm_data_resource_update_property(resource, property_id, update,
- cardinality, default_include, default_children,
- value))
- ddm_notification_set_add(notifications, resource, property_id);
-}
-
static char*
build_data_url(const char *icon_content_type,
const char *icon_binary_data,
@@ -275,8 +103,7 @@
}
void
-hippo_dbus_im_update_buddy_icon (DDMNotificationSet *notifications,
- const char *buddy_id,
+hippo_dbus_im_update_buddy_icon (const char *buddy_id,
const char *icon_hash,
const char *icon_content_type,
const char *icon_binary_data,
@@ -314,13 +141,12 @@
value.type = DDM_DATA_URL;
value.u.string = buddy->icon_data_url;
- update_property(buddy_resource,
- ddm_qname_get(BUDDY_CLASS, "icon"),
- DDM_DATA_UPDATE_REPLACE,
- DDM_DATA_CARDINALITY_01,
- FALSE, NULL,
- &value,
- notifications);
+ ddm_data_resource_update_property(buddy_resource,
+ ddm_qname_get(BUDDY_CLASS, "icon"),
+ DDM_DATA_UPDATE_REPLACE,
+ DDM_DATA_CARDINALITY_01,
+ FALSE, NULL,
+ &value);
g_debug(" (updated)");
}
@@ -346,8 +172,7 @@
}
void
-hippo_dbus_im_update_buddy(DDMNotificationSet *notifications,
- const char *buddy_id,
+hippo_dbus_im_update_buddy(const char *buddy_id,
const char *protocol,
const char *name,
const char *alias,
@@ -387,13 +212,12 @@
value.type = DDM_DATA_STRING;
value.u.string = buddy->protocol;
- update_property(buddy_resource,
- ddm_qname_get(BUDDY_CLASS, "protocol"),
- DDM_DATA_UPDATE_REPLACE,
- DDM_DATA_CARDINALITY_1,
- TRUE, NULL,
- &value,
- notifications);
+ ddm_data_resource_update_property(buddy_resource,
+ ddm_qname_get(BUDDY_CLASS, "protocol"),
+ DDM_DATA_UPDATE_REPLACE,
+ DDM_DATA_CARDINALITY_1,
+ TRUE, NULL,
+ &value);
buddy_changed = !new_buddy;
}
@@ -405,13 +229,12 @@
value.type = DDM_DATA_STRING;
value.u.string = buddy->name;
- update_property(buddy_resource,
- ddm_qname_get(BUDDY_CLASS, "name"),
- DDM_DATA_UPDATE_REPLACE,
- DDM_DATA_CARDINALITY_1,
- TRUE, NULL,
- &value,
- notifications);
+ ddm_data_resource_update_property(buddy_resource,
+ ddm_qname_get(BUDDY_CLASS, "name"),
+ DDM_DATA_UPDATE_REPLACE,
+ DDM_DATA_CARDINALITY_1,
+ TRUE, NULL,
+ &value);
buddy_changed = !new_buddy;
}
@@ -425,21 +248,19 @@
if (alias == NULL) {
if (!new_buddy)
- update_property(buddy_resource,
- ddm_qname_get(BUDDY_CLASS, "alias"),
- DDM_DATA_UPDATE_CLEAR,
- DDM_DATA_CARDINALITY_1,
- TRUE, NULL,
- &value,
- notifications);
+ ddm_data_resource_update_property(buddy_resource,
+ ddm_qname_get(BUDDY_CLASS, "alias"),
+ DDM_DATA_UPDATE_CLEAR,
+ DDM_DATA_CARDINALITY_1,
+ TRUE, NULL,
+ &value);
} else {
- update_property(buddy_resource,
- ddm_qname_get(BUDDY_CLASS, "alias"),
- DDM_DATA_UPDATE_REPLACE,
- DDM_DATA_CARDINALITY_1,
- TRUE, NULL,
- &value,
- notifications);
+ ddm_data_resource_update_property(buddy_resource,
+ ddm_qname_get(BUDDY_CLASS, "alias"),
+ DDM_DATA_UPDATE_REPLACE,
+ DDM_DATA_CARDINALITY_1,
+ TRUE, NULL,
+ &value);
}
buddy_changed = !new_buddy;
@@ -453,13 +274,12 @@
value.type = DDM_DATA_BOOLEAN;
value.u.boolean = buddy->is_online;
- update_property(buddy_resource,
- ddm_qname_get(BUDDY_CLASS, "isOnline"),
- DDM_DATA_UPDATE_REPLACE,
- DDM_DATA_CARDINALITY_1,
- TRUE, NULL,
- &value,
- notifications);
+ ddm_data_resource_update_property(buddy_resource,
+ ddm_qname_get(BUDDY_CLASS, "isOnline"),
+ DDM_DATA_UPDATE_REPLACE,
+ DDM_DATA_CARDINALITY_1,
+ TRUE, NULL,
+ &value);
buddy_changed = !new_buddy;
}
@@ -471,13 +291,12 @@
value.type = DDM_DATA_STRING;
value.u.string = buddy->status;
- update_property(buddy_resource,
- ddm_qname_get(BUDDY_CLASS, "status"),
- buddy->status ? DDM_DATA_UPDATE_REPLACE : DDM_DATA_UPDATE_CLEAR,
- DDM_DATA_CARDINALITY_01,
- TRUE, NULL,
- &value,
- notifications);
+ ddm_data_resource_update_property(buddy_resource,
+ ddm_qname_get(BUDDY_CLASS, "status"),
+ buddy->status ? DDM_DATA_UPDATE_REPLACE : DDM_DATA_UPDATE_CLEAR,
+ DDM_DATA_CARDINALITY_01,
+ TRUE, NULL,
+ &value);
buddy_changed = !new_buddy;
}
@@ -489,13 +308,12 @@
value.type = DDM_DATA_STRING;
value.u.string = buddy->webdav_url;
- update_property(buddy_resource,
- ddm_qname_get(BUDDY_CLASS, "webdavUrl"),
- buddy->webdav_url ? DDM_DATA_UPDATE_REPLACE : DDM_DATA_UPDATE_CLEAR,
- DDM_DATA_CARDINALITY_01,
- TRUE, NULL,
- &value,
- notifications);
+ ddm_data_resource_update_property(buddy_resource,
+ ddm_qname_get(BUDDY_CLASS, "webdavUrl"),
+ buddy->webdav_url ? DDM_DATA_UPDATE_REPLACE : DDM_DATA_UPDATE_CLEAR,
+ DDM_DATA_CARDINALITY_01,
+ TRUE, NULL,
+ &value);
buddy_changed = !new_buddy;
}
@@ -507,25 +325,18 @@
value.type = DDM_DATA_RESOURCE;
value.u.resource = buddy_resource;
- update_property(system_resource,
- ddm_qname_get(DDM_GLOBAL_RESOURCE_CLASS, "onlineBuddies"),
- buddy->is_online ? DDM_DATA_UPDATE_ADD : DDM_DATA_UPDATE_DELETE,
- DDM_DATA_CARDINALITY_N,
- FALSE, NULL,
- &value,
- notifications);
+ ddm_data_resource_update_property(system_resource,
+ ddm_qname_get(DDM_GLOBAL_RESOURCE_CLASS, "onlineBuddies"),
+ buddy->is_online ? DDM_DATA_UPDATE_ADD : DDM_DATA_UPDATE_DELETE,
+ DDM_DATA_CARDINALITY_N,
+ FALSE, NULL,
+ &value);
}
-
- if (buddy_changed) {
- DBusConnection *connection = hippo_dbus_get_connection(hippo_app_get_dbus(hippo_get_app()));
- hippo_dbus_im_emit_buddy_changed (connection, buddy);
- }
}
void
-hippo_dbus_im_remove_buddy(DDMNotificationSet *notifications,
- const char *buddy_id)
+hippo_dbus_im_remove_buddy(const char *buddy_id)
{
HippoDataCache *cache = hippo_app_get_data_cache(hippo_get_app());
HippoDBusIm *im = hippo_dbus_im_get(cache);
@@ -544,28 +355,13 @@
value.type = DDM_DATA_RESOURCE;
value.u.resource = buddy_resource;
- update_property(system_resource,
- ddm_qname_get(DDM_GLOBAL_RESOURCE_CLASS, "onlineBuddies"),
- DDM_DATA_UPDATE_DELETE,
- DDM_DATA_CARDINALITY_N,
- FALSE, NULL,
- &value,
- notifications);
+ ddm_data_resource_update_property(system_resource,
+ ddm_qname_get(DDM_GLOBAL_RESOURCE_CLASS, "onlineBuddies"),
+ DDM_DATA_UPDATE_DELETE,
+ DDM_DATA_CARDINALITY_N,
+ FALSE, NULL,
+ &value);
}
g_hash_table_remove(im->buddies, buddy_id);
}
-
-void
-hippo_dbus_im_send_notifications(DDMNotificationSet *notifications)
-{
- if (ddm_notification_set_has_property(notifications,
- DDM_GLOBAL_RESOURCE,
- ddm_qname_get(DDM_GLOBAL_RESOURCE_CLASS, "onlineBuddies"))) {
- DBusConnection *connection = hippo_dbus_get_connection(hippo_app_get_dbus(hippo_get_app()));
- hippo_dbus_im_emit_buddy_list_changed (connection);
- }
-
- ddm_notification_set_send(notifications);
- ddm_notification_set_free(notifications);
-}
Modified: dumbhippo/trunk/client/linux/src/hippo-dbus-im.h
===================================================================
--- dumbhippo/trunk/client/linux/src/hippo-dbus-im.h 2007-11-12 17:16:10 UTC (rev 6891)
+++ dumbhippo/trunk/client/linux/src/hippo-dbus-im.h 2007-11-12 18:41:06 UTC (rev 6892)
@@ -12,35 +12,24 @@
#define HIPPO_DBUS_IM_INTERFACE "org.freedesktop.od.IM"
#define HIPPO_DBUS_IM_PATH "/org/freedesktop/od/im"
-void hippo_dbus_init_im(DBusConnection *connection,
- gboolean replace);
+void hippo_dbus_init_im(void);
-DDMNotificationSet *hippo_dbus_im_start_notifications(void);
-
-void hippo_dbus_im_update_buddy (DDMNotificationSet *notifications,
- const char *buddy_id,
+void hippo_dbus_im_update_buddy (const char *buddy_id,
const char *protocol,
const char *name,
const char *alias,
gboolean is_online,
const char *status,
const char *webdav_url);
-void hippo_dbus_im_update_buddy_icon (DDMNotificationSet *notifications,
- const char *buddy_id,
+void hippo_dbus_im_update_buddy_icon (const char *buddy_id,
const char *icon_hash,
const char *icon_content_type,
const char *icon_binary_data,
int icon_data_len);
-void hippo_dbus_im_remove_buddy (DDMNotificationSet *notifications,
- const char *buddy_id);
+void hippo_dbus_im_remove_buddy (const char *buddy_id);
gboolean hippo_dbus_im_has_icon_hash (const char *buddy_id,
const char *icon_hash);
-/* Differs from _hippo_notification_set_send(notifications) in that it will
- * also send out a D-BUS signal if the list of buddies changed.
- */
-void hippo_dbus_im_send_notifications (DDMNotificationSet *notifications);
-
G_END_DECLS
#endif /* __HIPPO_DBUS_IM_H__ */
Modified: dumbhippo/trunk/client/linux/src/hippo-dbus-local.c
===================================================================
--- dumbhippo/trunk/client/linux/src/hippo-dbus-local.c 2007-11-12 17:16:10 UTC (rev 6891)
+++ dumbhippo/trunk/client/linux/src/hippo-dbus-local.c 2007-11-12 18:41:06 UTC (rev 6892)
@@ -178,20 +178,19 @@
}
static void
-update_im_buddy(DDMNotificationSet *notifications,
- const char *session_id)
+update_im_buddy(const char *session_id)
{
LocalBuddy *local_buddy = get_local_buddy(session_id);
char *resource_id = make_resource_id(session_id);
if (!local_buddy || local_buddy->user_resource_id == NULL) {
- hippo_dbus_im_remove_buddy(notifications, resource_id);
+ hippo_dbus_im_remove_buddy(resource_id);
} else {
/* It would be more complete to provide the unix name exported over the local service
* as the alias, but right now we won't actually use it for anything, so we don't
* bother pulling it out.
*/
- hippo_dbus_im_update_buddy(notifications, resource_id,
+ hippo_dbus_im_update_buddy(resource_id,
"mugshot-local", local_buddy->user_resource_id, NULL,
TRUE, "Around", local_buddy->webdav_url);
}
@@ -372,9 +371,8 @@
{
const char *session_id = key;
LocalBuddy *local_buddy = value;
- DDMNotificationSet *notifications = data;
- update_im_buddy(notifications, session_id);
+ update_im_buddy(session_id);
if (local_buddy->user_resource_id == NULL && local_buddy->webdav_url == NULL) {
g_free(local_buddy);
@@ -387,7 +385,6 @@
static gboolean
get_info_from_all_sessions(HippoDBusProxy *proxy)
{
- DDMNotificationSet *notifications;
DBusMessage *reply;
DBusError derror;
dbus_bool_t retval;
@@ -397,8 +394,6 @@
seen_mugshot_ids = g_hash_table_new_full(g_str_hash, g_str_equal, (GDestroyNotify)g_free, NULL);
- notifications = hippo_dbus_im_start_notifications();
-
info_name = MUGSHOT_INFO_NAME;
dbus_error_init(&derror);
reply = hippo_dbus_proxy_call_method_sync(proxy, "GetInfoFromAllSessions",
@@ -485,10 +480,8 @@
g_hash_table_foreach(local_buddies, clean_standard_info_foreach, seen_standard_ids);
g_hash_table_destroy(seen_standard_ids);
- g_hash_table_foreach_remove(local_buddies, update_im_buddies_foreach, notifications);
+ g_hash_table_foreach_remove(local_buddies, update_im_buddies_foreach, NULL);
- hippo_dbus_im_send_notifications(notifications);
-
return retval;
}
@@ -527,7 +520,6 @@
void *data)
{
DBusMessageIter iter, struct_iter;
- DDMNotificationSet *notifications;
const char *name;
char *session_id = NULL;
@@ -547,8 +539,6 @@
dbus_message_iter_next(&iter);
dbus_message_iter_recurse(&iter, &struct_iter);
- notifications = hippo_dbus_im_start_notifications();
-
if (strcmp(name, MUGSHOT_INFO_NAME) == 0) {
session_id = read_and_update_mugshot_info(&struct_iter);
} else if (strcmp(name, STANDARD_INFO_NAME) == 0) {
@@ -556,11 +546,9 @@
}
if (session_id) {
- update_im_buddy(notifications, session_id);
+ update_im_buddy(session_id);
maybe_remove_local_buddy(session_id);
}
-
- hippo_dbus_im_send_notifications(notifications);
}
static void
@@ -569,7 +557,6 @@
void *data)
{
DBusMessageIter iter, session_props_iter;
- DDMNotificationSet *notifications;
const char *name;
char *machine_id;
char *session_id;
@@ -595,19 +582,15 @@
if (!read_session_info(&session_props_iter, &machine_id, &session_id))
return;
- notifications = hippo_dbus_im_start_notifications();
-
if (strcmp(name, MUGSHOT_INFO_NAME) == 0) {
update_mugshot_info(session_id, NULL);
} else if (strcmp(name, STANDARD_INFO_NAME) == 0) {
update_standard_info(session_id, NULL);
}
- update_im_buddy(notifications, session_id);
+ update_im_buddy(session_id);
maybe_remove_local_buddy(session_id);
- hippo_dbus_im_send_notifications(notifications);
-
g_free(machine_id);
g_free(session_id);
}
Modified: dumbhippo/trunk/client/linux/src/hippo-dbus-server.c
===================================================================
--- dumbhippo/trunk/client/linux/src/hippo-dbus-server.c 2007-11-12 17:16:10 UTC (rev 6891)
+++ dumbhippo/trunk/client/linux/src/hippo-dbus-server.c 2007-11-12 18:41:06 UTC (rev 6892)
@@ -10,7 +10,6 @@
#include "hippo-dbus-client.h"
#include "hippo-dbus-contacts.h"
#include "hippo-dbus-cookies.h"
-#include "hippo-dbus-im.h"
#include "hippo-dbus-model.h"
#include "hippo-dbus-mugshot.h"
#include "hippo-dbus-pidgin.h"
@@ -409,7 +408,6 @@
hippo_dbus_init_contacts(connection, FALSE);
- hippo_dbus_init_im(connection, FALSE);
hippo_dbus_init_local(connection);
hippo_dbus_init_pidgin(connection);
hippo_dbus_init_model(connection);
Modified: dumbhippo/trunk/client/linux/src/main.c
===================================================================
--- dumbhippo/trunk/client/linux/src/main.c 2007-11-12 17:16:10 UTC (rev 6891)
+++ dumbhippo/trunk/client/linux/src/main.c 2007-11-12 18:41:06 UTC (rev 6892)
@@ -10,6 +10,7 @@
#include "hippo-platform-impl.h"
#include "hippo-dbus-server.h"
#include "hippo-dbus-client.h"
+#include "hippo-dbus-im.h"
#include "hippo-idle.h"
#include "hippo-ui.h"
@@ -901,6 +902,7 @@
options.restart_argv, options.restart_argc);
hippo_dbus_init_services(dbus);
+ hippo_dbus_init_im();
/* get rid of all this, the app has taken over */
g_object_unref(dbus);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]