aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac6
-rw-r--r--libempathy-gtk/empathy-avatar-chooser.c99
-rw-r--r--libempathy-gtk/empathy-contact-dialogs.c10
-rw-r--r--libempathy-gtk/empathy-contact-list-view.c19
-rw-r--r--libempathy-gtk/empathy-contact-widget.c24
-rw-r--r--libempathy-gtk/empathy-new-call-dialog.c8
-rw-r--r--libempathy/Makefile.am2
-rw-r--r--libempathy/empathy-chatroom-manager.c36
-rw-r--r--libempathy/empathy-chatroom-manager.dtd3
-rw-r--r--libempathy/empathy-chatroom-manager.h4
-rw-r--r--libempathy/empathy-chatroom.c48
-rw-r--r--libempathy/empathy-chatroom.h3
-rw-r--r--libempathy/empathy-contact-list.c12
-rw-r--r--libempathy/empathy-contact-list.h4
-rw-r--r--libempathy/empathy-contact-manager.c20
-rw-r--r--libempathy/empathy-contact-monitor.c417
-rw-r--r--libempathy/empathy-contact-monitor.h63
-rw-r--r--libempathy/empathy-contact.c158
-rw-r--r--libempathy/empathy-contact.h7
-rw-r--r--libempathy/empathy-dispatch-operation.c8
-rw-r--r--libempathy/empathy-dispatcher.c8
-rw-r--r--libempathy/empathy-ft-handler.c10
-rw-r--r--libempathy/empathy-log-store-empathy.c18
-rw-r--r--libempathy/empathy-tp-call.c7
-rw-r--r--libempathy/empathy-tp-chat.c74
-rw-r--r--libempathy/empathy-tp-contact-factory.c726
-rw-r--r--libempathy/empathy-tp-contact-factory.h38
-rw-r--r--libempathy/empathy-tp-contact-list.c15
-rw-r--r--po/es.po180
-rw-r--r--po/et.po13
-rwxr-xr-xrelease.py4
-rw-r--r--src/empathy-call-window.c8
-rw-r--r--src/empathy-chat-window.c80
-rw-r--r--src/empathy-chat-window.ui7
-rw-r--r--src/empathy-event-manager.c83
-rw-r--r--src/empathy-invite-participant-dialog.c2
-rw-r--r--src/empathy-main-window.c73
-rw-r--r--tools/with-session-bus.sh12
38 files changed, 622 insertions, 1687 deletions
diff --git a/configure.ac b/configure.ac
index 369cbcb33..35afac4d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,7 +32,7 @@ AC_COPYRIGHT([
GLIB_REQUIRED=2.22.0
GTK_REQUIRED=2.20.0
GCONF_REQUIRED=1.2.0
-TELEPATHY_GLIB_REQUIRED=0.11.3
+TELEPATHY_GLIB_REQUIRED=0.11.6
TELEPATHY_LOGGER=0.1.1
ENCHANT_REQUIRED=1.2.0
ISO_CODES_REQUIRED=0.35
@@ -465,7 +465,7 @@ AC_ARG_ENABLE(favourite_contacts,
[Enable favourite contacts]), ,
enable_favourite_contacts=no)
-if test "x$enable_favourite_contacts" != "xno" -o "x$chain_enable_favourite_contacts" == "xyes"; then
+if test "x$enable_favourite_contacts" != "xno" || test "x$chain_enable_favourite_contacts" = "xyes"; then
PKG_CHECK_MODULES(TELEPATHY_LOGGER,
[
telepathy-logger
@@ -479,7 +479,7 @@ else
have_favourite_contacts="no"
fi
-if test "x$enable_favourite_contacts" = "xyes" -a "x$have_favourite_contacts" != "xyes"; then
+if test "x$enable_favourite_contacts" = "xyes" && test "x$have_favourite_contacts" != "xyes"; then
AC_MSG_ERROR([Couldn't find favourite contacts dependencies.])
fi
diff --git a/libempathy-gtk/empathy-avatar-chooser.c b/libempathy-gtk/empathy-avatar-chooser.c
index a7e8683e8..6e6c28310 100644
--- a/libempathy-gtk/empathy-avatar-chooser.c
+++ b/libempathy-gtk/empathy-avatar-chooser.c
@@ -30,7 +30,6 @@
#include <gio/gio.h>
#include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-tp-contact-factory.h>
#include "empathy-avatar-chooser.h"
#include "empathy-conf.h"
@@ -63,7 +62,6 @@
#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAvatarChooser)
typedef struct {
- EmpathyTpContactFactory *factory;
TpConnection *connection;
GtkFileChooser *chooser_dialog;
@@ -256,7 +254,6 @@ avatar_chooser_finalize (GObject *object)
avatar_chooser_set_connection (EMPATHY_AVATAR_CHOOSER (object), NULL);
g_assert (priv->connection == NULL);
- g_assert (priv->factory == NULL);
if (priv->avatar != NULL) {
empathy_avatar_unref (priv->avatar);
@@ -274,14 +271,12 @@ avatar_chooser_set_connection (EmpathyAvatarChooser *self,
if (priv->connection != NULL) {
g_object_unref (priv->connection);
priv->connection = NULL;
-
- g_object_unref (priv->factory);
- priv->factory = NULL;
}
if (connection != NULL) {
+ GQuark features[] = { TP_CONNECTION_FEATURE_AVATAR_REQUIREMENTS, 0 };
priv->connection = g_object_ref (connection);
- priv->factory = empathy_tp_contact_factory_dup_singleton (connection);
+ tp_proxy_prepare_async (priv->connection, features, NULL, NULL);
}
}
@@ -409,23 +404,22 @@ avatar_chooser_maybe_convert_and_scale (EmpathyAvatarChooser *chooser,
EmpathyAvatar *avatar)
{
EmpathyAvatarChooserPriv *priv = GET_PRIV (chooser);
- guint max_width = 0, max_height = 0, max_size = 0;
- gchar **mime_types = NULL;
+ TpAvatarRequirements *req;
gboolean needs_conversion = FALSE;
guint width, height;
gchar *new_format_name = NULL;
gchar *new_mime_type = NULL;
gdouble min_factor, max_factor;
gdouble factor;
- gchar *converted_image_data = NULL;
- gsize converted_image_size = 0;
+ gchar *best_image_data = NULL;
+ gsize best_image_size = 0;
+ guint count = 0;
- g_object_get (priv->factory,
- "avatar-mime-types", &mime_types, /* Needs g_strfreev-ing */
- "avatar-max-width", &max_width,
- "avatar-max-height", &max_height,
- "avatar-max-size", &max_size,
- NULL);
+ req = tp_connection_get_avatar_requirements (priv->connection);
+ if (req == NULL) {
+ DEBUG ("Avatar requirements not ready");
+ return NULL;
+ }
/* Smaller is the factor, smaller will be the image.
* 0 is an empty image, 1 is the full size. */
@@ -435,7 +429,7 @@ avatar_chooser_maybe_convert_and_scale (EmpathyAvatarChooser *chooser,
/* Check if we need to convert to another image format */
if (avatar_chooser_need_mime_type_conversion (avatar->format,
- mime_types,
+ req->supported_mime_types,
&new_format_name,
&new_mime_type)) {
DEBUG ("Format conversion needed, we'll use mime type '%s' "
@@ -443,7 +437,6 @@ avatar_chooser_maybe_convert_and_scale (EmpathyAvatarChooser *chooser,
new_mime_type, new_format_name, avatar->format);
needs_conversion = TRUE;
}
- g_strfreev (mime_types);
/* If there is no format we can use, report error to the user. */
if (new_mime_type == NULL || new_format_name == NULL) {
@@ -456,26 +449,26 @@ avatar_chooser_maybe_convert_and_scale (EmpathyAvatarChooser *chooser,
/* If width or height are too big, it needs converting. */
width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);
- if ((max_width > 0 && width > max_width) ||
- (max_height > 0 && height > max_height)) {
+ if ((req->maximum_width > 0 && width > req->maximum_width) ||
+ (req->maximum_height > 0 && height > req->maximum_height)) {
gdouble h_factor, v_factor;
- h_factor = (gdouble) max_width / width;
- v_factor = (gdouble) max_height / height;
+ h_factor = (gdouble) req->maximum_width / width;
+ v_factor = (gdouble) req->maximum_height / height;
factor = max_factor = MIN (h_factor, v_factor);
DEBUG ("Image dimensions (%dx%d) are too big. Max is %dx%d.",
- width, height, max_width, max_height);
+ width, height, req->maximum_width, req->maximum_height);
needs_conversion = TRUE;
}
/* If the data len is too big and no other conversion is needed,
* try with a lower factor. */
- if (max_size > 0 && avatar->len > max_size && !needs_conversion) {
+ if (req->maximum_bytes > 0 && avatar->len > req->maximum_bytes && !needs_conversion) {
DEBUG ("Image data (%"G_GSIZE_FORMAT" bytes) is too big "
"(max is %u bytes), conversion needed.",
- avatar->len, max_size);
+ avatar->len, req->maximum_bytes);
factor = 0.5;
needs_conversion = TRUE;
@@ -492,10 +485,10 @@ avatar_chooser_maybe_convert_and_scale (EmpathyAvatarChooser *chooser,
GdkPixbuf *pixbuf_scaled = NULL;
gboolean saved;
gint new_width, new_height;
+ gchar *converted_image_data;
+ gsize converted_image_size;
GError *error = NULL;
- g_free (converted_image_data);
-
if (factor != 1) {
new_width = width * factor;
new_height = height * factor;
@@ -532,31 +525,49 @@ avatar_chooser_maybe_convert_and_scale (EmpathyAvatarChooser *chooser,
DEBUG ("Produced an image data of %"G_GSIZE_FORMAT" bytes.",
converted_image_size);
- if (max_size == 0)
- break;
+ /* If the new image satisfy the req, keep it as current best */
+ if (req->maximum_bytes == 0 ||
+ converted_image_size <= req->maximum_bytes) {
+ if (best_image_data)
+ g_free (best_image_data);
+
+ best_image_data = converted_image_data;
+ best_image_size = converted_image_size;
+
+ /* If this image is close enough to the optimal size,
+ * stop searching */
+ if (req->maximum_bytes == 0 ||
+ req->maximum_bytes - converted_image_size <= 1024)
+ break;
+ } else {
+ g_free (converted_image_data);
+ }
/* Make a binary search for the bigest factor that produce
* an image data size less than max_size */
- if (converted_image_size > max_size)
+ if (converted_image_size > req->maximum_bytes)
max_factor = factor;
- if (converted_image_size < max_size)
+ if (converted_image_size < req->maximum_bytes)
min_factor = factor;
factor = (min_factor + max_factor)/2;
- /* We are done if either:
- * - min_factor == max_factor. That happens if we resized to
- * the max required dimension and the produced data size is
- * less than max_size.
- * - The data size is close enough to max_size. Here we accept
- * a difference of 1k.
- */
- } while (min_factor != max_factor &&
- abs (max_size - converted_image_size) > 1024);
+ if ((int) (width * factor) == new_width ||
+ (int) (height * factor) == new_height) {
+ /* min_factor and max_factor are too close, so the new
+ * factor will produce the same image as previous
+ * iteration. No need to continue, we already found
+ * the optimal size. */
+ break;
+ }
+
+ /* Do 10 iterations in the worst case */
+ } while (++count < 10);
+
g_free (new_format_name);
- /* Takes ownership of new_mime_type and converted_image_data */
- avatar = empathy_avatar_new ((guchar *) converted_image_data,
- converted_image_size, new_mime_type, NULL, NULL);
+ /* Takes ownership of new_mime_type and best_image_data */
+ avatar = empathy_avatar_new ((guchar *) best_image_data,
+ best_image_size, new_mime_type, NULL, NULL);
return avatar;
}
diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c
index fed8d04cb..f83ac7a81 100644
--- a/libempathy-gtk/empathy-contact-dialogs.c
+++ b/libempathy-gtk/empathy-contact-dialogs.c
@@ -73,17 +73,11 @@ subscription_dialog_response_cb (GtkDialog *dialog,
contact = empathy_contact_widget_get_contact (contact_widget);
if (response == GTK_RESPONSE_YES) {
- EmpathyTpContactFactory *factory;
-
- factory = empathy_tp_contact_factory_dup_singleton (
- empathy_contact_get_connection (contact));
-
empathy_contact_list_add (EMPATHY_CONTACT_LIST (manager),
contact, "");
- empathy_tp_contact_factory_set_alias (factory, contact,
- empathy_contact_widget_get_alias (contact_widget));
- g_object_unref (factory);
+ empathy_contact_set_alias (contact,
+ empathy_contact_widget_get_alias (contact_widget));
}
else if (response == GTK_RESPONSE_NO) {
empathy_contact_list_remove (EMPATHY_CONTACT_LIST (manager),
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c
index ae84e3e15..ca49daec0 100644
--- a/libempathy-gtk/empathy-contact-list-view.c
+++ b/libempathy-gtk/empathy-contact-list-view.c
@@ -219,7 +219,7 @@ contact_list_view_dnd_get_contact_free (DndGetContactData *data)
}
static void
-contact_list_view_drag_got_contact (EmpathyTpContactFactory *factory,
+contact_list_view_drag_got_contact (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -293,7 +293,7 @@ contact_list_view_contact_drag_received (GtkWidget *view,
{
EmpathyContactListViewPriv *priv;
TpAccountManager *account_manager;
- EmpathyTpContactFactory *factory = NULL;
+ TpConnection *connection;
TpAccount *account;
DndGetContactData *data;
GtkTreePath *source_path;
@@ -342,20 +342,15 @@ contact_list_view_contact_drag_received (GtkWidget *view,
account = tp_account_manager_ensure_account (account_manager, account_id);
}
if (account) {
- TpConnection *connection;
-
connection = tp_account_get_connection (account);
- if (connection) {
- factory = empathy_tp_contact_factory_dup_singleton (connection);
- }
}
- g_object_unref (account_manager);
- if (!factory) {
- DEBUG ("Failed to get factory for account '%s'", account_id);
+ if (!connection) {
+ DEBUG ("Failed to get connection for account '%s'", account_id);
success = FALSE;
g_free (new_group);
g_free (old_group);
+ g_object_unref (account_manager);
return FALSE;
}
@@ -366,12 +361,12 @@ contact_list_view_contact_drag_received (GtkWidget *view,
/* FIXME: We should probably wait for the cb before calling
* gtk_drag_finish */
- empathy_tp_contact_factory_get_from_id (factory, contact_id,
+ empathy_tp_contact_factory_get_from_id (connection, contact_id,
contact_list_view_drag_got_contact,
data, (GDestroyNotify) contact_list_view_dnd_get_contact_free,
G_OBJECT (view));
g_strfreev (strv);
- g_object_unref (factory);
+ g_object_unref (account_manager);
return TRUE;
}
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index f977cce1c..05dfb7a50 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -77,7 +77,6 @@
typedef struct
{
- EmpathyTpContactFactory *factory;
EmpathyContactManager *manager;
EmpathyContact *contact;
EmpathyContactWidgetFlags flags;
@@ -957,8 +956,7 @@ contact_widget_entry_alias_focus_event_cb (GtkEditable *editable,
}
else
{
- empathy_tp_contact_factory_set_alias (information->factory,
- information->contact, alias);
+ empathy_contact_set_alias (information->contact, alias);
}
}
@@ -1060,9 +1058,7 @@ contact_widget_remove_contact (EmpathyContactWidget *information)
contact_widget_groups_notify_cb, information);
g_object_unref (information->contact);
- g_object_unref (information->factory);
information->contact = NULL;
- information->factory = NULL;
}
}
@@ -1170,13 +1166,7 @@ contact_widget_set_contact (EmpathyContactWidget *information,
contact_widget_remove_contact (information);
if (contact)
- {
- TpConnection *connection;
-
- connection = empathy_contact_get_connection (contact);
- information->contact = g_object_ref (contact);
- information->factory = empathy_tp_contact_factory_dup_singleton (connection);
- }
+ information->contact = g_object_ref (contact);
/* set the selected account to be the account this contact came from */
if (contact && EMPATHY_IS_ACCOUNT_CHOOSER (information->widget_account)) {
@@ -1194,7 +1184,7 @@ contact_widget_set_contact (EmpathyContactWidget *information,
}
static void
-contact_widget_got_contact_cb (EmpathyTpContactFactory *factory,
+contact_widget_got_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -1214,7 +1204,6 @@ contact_widget_got_contact_cb (EmpathyTpContactFactory *factory,
static void
contact_widget_change_contact (EmpathyContactWidget *information)
{
- EmpathyTpContactFactory *factory;
TpConnection *connection;
connection = empathy_account_chooser_get_connection (
@@ -1222,7 +1211,6 @@ contact_widget_change_contact (EmpathyContactWidget *information)
if (!connection)
return;
- factory = empathy_tp_contact_factory_dup_singleton (connection);
if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ID)
{
const gchar *id;
@@ -1230,20 +1218,18 @@ contact_widget_change_contact (EmpathyContactWidget *information)
id = gtk_entry_get_text (GTK_ENTRY (information->widget_id));
if (!EMP_STR_EMPTY (id))
{
- empathy_tp_contact_factory_get_from_id (factory, id,
+ empathy_tp_contact_factory_get_from_id (connection, id,
contact_widget_got_contact_cb, information, NULL,
G_OBJECT (information->vbox_contact_widget));
}
}
else
{
- empathy_tp_contact_factory_get_from_handle (factory,
+ empathy_tp_contact_factory_get_from_handle (connection,
tp_connection_get_self_handle (connection),
contact_widget_got_contact_cb, information, NULL,
G_OBJECT (information->vbox_contact_widget));
}
-
- g_object_unref (factory);
}
static gboolean
diff --git a/libempathy-gtk/empathy-new-call-dialog.c b/libempathy-gtk/empathy-new-call-dialog.c
index 1a171af5a..10d34f36c 100644
--- a/libempathy-gtk/empathy-new-call-dialog.c
+++ b/libempathy-gtk/empathy-new-call-dialog.c
@@ -69,7 +69,7 @@ struct _EmpathyNewCallDialogPriv {
*/
static void
-got_contact_cb (EmpathyTpContactFactory *factory,
+got_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -93,7 +93,6 @@ static void
empathy_new_call_dialog_response (GtkDialog *dialog, int response_id)
{
EmpathyNewCallDialogPriv *priv = GET_PRIV (dialog);
- EmpathyTpContactFactory *factory;
gboolean video;
TpConnection *connection;
const gchar *contact_id;
@@ -109,12 +108,9 @@ empathy_new_call_dialog_response (GtkDialog *dialog, int response_id)
* we return from this function. */
video = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->check_video));
- factory = empathy_tp_contact_factory_dup_singleton (connection);
- empathy_tp_contact_factory_get_from_id (factory, contact_id,
+ empathy_tp_contact_factory_get_from_id (connection, contact_id,
got_contact_cb, GUINT_TO_POINTER (video), NULL, NULL);
- g_object_unref (factory);
-
out:
gtk_widget_destroy (GTK_WIDGET (dialog));
}
diff --git a/libempathy/Makefile.am b/libempathy/Makefile.am
index 1f1423952..6d596beda 100644
--- a/libempathy/Makefile.am
+++ b/libempathy/Makefile.am
@@ -36,7 +36,6 @@ libempathy_headers = \
empathy-contact-groups.h \
empathy-contact-list.h \
empathy-contact-manager.h \
- empathy-contact-monitor.h \
empathy-contact.h \
empathy-debug.h \
empathy-dispatch-operation.h \
@@ -81,7 +80,6 @@ libempathy_la_SOURCES = \
empathy-contact-groups.c \
empathy-contact-list.c \
empathy-contact-manager.c \
- empathy-contact-monitor.c \
empathy-contact.c \
empathy-debug.c \
empathy-dispatch-operation.c \
diff --git a/libempathy/empathy-chatroom-manager.c b/libempathy/empathy-chatroom-manager.c
index d5513caf1..be91657b2 100644
--- a/libempathy/empathy-chatroom-manager.c
+++ b/libempathy/empathy-chatroom-manager.c
@@ -32,6 +32,7 @@
#include <telepathy-glib/account-manager.h>
#include <telepathy-glib/interfaces.h>
+#include <telepathy-glib/util.h>
#include "empathy-tp-chat.h"
#include "empathy-chatroom-manager.h"
@@ -118,6 +119,9 @@ chatroom_manager_file_save (EmpathyChatroomManager *manager)
xmlNewTextChild (node, NULL, (const xmlChar *) "auto_connect",
empathy_chatroom_get_auto_connect (chatroom) ?
(const xmlChar *) "yes" : (const xmlChar *) "no");
+ xmlNewTextChild (node, NULL, (const xmlChar *) "always_urgent",
+ empathy_chatroom_is_always_urgent (chatroom) ?
+ (const xmlChar *) "yes" : (const xmlChar *) "no");
}
/* Make sure the XML is indented properly */
@@ -190,6 +194,7 @@ chatroom_manager_parse_chatroom (EmpathyChatroomManager *manager,
gchar *room;
gchar *account_id;
gboolean auto_connect;
+ gboolean always_urgent;
priv = GET_PRIV (manager);
@@ -197,6 +202,7 @@ chatroom_manager_parse_chatroom (EmpathyChatroomManager *manager,
name = NULL;
room = NULL;
auto_connect = TRUE;
+ always_urgent = FALSE;
account_id = NULL;
for (child = node->children; child; child = child->next) {
@@ -222,6 +228,13 @@ chatroom_manager_parse_chatroom (EmpathyChatroomManager *manager,
auto_connect = FALSE;
}
}
+ else if (!tp_strdiff (tag, "always_urgent")) {
+ if (strcmp (str, "yes") == 0) {
+ always_urgent = TRUE;
+ } else {
+ always_urgent = FALSE;
+ }
+ }
else if (strcmp (tag, "account") == 0) {
account_id = g_strdup (str);
}
@@ -240,6 +253,7 @@ chatroom_manager_parse_chatroom (EmpathyChatroomManager *manager,
chatroom = empathy_chatroom_new_full (account, room, name, auto_connect);
empathy_chatroom_set_favorite (chatroom, TRUE);
+ empathy_chatroom_set_always_urgent (chatroom, always_urgent);
add_chatroom (manager, chatroom);
g_signal_emit (manager, signals[CHATROOM_ADDED], 0, chatroom);
@@ -632,6 +646,28 @@ empathy_chatroom_manager_find (EmpathyChatroomManager *manager,
return NULL;
}
+EmpathyChatroom *
+empathy_chatroom_manager_ensure_chatroom (EmpathyChatroomManager *manager,
+ TpAccount *account,
+ const gchar *room,
+ const gchar *name)
+{
+ EmpathyChatroom *chatroom;
+
+ chatroom = empathy_chatroom_manager_find (manager, account, room);
+
+ if (chatroom) {
+ return g_object_ref (chatroom);
+ } else {
+ chatroom = empathy_chatroom_new_full (account,
+ room,
+ name,
+ FALSE);
+ empathy_chatroom_manager_add (manager, chatroom);
+ return chatroom;
+ }
+}
+
GList *
empathy_chatroom_manager_get_chatrooms (EmpathyChatroomManager *manager,
TpAccount *account)
diff --git a/libempathy/empathy-chatroom-manager.dtd b/libempathy/empathy-chatroom-manager.dtd
index df6b953f6..d40cae23a 100644
--- a/libempathy/empathy-chatroom-manager.dtd
+++ b/libempathy/empathy-chatroom-manager.dtd
@@ -8,10 +8,11 @@
<!ELEMENT chatrooms (chatroom*)>
<!ELEMENT chatroom
- (name,room,account,(auto_connect?))>
+ (name,room,account,(auto_connect?),(always_urgent?))>
<!ELEMENT name (#PCDATA)>
<!ELEMENT room (#PCDATA)>
<!ELEMENT auto_connect (#PCDATA)>
+<!ELEMENT always_urgent (#PCDATA)>
<!ELEMENT account (#PCDATA)>
diff --git a/libempathy/empathy-chatroom-manager.h b/libempathy/empathy-chatroom-manager.h
index 8ee2a897a..9a1de1828 100644
--- a/libempathy/empathy-chatroom-manager.h
+++ b/libempathy/empathy-chatroom-manager.h
@@ -62,6 +62,10 @@ void empathy_chatroom_manager_remove (EmpathyChatroomMa
EmpathyChatroom * empathy_chatroom_manager_find (EmpathyChatroomManager *manager,
TpAccount *account,
const gchar *room);
+EmpathyChatroom * empathy_chatroom_manager_ensure_chatroom (EmpathyChatroomManager *manager,
+ TpAccount *account,
+ const gchar *room,
+ const gchar *name);
GList * empathy_chatroom_manager_get_chatrooms (EmpathyChatroomManager *manager,
TpAccount *account);
guint empathy_chatroom_manager_get_count (EmpathyChatroomManager *manager,
diff --git a/libempathy/empathy-chatroom.c b/libempathy/empathy-chatroom.c
index 5d43a3ec1..5e3784ae7 100644
--- a/libempathy/empathy-chatroom.c
+++ b/libempathy/empathy-chatroom.c
@@ -41,6 +41,7 @@ typedef struct {
guint members_count;
gboolean invite_only;
gboolean need_password;
+ gboolean always_urgent;
} EmpathyChatroomPriv;
@@ -65,7 +66,8 @@ enum {
PROP_SUBJECT,
PROP_MEMBERS_COUNT,
PROP_NEED_PASSWORD,
- PROP_INVITE_ONLY
+ PROP_INVITE_ONLY,
+ PROP_ALWAYS_URGENT,
};
G_DEFINE_TYPE (EmpathyChatroom, empathy_chatroom, G_TYPE_OBJECT);
@@ -121,6 +123,14 @@ empathy_chatroom_class_init (EmpathyChatroomClass *klass)
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class,
+ PROP_ALWAYS_URGENT,
+ g_param_spec_boolean ("always_urgent",
+ "Always Urgent",
+ "TRUE if every message should be considered urgent",
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
PROP_TP_CHAT,
g_param_spec_object ("tp-chat",
"Chatroom channel wrapper",
@@ -233,6 +243,9 @@ chatroom_get_property (GObject *object,
case PROP_FAVORITE:
g_value_set_boolean (value, priv->favorite);
break;
+ case PROP_ALWAYS_URGENT:
+ g_value_set_boolean (value, priv->always_urgent);
+ break;
case PROP_TP_CHAT:
g_value_set_object (value, priv->tp_chat);
break;
@@ -285,6 +298,10 @@ chatroom_set_property (GObject *object,
empathy_chatroom_set_favorite (EMPATHY_CHATROOM (object),
g_value_get_boolean (value));
break;
+ case PROP_ALWAYS_URGENT:
+ empathy_chatroom_set_always_urgent (EMPATHY_CHATROOM (object),
+ g_value_get_boolean (value));
+ break;
case PROP_TP_CHAT:
empathy_chatroom_set_tp_chat (EMPATHY_CHATROOM (object),
g_value_get_object (value));
@@ -663,3 +680,32 @@ empathy_chatroom_set_favorite (EmpathyChatroom *chatroom,
g_object_notify (G_OBJECT (chatroom), "favorite");
}
+gboolean
+empathy_chatroom_is_always_urgent (EmpathyChatroom *chatroom)
+{
+ EmpathyChatroomPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_CHATROOM (chatroom), FALSE);
+
+ priv = GET_PRIV (chatroom);
+
+ return priv->always_urgent;
+}
+
+void
+empathy_chatroom_set_always_urgent (EmpathyChatroom *chatroom,
+ gboolean always_urgent)
+{
+ EmpathyChatroomPriv *priv;
+
+ g_return_if_fail (EMPATHY_IS_CHATROOM (chatroom));
+
+ priv = GET_PRIV (chatroom);
+
+ if (priv->always_urgent == always_urgent)
+ return;
+
+ priv->always_urgent = always_urgent;
+ g_object_notify (G_OBJECT (chatroom), "always_urgent");
+}
+
diff --git a/libempathy/empathy-chatroom.h b/libempathy/empathy-chatroom.h
index 3048aded7..f86f8ca9e 100644
--- a/libempathy/empathy-chatroom.h
+++ b/libempathy/empathy-chatroom.h
@@ -89,6 +89,9 @@ void empathy_chatroom_set_tp_chat (EmpathyChatroom *chatroom,
gboolean empathy_chatroom_is_favorite (EmpathyChatroom *chatroom);
void empathy_chatroom_set_favorite (EmpathyChatroom *chatroom,
gboolean favorite);
+gboolean empathy_chatroom_is_always_urgent (EmpathyChatroom *chatroom);
+void empathy_chatroom_set_always_urgent (EmpathyChatroom *chatroom,
+ gboolean always_urgent);
G_END_DECLS
diff --git a/libempathy/empathy-contact-list.c b/libempathy/empathy-contact-list.c
index 0a3d361d4..5cbe1cb15 100644
--- a/libempathy/empathy-contact-list.c
+++ b/libempathy/empathy-contact-list.c
@@ -143,18 +143,6 @@ empathy_contact_list_get_members (EmpathyContactList *list)
return NULL;
}
-EmpathyContactMonitor *
-empathy_contact_list_get_monitor (EmpathyContactList *list)
-{
- g_return_val_if_fail (EMPATHY_IS_CONTACT_LIST (list), NULL);
-
- if (EMPATHY_CONTACT_LIST_GET_IFACE (list)->get_monitor) {
- return EMPATHY_CONTACT_LIST_GET_IFACE (list)->get_monitor (list);
- }
-
- return NULL;
-}
-
GList *
empathy_contact_list_get_pendings (EmpathyContactList *list)
{
diff --git a/libempathy/empathy-contact-list.h b/libempathy/empathy-contact-list.h
index 8d2f445e1..3817af876 100644
--- a/libempathy/empathy-contact-list.h
+++ b/libempathy/empathy-contact-list.h
@@ -69,8 +69,6 @@ struct _EmpathyContactListIface {
const gchar *new_group);
void (*remove_group) (EmpathyContactList *list,
const gchar *group);
- EmpathyContactMonitor *
- (*get_monitor) (EmpathyContactList *list);
EmpathyContactListFlags
(*get_flags) (EmpathyContactList *list);
gboolean (*is_favourite) (EmpathyContactList *list,
@@ -104,8 +102,6 @@ void empathy_contact_list_rename_group (EmpathyContactList *list,
const gchar *new_group);
void empathy_contact_list_remove_group (EmpathyContactList *list,
const gchar *group);
-EmpathyContactMonitor *
- empathy_contact_list_get_monitor (EmpathyContactList *list);
EmpathyContactListFlags
empathy_contact_list_get_flags (EmpathyContactList *list);
diff --git a/libempathy/empathy-contact-manager.c b/libempathy/empathy-contact-manager.c
index e0b51aafa..a900fa610 100644
--- a/libempathy/empathy-contact-manager.c
+++ b/libempathy/empathy-contact-manager.c
@@ -31,7 +31,6 @@
#include <extensions/extensions.h>
#include "empathy-contact-manager.h"
-#include "empathy-contact-monitor.h"
#include "empathy-contact-list.h"
#include "empathy-utils.h"
@@ -44,7 +43,6 @@ typedef struct {
The contact list associated with each connected connection */
GHashTable *lists;
TpAccountManager *account_manager;
- EmpathyContactMonitor *contact_monitor;
TpProxy *logger;
/* account object path (gchar *) => GHashTable containing favorite contacts
* (contact ID (gchar *) => TRUE) */
@@ -378,10 +376,6 @@ contact_manager_finalize (GObject *object)
g_hash_table_destroy (priv->favourites);
g_object_unref (priv->account_manager);
-
- if (priv->contact_monitor) {
- g_object_unref (priv->contact_monitor);
- }
}
static GObject *
@@ -583,7 +577,6 @@ empathy_contact_manager_init (EmpathyContactManager *manager)
g_hash_table_unref);
priv->account_manager = tp_account_manager_dup ();
- priv->contact_monitor = NULL;
tp_account_manager_prepare_async (priv->account_manager, NULL,
account_manager_prepared_cb, manager);
@@ -698,18 +691,6 @@ contact_manager_get_members (EmpathyContactList *manager)
return contacts;
}
-static EmpathyContactMonitor *
-contact_manager_get_monitor (EmpathyContactList *manager)
-{
- EmpathyContactManagerPriv *priv = GET_PRIV (manager);
-
- if (priv->contact_monitor == NULL) {
- priv->contact_monitor = empathy_contact_monitor_new_for_iface (manager);
- }
-
- return priv->contact_monitor;
-}
-
static void
contact_manager_get_pendings_foreach (TpConnection *connection,
EmpathyTpContactList *list,
@@ -889,7 +870,6 @@ contact_manager_iface_init (EmpathyContactListIface *iface)
iface->add = contact_manager_add;
iface->remove = contact_manager_remove;
iface->get_members = contact_manager_get_members;
- iface->get_monitor = contact_manager_get_monitor;
iface->get_pendings = contact_manager_get_pendings;
iface->get_all_groups = contact_manager_get_all_groups;
iface->get_groups = contact_manager_get_groups;
diff --git a/libempathy/empathy-contact-monitor.c b/libempathy/empathy-contact-monitor.c
deleted file mode 100644
index f41b8bd5c..000000000
--- a/libempathy/empathy-contact-monitor.c
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- * Copyright (C) 2008 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Authors: Cosimo Cecchi <cosimo.cecchi@collabora.co.uk>
- */
-
-#include "config.h"
-
-#include <glib-object.h>
-
-#include "empathy-contact-monitor.h"
-#include "empathy-contact-list.h"
-
-#include "empathy-contact.h"
-#include "empathy-utils.h"
-#include "empathy-marshal.h"
-
-#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyContactMonitor)
-
-typedef struct {
- EmpathyContactList *iface;
- GList *contacts;
-
- gboolean dispose_run;
-} EmpathyContactMonitorPriv;
-
-enum {
- CONTACT_ADDED,
- CONTACT_AVATAR_CHANGED,
- CONTACT_CAPABILITIES_CHANGED,
- CONTACT_NAME_CHANGED,
- CONTACT_PRESENCE_CHANGED,
- CONTACT_PRESENCE_MESSAGE_CHANGED,
- CONTACT_REMOVED,
- LAST_SIGNAL
-};
-
-enum {
- PROP_0,
- PROP_IFACE
-};
-
-static guint signals[LAST_SIGNAL];
-
-G_DEFINE_TYPE (EmpathyContactMonitor, empathy_contact_monitor, G_TYPE_OBJECT);
-
-static void
-contact_monitor_presence_changed_cb (EmpathyContact *contact,
- TpConnectionPresenceType current_presence,
- TpConnectionPresenceType previous_presence,
- EmpathyContactMonitor *self)
-{
- g_signal_emit (self, signals[CONTACT_PRESENCE_CHANGED], 0, contact,
- current_presence, previous_presence);
-}
-
-static void
-contact_monitor_presence_message_changed_cb (EmpathyContact *contact,
- GParamSpec *pspec,
- EmpathyContactMonitor *self)
-{
- const char *status;
-
- /* use the status so that we always have a presence message */
- status = empathy_contact_get_status (contact);
-
- g_signal_emit (self, signals[CONTACT_PRESENCE_MESSAGE_CHANGED], 0,
- contact, status);
-}
-
-static void
-contact_monitor_name_changed_cb (EmpathyContact *contact,
- GParamSpec *pspec,
- EmpathyContactMonitor *self)
-{
- const char *name;
-
- name = empathy_contact_get_name (contact);
-
- g_signal_emit (self, signals[CONTACT_NAME_CHANGED], 0, contact, name);
-}
-
-static void
-contact_monitor_avatar_changed_cb (EmpathyContact *contact,
- GParamSpec *pspec,
- EmpathyContactMonitor *self)
-{
- /* don't emit a pixbuf in the signal, as we don't depend on GTK+ here
- */
-
- g_signal_emit (self, signals[CONTACT_AVATAR_CHANGED], 0, contact);
-}
-
-static void
-contact_monitor_capabilities_changed_cb (EmpathyContact *contact,
- GParamSpec *pspec,
- EmpathyContactMonitor *self)
-{
- g_signal_emit (self, signals[CONTACT_CAPABILITIES_CHANGED], 0, contact);
-}
-
-static void
-contact_add (EmpathyContactMonitor *monitor,
- EmpathyContact *contact)
-{
- EmpathyContactMonitorPriv *priv = GET_PRIV (monitor);
-
- g_signal_connect (contact, "presence-changed",
- G_CALLBACK (contact_monitor_presence_changed_cb),
- monitor);
- g_signal_connect (contact, "notify::presence-message",
- G_CALLBACK (contact_monitor_presence_message_changed_cb),
- monitor);
- g_signal_connect (contact, "notify::name",
- G_CALLBACK (contact_monitor_name_changed_cb),
- monitor);
- g_signal_connect (contact, "notify::avatar",
- G_CALLBACK (contact_monitor_avatar_changed_cb),
- monitor);
- g_signal_connect (contact, "notify::capabilities",
- G_CALLBACK (contact_monitor_capabilities_changed_cb),
- monitor);
-
- priv->contacts = g_list_prepend (priv->contacts, g_object_ref (contact));
-
- g_signal_emit (monitor, signals[CONTACT_ADDED], 0, contact);
-}
-
-static void
-contact_remove (EmpathyContactMonitor *monitor,
- EmpathyContact *contact)
-{
- EmpathyContactMonitorPriv *priv = GET_PRIV (monitor);
-
- g_signal_handlers_disconnect_by_func (contact,
- G_CALLBACK (contact_monitor_presence_changed_cb),
- monitor);
- g_signal_handlers_disconnect_by_func (contact,
- G_CALLBACK (contact_monitor_presence_message_changed_cb),
- monitor);
- g_signal_handlers_disconnect_by_func (contact,
- G_CALLBACK (contact_monitor_name_changed_cb),
- monitor);
- g_signal_handlers_disconnect_by_func (contact,
- G_CALLBACK (contact_monitor_avatar_changed_cb),
- monitor);
- g_signal_handlers_disconnect_by_func (contact,
- G_CALLBACK (contact_monitor_capabilities_changed_cb),
- monitor);
-
- priv->contacts = g_list_remove (priv->contacts, contact);
-
- g_signal_emit (monitor, signals[CONTACT_REMOVED], 0, contact);
-
- g_object_unref (contact);
-}
-
-static void
-contact_remove_foreach (EmpathyContact *contact,
- EmpathyContactMonitor *monitor)
-{
- contact_remove (monitor, contact);
-}
-
-static void
-cl_members_changed_cb (EmpathyContactList *cl,
- EmpathyContact *contact,
- EmpathyContact *actor,
- guint reason,
- gchar *message,
- gboolean is_member,
- EmpathyContactMonitor *monitor)
-{
- if (is_member)
- contact_add (monitor, contact);
- else
- contact_remove (monitor, contact);
-}
-
-static void
-do_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- switch (param_id)
- {
- case PROP_IFACE:
- empathy_contact_monitor_set_iface (EMPATHY_CONTACT_MONITOR (object),
- g_value_get_object (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- };
-}
-
-static void
-do_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EmpathyContactMonitorPriv *priv = GET_PRIV (object);
-
- switch (param_id)
- {
- case PROP_IFACE:
- g_value_set_object (value, priv->iface);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- };
-}
-
-static void
-do_finalize (GObject *obj)
-{
- EmpathyContactMonitorPriv *priv;
-
- priv = GET_PRIV (obj);
-
- if (priv->contacts)
- {
- g_list_free (priv->contacts);
- priv->contacts = NULL;
- }
-
- if (priv->iface)
- g_signal_handlers_disconnect_by_func (priv->iface,
- cl_members_changed_cb, obj);
-
- G_OBJECT_CLASS (empathy_contact_monitor_parent_class)->finalize (obj);
-}
-
-static void
-do_dispose (GObject *obj)
-{
- EmpathyContactMonitorPriv *priv;
-
- priv = GET_PRIV (obj);
-
- if (priv->dispose_run)
- return;
-
- priv->dispose_run = TRUE;
-
- if (priv->contacts)
- g_list_foreach (priv->contacts,
- (GFunc) contact_remove_foreach, obj);
-
- if (priv->iface)
- g_signal_handlers_disconnect_by_func (priv->iface,
- cl_members_changed_cb, obj);
-
- G_OBJECT_CLASS (empathy_contact_monitor_parent_class)->dispose (obj);
-}
-
-static void
-empathy_contact_monitor_class_init (EmpathyContactMonitorClass *klass)
-{
- GObjectClass *oclass = G_OBJECT_CLASS (klass);
-
- oclass->finalize = do_finalize;
- oclass->dispose = do_dispose;
- oclass->get_property = do_get_property;
- oclass->set_property = do_set_property;
-
- g_object_class_install_property (oclass,
- PROP_IFACE,
- g_param_spec_object ("iface",
- "Monitor's iface",
- "The contact list we're monitoring",
- EMPATHY_TYPE_CONTACT_LIST,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
-
- signals[CONTACT_ADDED] =
- g_signal_new ("contact-added",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE,
- 1, EMPATHY_TYPE_CONTACT);
- signals[CONTACT_AVATAR_CHANGED] =
- g_signal_new ("contact-avatar-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE,
- 1, EMPATHY_TYPE_CONTACT);
- signals[CONTACT_CAPABILITIES_CHANGED] =
- g_signal_new ("contact-capabilities-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE,
- 1, EMPATHY_TYPE_CONTACT);
- signals[CONTACT_NAME_CHANGED] =
- g_signal_new ("contact-name-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- _empathy_marshal_VOID__OBJECT_STRING,
- G_TYPE_NONE,
- 2, EMPATHY_TYPE_CONTACT,
- G_TYPE_STRING);
- signals[CONTACT_PRESENCE_CHANGED] =
- g_signal_new ("contact-presence-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- _empathy_marshal_VOID__OBJECT_UINT_UINT,
- G_TYPE_NONE,
- 3, EMPATHY_TYPE_CONTACT,
- G_TYPE_UINT,
- G_TYPE_UINT);
- signals[CONTACT_PRESENCE_MESSAGE_CHANGED] =
- g_signal_new ("contact-presence-message-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- _empathy_marshal_VOID__OBJECT_STRING,
- G_TYPE_NONE,
- 2, EMPATHY_TYPE_CONTACT,
- G_TYPE_STRING);
- signals[CONTACT_REMOVED] =
- g_signal_new ("contact-removed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE,
- 1, EMPATHY_TYPE_CONTACT);
-
- g_type_class_add_private (klass, sizeof (EmpathyContactMonitorPriv));
-}
-
-static void
-empathy_contact_monitor_init (EmpathyContactMonitor *self)
-{
- EmpathyContactMonitorPriv *priv =
- G_TYPE_INSTANCE_GET_PRIVATE (self, EMPATHY_TYPE_CONTACT_MONITOR,
- EmpathyContactMonitorPriv);
-
- self->priv = priv;
- priv->contacts = NULL;
- priv->iface = NULL;
- priv->dispose_run = FALSE;
-}
-
-/* public methods */
-
-void
-empathy_contact_monitor_set_iface (EmpathyContactMonitor *self,
- EmpathyContactList *iface)
-{
- EmpathyContactMonitorPriv *priv;
-
- g_return_if_fail (EMPATHY_IS_CONTACT_MONITOR (self));
- g_return_if_fail (EMPATHY_IS_CONTACT_LIST (iface));
-
- priv = GET_PRIV (self);
-
- if (priv->contacts != NULL)
- {
- g_list_foreach (priv->contacts,
- (GFunc) contact_remove_foreach, self);
- g_list_free (priv->contacts);
- priv->contacts = NULL;
- }
-
- priv->iface = iface;
-
- g_signal_connect (iface, "members-changed",
- G_CALLBACK (cl_members_changed_cb), self);
-}
-
-EmpathyContactMonitor *
-empathy_contact_monitor_new_for_iface (EmpathyContactList *iface)
-{
- EmpathyContactMonitor *retval;
-
- g_return_val_if_fail (EMPATHY_IS_CONTACT_LIST (iface), NULL);
-
- retval = g_object_new (EMPATHY_TYPE_CONTACT_MONITOR,
- "iface", iface, NULL);
-
- return retval;
-}
-
diff --git a/libempathy/empathy-contact-monitor.h b/libempathy/empathy-contact-monitor.h
deleted file mode 100644
index 51957d1d6..000000000
--- a/libempathy/empathy-contact-monitor.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
-/*
- * Copyright (C) 2008 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Authors: Cosimo Cecchi <cosimo.cecchi@collabora.co.uk>
- */
-
-#ifndef __EMPATHY_CONTACT_MONITOR_H__
-#define __EMPATHY_CONTACT_MONITOR_H__
-
-#include <glib-object.h>
-
-#include "empathy-types.h"
-
-G_BEGIN_DECLS
-
-#define EMPATHY_TYPE_CONTACT_MONITOR (empathy_contact_monitor_get_type ())
-#define EMPATHY_CONTACT_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_CONTACT_MONITOR, EmpathyContactMonitor))
-#define EMPATHY_CONTACT_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_CONTACT_MONITOR, EmpathyContactMonitorClass))
-#define EMPATHY_IS_CONTACT_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_CONTACT_MONITOR))
-#define EMPATHY_IS_CONTACT_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_CONTACT_MONITOR))
-#define EMPATHY_CONTACT_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_CONTACT_MONITOR, EmpathyContactMonitorClass))
-
-typedef struct _EmpathyContactMonitorClass EmpathyContactMonitorClass;
-
-struct _EmpathyContactMonitor {
- GObject parent;
- gpointer priv;
-};
-
-struct _EmpathyContactMonitorClass {
- GObjectClass parent_class;
-};
-
-GType empathy_contact_monitor_get_type (void);
-
-/* public methods */
-
-void
-empathy_contact_monitor_set_iface (EmpathyContactMonitor *self,
- EmpathyContactList *iface);
-
-EmpathyContactMonitor *
-empathy_contact_monitor_new_for_iface (EmpathyContactList *iface);
-
-G_END_DECLS
-
-#endif /* __EMPATHY_CONTACT_MONITOR_H__ */
-
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index 1d544d8e8..bd8a63efa 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -84,6 +84,8 @@ static void empathy_contact_set_location (EmpathyContact *contact,
static void set_capabilities_from_tp_caps (EmpathyContact *self,
TpCapabilities *caps);
+static void contact_set_avatar_from_tp_contact (EmpathyContact *contact);
+
G_DEFINE_TYPE (EmpathyContact, empathy_contact, G_TYPE_OBJECT);
enum
@@ -109,6 +111,9 @@ enum {
static guint signals[LAST_SIGNAL];
+/* TpContact* -> EmpathyContact*, both borrowed ref */
+static GHashTable *contacts_table = NULL;
+
static void
tp_contact_notify_cb (TpContact *tp_contact,
GParamSpec *param,
@@ -147,6 +152,10 @@ tp_contact_notify_cb (TpContact *tp_contact,
set_capabilities_from_tp_caps (EMPATHY_CONTACT (contact),
tp_contact_get_capabilities (tp_contact));
}
+ else if (!tp_strdiff (param->name, "avatar-file"))
+ {
+ contact_set_avatar_from_tp_contact (EMPATHY_CONTACT (contact));
+ }
}
static void
@@ -156,6 +165,7 @@ contact_dispose (GObject *object)
if (priv->tp_contact)
{
+ g_hash_table_remove (contacts_table, priv->tp_contact);
g_signal_handlers_disconnect_by_func (priv->tp_contact,
tp_contact_notify_cb, object);
g_object_unref (priv->tp_contact);
@@ -334,6 +344,8 @@ set_tp_contact (EmpathyContact *contact,
{
EmpathyContactPriv *priv = GET_PRIV (contact);
GHashTable *location;
+ TpHandle self_handle;
+ TpHandle handle;
if (tp_contact == NULL)
return;
@@ -349,6 +361,16 @@ set_tp_contact (EmpathyContact *contact,
set_capabilities_from_tp_caps (contact,
tp_contact_get_capabilities (tp_contact));
+ contact_set_avatar_from_tp_contact (contact);
+
+ /* Set is-user property. Note that it could still be the handle is
+ * different from the connection's self handle, in the case the handle
+ * comes from a group interface. */
+ self_handle = tp_connection_get_self_handle (
+ tp_contact_get_connection (tp_contact));
+ handle = tp_contact_get_handle (tp_contact);
+ empathy_contact_set_is_user (contact, self_handle == handle);
+
g_signal_connect (priv->tp_contact, "notify",
G_CALLBACK (tp_contact_notify_cb), contact);
}
@@ -596,6 +618,44 @@ empathy_contact_set_name (EmpathyContact *contact,
g_object_unref (contact);
}
+static void
+contact_set_aliases_cb (TpConnection *connection,
+ const GError *error,
+ gpointer user_data,
+ GObject *weak_object)
+{
+ if (error)
+ DEBUG ("Error: %s", error->message);
+}
+
+void
+empathy_contact_set_alias (EmpathyContact *contact,
+ const gchar *alias)
+{
+ TpConnection *connection;
+ GHashTable *new_alias;
+ guint handle;
+
+ g_return_if_fail (EMPATHY_IS_CONTACT (contact));
+
+ handle = empathy_contact_get_handle (contact);
+
+ DEBUG ("Setting alias for contact %s (%d) to %s",
+ empathy_contact_get_id (contact),
+ handle, alias);
+
+ new_alias = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL,
+ g_free);
+
+ g_hash_table_insert (new_alias, GUINT_TO_POINTER (handle), g_strdup (alias));
+
+ connection = empathy_contact_get_connection (contact);
+ tp_cli_connection_interface_aliasing_call_set_aliases (connection, -1,
+ new_alias, contact_set_aliases_cb, NULL, NULL, NULL);
+
+ g_hash_table_destroy (new_alias);
+}
+
EmpathyAvatar *
empathy_contact_get_avatar (EmpathyContact *contact)
{
@@ -957,44 +1017,6 @@ contact_get_avatar_filename (EmpathyContact *contact,
return avatar_file;
}
-void
-empathy_contact_load_avatar_data (EmpathyContact *contact,
- const guchar *data,
- const gsize len,
- const gchar *format,
- const gchar *token)
-{
- EmpathyAvatar *avatar;
- gchar *filename;
- GError *error = NULL;
-
- g_return_if_fail (EMPATHY_IS_CONTACT (contact));
- g_return_if_fail (data != NULL);
- g_return_if_fail (len > 0);
- g_return_if_fail (format != NULL);
- g_return_if_fail (!EMP_STR_EMPTY (token));
-
- /* Load and set the avatar */
- filename = contact_get_avatar_filename (contact, token);
- avatar = empathy_avatar_new (g_memdup (data, len), len, g_strdup (format),
- g_strdup (token), filename);
- empathy_contact_set_avatar (contact, avatar);
- empathy_avatar_unref (avatar);
-
- /* Save to cache if not yet in it */
- if (filename && !g_file_test (filename, G_FILE_TEST_EXISTS))
- {
- if (!empathy_avatar_save_to_file (avatar, filename, &error))
- {
- DEBUG ("Failed to save avatar in cache: %s",
- error ? error->message : "No error given");
- g_clear_error (&error);
- }
- else
- DEBUG ("Avatar saved to %s", filename);
- }
-}
-
gboolean
empathy_contact_load_avatar_cache (EmpathyContact *contact,
const gchar *token)
@@ -1465,3 +1487,63 @@ set_capabilities_from_tp_caps (EmpathyContact *self,
capabilities = tp_caps_to_capabilities (caps);
empathy_contact_set_capabilities (self, capabilities);
}
+
+static void
+contact_set_avatar_from_tp_contact (EmpathyContact *contact)
+{
+ EmpathyContactPriv *priv = GET_PRIV (contact);
+ const gchar *mime;
+ const gchar *token;
+ GFile *file;
+
+ token = tp_contact_get_avatar_token (priv->tp_contact);
+ mime = tp_contact_get_avatar_mime_type (priv->tp_contact);
+ file = tp_contact_get_avatar_file (priv->tp_contact);
+
+ if (file != NULL)
+ {
+ EmpathyAvatar *avatar;
+ gchar *data;
+ gsize len;
+
+ g_file_load_contents (file, NULL, &data, &len, NULL, NULL);
+ avatar = empathy_avatar_new ((guchar *) data, len, g_strdup (mime), g_strdup (token),
+ g_file_get_path (file));
+ empathy_contact_set_avatar (contact, avatar);
+ empathy_avatar_unref (avatar);
+ }
+ else
+ {
+ empathy_contact_set_avatar (contact, NULL);
+ }
+}
+
+EmpathyContact *
+empathy_contact_dup_from_tp_contact (TpContact *tp_contact)
+{
+ EmpathyContact *contact = NULL;
+
+ g_return_val_if_fail (TP_IS_CONTACT (tp_contact), NULL);
+
+ if (contacts_table == NULL)
+ contacts_table = g_hash_table_new (g_direct_hash, g_direct_equal);
+ else
+ contact = g_hash_table_lookup (contacts_table, tp_contact);
+
+ if (contact == NULL)
+ {
+ contact = empathy_contact_new (tp_contact);
+
+ /* The hash table does not keep any ref.
+ * contact keeps a ref to tp_contact, and is removed from the table in
+ * contact_dispose() */
+ g_hash_table_insert (contacts_table, tp_contact, contact);
+ }
+ else
+ {
+ g_object_ref (contact);
+ }
+
+ return contact;
+}
+
diff --git a/libempathy/empathy-contact.h b/libempathy/empathy-contact.h
index 002930bd5..568ecd537 100644
--- a/libempathy/empathy-contact.h
+++ b/libempathy/empathy-contact.h
@@ -84,6 +84,7 @@ const gchar * empathy_contact_get_id (EmpathyContact *contact);
void empathy_contact_set_id (EmpathyContact *contact, const gchar *id);
const gchar * empathy_contact_get_name (EmpathyContact *contact);
void empathy_contact_set_name (EmpathyContact *contact, const gchar *name);
+void empathy_contact_set_alias (EmpathyContact *contact, const gchar *alias);
EmpathyAvatar * empathy_contact_get_avatar (EmpathyContact *contact);
void empathy_contact_set_avatar (EmpathyContact *contact,
EmpathyAvatar *avatar);
@@ -110,10 +111,6 @@ gboolean empathy_contact_can_voip_audio (EmpathyContact *contact);
gboolean empathy_contact_can_voip_video (EmpathyContact *contact);
gboolean empathy_contact_can_send_files (EmpathyContact *contact);
gboolean empathy_contact_can_use_stream_tube (EmpathyContact *contact);
-
-void empathy_contact_load_avatar_data (EmpathyContact *contact,
- const guchar *data, const gsize len, const gchar *format,
- const gchar *token);
gboolean empathy_contact_load_avatar_cache (EmpathyContact *contact,
const gchar *token);
@@ -135,6 +132,8 @@ GHashTable * empathy_contact_get_location (EmpathyContact *contact);
gboolean empathy_contact_equal (gconstpointer contact1,
gconstpointer contact2);
+EmpathyContact *empathy_contact_dup_from_tp_contact (TpContact *tp_contact);
+
G_END_DECLS
#endif /* __EMPATHY_CONTACT_H__ */
diff --git a/libempathy/empathy-dispatch-operation.c b/libempathy/empathy-dispatch-operation.c
index 08013889e..f6cc0d6ef 100644
--- a/libempathy/empathy-dispatch-operation.c
+++ b/libempathy/empathy-dispatch-operation.c
@@ -185,7 +185,7 @@ empathy_dispatch_operation_invalidated (TpProxy *proxy, guint domain,
}
static void
-dispatcher_operation_got_contact_cb (EmpathyTpContactFactory *factory,
+dispatcher_operation_got_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -219,7 +219,6 @@ dispatch_operation_connection_ready (TpConnection *connection,
{
EmpathyDispatchOperation *self = EMPATHY_DISPATCH_OPERATION (user_data);
EmpathyDispatchOperationPriv *priv = GET_PRIV (self);
- EmpathyTpContactFactory *factory;
TpHandle handle;
if (error != NULL)
@@ -231,12 +230,9 @@ dispatch_operation_connection_ready (TpConnection *connection,
handle = tp_channel_get_handle (priv->channel, NULL);
- factory = empathy_tp_contact_factory_dup_singleton (priv->connection);
-
- empathy_tp_contact_factory_get_from_handle (factory, handle,
+ empathy_tp_contact_factory_get_from_handle (priv->connection, handle,
dispatcher_operation_got_contact_cb, NULL, NULL, G_OBJECT (self));
- g_object_unref (factory);
out:
g_object_unref (self);
}
diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c
index e476fc671..c8943c9df 100644
--- a/libempathy/empathy-dispatcher.c
+++ b/libempathy/empathy-dispatcher.c
@@ -1357,7 +1357,7 @@ typedef struct
} ChatWithContactIdData;
static void
-dispatcher_chat_with_contact_id_cb (EmpathyTpContactFactory *factory,
+dispatcher_chat_with_contact_id_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -1392,23 +1392,19 @@ empathy_dispatcher_chat_with_contact_id (TpConnection *connection,
gpointer user_data)
{
EmpathyDispatcher *self;
- EmpathyTpContactFactory *factory;
ChatWithContactIdData *data;
g_return_if_fail (TP_IS_CONNECTION (connection));
g_return_if_fail (!EMP_STR_EMPTY (contact_id));
self = empathy_dispatcher_dup_singleton ();
- factory = empathy_tp_contact_factory_dup_singleton (connection);
data = g_slice_new0 (ChatWithContactIdData);
data->dispatcher = self;
data->callback = callback;
data->user_data = user_data;
data->timestamp = timestamp;
- empathy_tp_contact_factory_get_from_id (factory, contact_id,
+ empathy_tp_contact_factory_get_from_id (connection, contact_id,
dispatcher_chat_with_contact_id_cb, data, NULL, NULL);
-
- g_object_unref (factory);
}
static void
diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c
index bbc99f61a..0140fc3cc 100644
--- a/libempathy/empathy-ft-handler.c
+++ b/libempathy/empathy-ft-handler.c
@@ -1203,7 +1203,7 @@ out:
}
static void
-contact_factory_contact_cb (EmpathyTpContactFactory *factory,
+contact_factory_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -1238,7 +1238,6 @@ channel_get_all_properties_cb (TpProxy *proxy,
CallbacksData *cb_data = user_data;
EmpathyFTHandler *handler = EMPATHY_FT_HANDLER (weak_object);
EmpathyFTHandlerPriv *priv = GET_PRIV (handler);
- EmpathyTpContactFactory *c_factory;
TpHandle c_handle;
if (error != NULL)
@@ -1273,14 +1272,11 @@ channel_get_all_properties_cb (TpProxy *proxy,
priv->description = g_value_dup_string (
g_hash_table_lookup (properties, "Description"));
- c_factory = empathy_tp_contact_factory_dup_singleton
- (tp_channel_borrow_connection (TP_CHANNEL (proxy)));
c_handle = tp_channel_get_handle (TP_CHANNEL (proxy), NULL);
- empathy_tp_contact_factory_get_from_handle (c_factory, c_handle,
+ empathy_tp_contact_factory_get_from_handle (
+ tp_channel_borrow_connection (TP_CHANNEL (proxy)), c_handle,
contact_factory_contact_cb, cb_data, callbacks_data_free,
G_OBJECT (handler));
-
- g_object_unref (c_factory);
}
/* public methods */
diff --git a/libempathy/empathy-log-store-empathy.c b/libempathy/empathy-log-store-empathy.c
index 2088fca03..1aa8c049e 100644
--- a/libempathy/empathy-log-store-empathy.c
+++ b/libempathy/empathy-log-store-empathy.c
@@ -620,20 +620,22 @@ log_store_empathy_search_new (EmpathyLogStore *self,
gchar *filename;
GMappedFile *file;
gsize length;
- gchar *contents;
- gchar *contents_casefold;
+ gchar *contents = NULL;
+ gchar *contents_casefold = NULL;
filename = l->data;
file = g_mapped_file_new (filename, FALSE, NULL);
- if (!file)
- continue;
+ if (file == NULL)
+ goto drinking_island;
length = g_mapped_file_get_length (file);
contents = g_mapped_file_get_contents (file);
- contents_casefold = g_utf8_casefold (contents, length);
- g_mapped_file_unref (file);
+ if (length == 0 || contents == NULL)
+ goto drinking_island;
+
+ contents_casefold = g_utf8_casefold (contents, length);
if (strstr (contents_casefold, text_casefold))
{
@@ -649,6 +651,10 @@ log_store_empathy_search_new (EmpathyLogStore *self,
}
}
+drinking_island:
+ if (file != NULL)
+ g_mapped_file_unref (file);
+
g_free (contents_casefold);
g_free (filename);
}
diff --git a/libempathy/empathy-tp-call.c b/libempathy/empathy-tp-call.c
index 32a09255f..78ee6d005 100644
--- a/libempathy/empathy-tp-call.c
+++ b/libempathy/empathy-tp-call.c
@@ -264,7 +264,7 @@ tp_call_request_streams_for_capabilities (EmpathyTpCall *call,
}
static void
-tp_call_got_contact_cb (EmpathyTpContactFactory *factory,
+tp_call_got_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -303,15 +303,12 @@ tp_call_update_status (EmpathyTpCall *call)
{
if (priv->contact == NULL && iter.element != self_handle)
{
- EmpathyTpContactFactory *factory;
TpConnection *connection;
/* We found the remote contact */
connection = tp_channel_borrow_connection (priv->channel);
- factory = empathy_tp_contact_factory_dup_singleton (connection);
- empathy_tp_contact_factory_get_from_handle (factory, iter.element,
+ empathy_tp_contact_factory_get_from_handle (connection, iter.element,
tp_call_got_contact_cb, NULL, NULL, G_OBJECT (call));
- g_object_unref (factory);
}
if (priv->status == EMPATHY_TP_CALL_STATUS_PENDING &&
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index cad014df3..daf24a36a 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -29,7 +29,6 @@
#include "empathy-tp-chat.h"
#include "empathy-tp-contact-factory.h"
-#include "empathy-contact-monitor.h"
#include "empathy-contact-list.h"
#include "empathy-dispatcher.h"
#include "empathy-marshal.h"
@@ -42,8 +41,7 @@
#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpChat)
typedef struct {
gboolean dispose_has_run;
- EmpathyTpContactFactory *factory;
- EmpathyContactMonitor *contact_monitor;
+ TpConnection *connection;
EmpathyContact *user;
EmpathyContact *remote_contact;
GList *members;
@@ -132,14 +130,12 @@ tp_chat_add (EmpathyContactList *list,
-1, &handles, NULL, NULL, NULL, NULL, NULL);
} else if (priv->can_upgrade_to_muc) {
EmpathyDispatcher *dispatcher;
- TpConnection *connection;
GHashTable *props;
const char *object_path;
GPtrArray channels = { (gpointer *) &object_path, 1 };
const char *invitees[2] = { NULL, };
dispatcher = empathy_dispatcher_dup_singleton ();
- connection = tp_channel_borrow_connection (priv->channel);
invitees[0] = empathy_contact_get_id (contact);
object_path = tp_proxy_get_object_path (priv->channel);
@@ -159,7 +155,7 @@ tp_chat_add (EmpathyContactList *list,
/* Although this is a MUC, it's anonymous, so CreateChannel is
* valid.
* props now belongs to EmpathyDispatcher, don't free it */
- empathy_dispatcher_create_channel (dispatcher, connection,
+ empathy_dispatcher_create_channel (dispatcher, priv->connection,
props, EMPATHY_DISPATCHER_NON_USER_ACTION, NULL, NULL);
g_object_unref (dispatcher);
@@ -207,22 +203,6 @@ tp_chat_get_members (EmpathyContactList *list)
return members;
}
-static EmpathyContactMonitor *
-tp_chat_get_monitor (EmpathyContactList *list)
-{
- EmpathyTpChatPriv *priv;
-
- g_return_val_if_fail (EMPATHY_IS_TP_CHAT (list), NULL);
-
- priv = GET_PRIV (list);
-
- if (priv->contact_monitor == NULL) {
- priv->contact_monitor = empathy_contact_monitor_new_for_iface (list);
- }
-
- return priv->contact_monitor;
-}
-
static void
tp_chat_emit_queued_messages (EmpathyTpChat *chat)
{
@@ -243,7 +223,7 @@ tp_chat_emit_queued_messages (EmpathyTpChat *chat)
}
static void
-tp_chat_got_sender_cb (EmpathyTpContactFactory *factory,
+tp_chat_got_sender_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer message,
@@ -291,7 +271,7 @@ tp_chat_build_message (EmpathyTpChat *chat,
empathy_message_set_sender (message, priv->user);
tp_chat_emit_queued_messages (chat);
} else {
- empathy_tp_contact_factory_get_from_handle (priv->factory,
+ empathy_tp_contact_factory_get_from_handle (priv->connection,
from_handle,
tp_chat_got_sender_cb,
message, NULL, G_OBJECT (chat));
@@ -412,7 +392,7 @@ typedef struct {
} StateChangedData;
static void
-tp_chat_state_changed_got_contact_cb (EmpathyTpContactFactory *factory,
+tp_chat_state_changed_got_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -442,7 +422,7 @@ tp_chat_state_changed_cb (TpChannel *channel,
{
EmpathyTpChatPriv *priv = GET_PRIV (chat);
- empathy_tp_contact_factory_get_from_handle (priv->factory, handle,
+ empathy_tp_contact_factory_get_from_handle (priv->connection, handle,
tp_chat_state_changed_got_contact_cb, GUINT_TO_POINTER (state),
NULL, chat);
}
@@ -758,6 +738,10 @@ tp_chat_dispose (GObject *object)
priv->dispose_has_run = TRUE;
+ if (priv->connection != NULL)
+ g_object_unref (priv->connection);
+ priv->connection = NULL;
+
if (priv->channel != NULL) {
g_signal_handlers_disconnect_by_func (priv->channel,
tp_chat_invalidated_cb, self);
@@ -769,18 +753,10 @@ tp_chat_dispose (GObject *object)
g_object_unref (priv->remote_contact);
priv->remote_contact = NULL;
- if (priv->factory != NULL)
- g_object_unref (priv->factory);
- priv->factory = NULL;
-
if (priv->user != NULL)
g_object_unref (priv->user);
priv->user = NULL;
- if (priv->contact_monitor)
- g_object_unref (priv->contact_monitor);
- priv->contact_monitor = NULL;
-
g_queue_foreach (priv->messages_queue, (GFunc) g_object_unref, NULL);
g_queue_clear (priv->messages_queue);
@@ -931,7 +907,7 @@ tp_chat_update_remote_contact (EmpathyTpChat *chat)
}
static void
-tp_chat_got_added_contacts_cb (EmpathyTpContactFactory *factory,
+tp_chat_got_added_contacts_cb (TpConnection *connection,
guint n_contacts,
EmpathyContact * const * contacts,
guint n_failed,
@@ -1025,7 +1001,7 @@ contact_rename_data_free (ContactRenameData* data)
}
static void
-tp_chat_got_renamed_contacts_cb (EmpathyTpContactFactory *factory,
+tp_chat_got_renamed_contacts_cb (TpConnection *connection,
guint n_contacts,
EmpathyContact * const * contacts,
guint n_failed,
@@ -1107,7 +1083,7 @@ tp_chat_group_members_changed_cb (TpChannel *self,
old_handle = g_array_index (removed, guint, 0);
rename_data = contact_rename_data_new (old_handle, reason, message);
- empathy_tp_contact_factory_get_from_handles (priv->factory,
+ empathy_tp_contact_factory_get_from_handles (priv->connection,
added->len, (TpHandle *) added->data,
tp_chat_got_renamed_contacts_cb,
rename_data, (GDestroyNotify) contact_rename_data_free,
@@ -1141,7 +1117,7 @@ tp_chat_group_members_changed_cb (TpChannel *self,
/* Request added contacts */
if (added->len > 0) {
- empathy_tp_contact_factory_get_from_handles (priv->factory,
+ empathy_tp_contact_factory_get_from_handles (priv->connection,
added->len, (TpHandle *) added->data,
tp_chat_got_added_contacts_cb, NULL, NULL,
G_OBJECT (chat));
@@ -1155,7 +1131,7 @@ tp_chat_group_members_changed_cb (TpChannel *self,
}
static void
-tp_chat_got_remote_contact_cb (EmpathyTpContactFactory *factory,
+tp_chat_got_remote_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -1176,7 +1152,7 @@ tp_chat_got_remote_contact_cb (EmpathyTpContactFactory *factory,
}
static void
-tp_chat_got_self_contact_cb (EmpathyTpContactFactory *factory,
+tp_chat_got_self_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -1240,15 +1216,13 @@ tp_chat_constructor (GType type,
{
GObject *chat;
EmpathyTpChatPriv *priv;
- TpConnection *connection;
TpHandle handle;
chat = G_OBJECT_CLASS (empathy_tp_chat_parent_class)->constructor (type, n_props, props);
priv = GET_PRIV (chat);
- connection = tp_channel_borrow_connection (priv->channel);
- priv->factory = empathy_tp_contact_factory_dup_singleton (connection);
+ priv->connection = g_object_ref (tp_channel_borrow_connection (priv->channel));
g_signal_connect (priv->channel, "invalidated",
G_CALLBACK (tp_chat_invalidated_cb),
chat);
@@ -1260,14 +1234,14 @@ tp_chat_constructor (GType type,
/* Get self contact from the group's self handle */
handle = tp_channel_group_get_self_handle (priv->channel);
- empathy_tp_contact_factory_get_from_handle (priv->factory,
+ empathy_tp_contact_factory_get_from_handle (priv->connection,
handle, tp_chat_got_self_contact_cb,
NULL, NULL, chat);
/* Get initial member contacts */
members = tp_channel_group_get_members (priv->channel);
handles = tp_intset_to_array (members);
- empathy_tp_contact_factory_get_from_handles (priv->factory,
+ empathy_tp_contact_factory_get_from_handles (priv->connection,
handles->len, (TpHandle *) handles->data,
tp_chat_got_added_contacts_cb, NULL, NULL, chat);
@@ -1280,19 +1254,19 @@ tp_chat_constructor (GType type,
GList *list, *ptr;
/* Get the self contact from the connection's self handle */
- handle = tp_connection_get_self_handle (connection);
- empathy_tp_contact_factory_get_from_handle (priv->factory,
+ handle = tp_connection_get_self_handle (priv->connection);
+ empathy_tp_contact_factory_get_from_handle (priv->connection,
handle, tp_chat_got_self_contact_cb,
NULL, NULL, chat);
/* Get the remote contact */
handle = tp_channel_get_handle (priv->channel, NULL);
- empathy_tp_contact_factory_get_from_handle (priv->factory,
+ empathy_tp_contact_factory_get_from_handle (priv->connection,
handle, tp_chat_got_remote_contact_cb,
NULL, NULL, chat);
list = empathy_dispatcher_find_requestable_channel_classes (
- dispatcher, connection,
+ dispatcher, priv->connection,
tp_channel_get_channel_type (priv->channel),
TP_UNKNOWN_HANDLE_TYPE, NULL);
@@ -1497,7 +1471,6 @@ empathy_tp_chat_init (EmpathyTpChat *chat)
EMPATHY_TYPE_TP_CHAT, EmpathyTpChatPriv);
chat->priv = priv;
- priv->contact_monitor = NULL;
priv->messages_queue = g_queue_new ();
priv->pending_messages_queue = g_queue_new ();
}
@@ -1508,7 +1481,6 @@ tp_chat_iface_init (EmpathyContactListIface *iface)
iface->add = tp_chat_add;
iface->remove = tp_chat_remove;
iface->get_members = tp_chat_get_members;
- iface->get_monitor = tp_chat_get_monitor;
}
EmpathyTpChat *
diff --git a/libempathy/empathy-tp-contact-factory.c b/libempathy/empathy-tp-contact-factory.c
index 068c62d62..a8afecf6b 100644
--- a/libempathy/empathy-tp-contact-factory.c
+++ b/libempathy/empathy-tp-contact-factory.c
@@ -21,330 +21,20 @@
#include <config.h>
-#include <string.h>
-
-#include <telepathy-glib/util.h>
-#include <telepathy-glib/gtypes.h>
-#include <telepathy-glib/dbus.h>
-#include <telepathy-glib/interfaces.h>
-
-#include <extensions/extensions.h>
-
#include "empathy-tp-contact-factory.h"
-#include "empathy-utils.h"
#define DEBUG_FLAG EMPATHY_DEBUG_TP | EMPATHY_DEBUG_CONTACT
#include "empathy-debug.h"
-#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpContactFactory)
-typedef struct {
- TpConnection *connection;
- GList *contacts;
-
- gchar **avatar_mime_types;
- guint avatar_min_width;
- guint avatar_min_height;
- guint avatar_max_width;
- guint avatar_max_height;
- guint avatar_max_size;
-} EmpathyTpContactFactoryPriv;
-
-G_DEFINE_TYPE (EmpathyTpContactFactory, empathy_tp_contact_factory, G_TYPE_OBJECT);
-
-enum {
- PROP_0,
- PROP_CONNECTION,
-
- PROP_MIME_TYPES,
- PROP_MIN_WIDTH,
- PROP_MIN_HEIGHT,
- PROP_MAX_WIDTH,
- PROP_MAX_HEIGHT,
- PROP_MAX_SIZE
-};
-
static TpContactFeature contact_features[] = {
TP_CONTACT_FEATURE_ALIAS,
+ TP_CONTACT_FEATURE_AVATAR_TOKEN,
+ TP_CONTACT_FEATURE_AVATAR_DATA,
TP_CONTACT_FEATURE_PRESENCE,
TP_CONTACT_FEATURE_LOCATION,
TP_CONTACT_FEATURE_CAPABILITIES,
};
-static EmpathyContact *
-tp_contact_factory_find_by_handle (EmpathyTpContactFactory *tp_factory,
- guint handle)
-{
- EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory);
- GList *l;
-
- for (l = priv->contacts; l; l = l->next) {
- if (empathy_contact_get_handle (l->data) == handle) {
- return l->data;
- }
- }
-
- return NULL;
-}
-
-static EmpathyContact *
-tp_contact_factory_find_by_tp_contact (EmpathyTpContactFactory *tp_factory,
- TpContact *tp_contact)
-{
- EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory);
- GList *l;
-
- for (l = priv->contacts; l; l = l->next) {
- if (empathy_contact_get_tp_contact (l->data) == tp_contact) {
- return l->data;
- }
- }
-
- return NULL;
-}
-
-static void
-tp_contact_factory_weak_notify (gpointer data,
- GObject *where_the_object_was)
-{
- EmpathyTpContactFactoryPriv *priv = GET_PRIV (data);
-
- DEBUG ("Remove finalized contact %p", where_the_object_was);
-
- priv->contacts = g_list_remove (priv->contacts, where_the_object_was);
-}
-
-static void
-tp_contact_factory_set_aliases_cb (TpConnection *connection,
- const GError *error,
- gpointer user_data,
- GObject *tp_factory)
-{
- if (error) {
- DEBUG ("Error: %s", error->message);
- }
-}
-
-static void
-tp_contact_factory_avatar_retrieved_cb (TpConnection *connection,
- guint handle,
- const gchar *token,
- const GArray *avatar_data,
- const gchar *mime_type,
- gpointer user_data,
- GObject *tp_factory)
-{
- EmpathyContact *contact;
-
- contact = tp_contact_factory_find_by_handle (EMPATHY_TP_CONTACT_FACTORY (tp_factory),
- handle);
- if (!contact) {
- return;
- }
-
- DEBUG ("Avatar retrieved for contact %s (%d)",
- empathy_contact_get_id (contact),
- handle);
-
- empathy_contact_load_avatar_data (contact,
- (guchar *) avatar_data->data,
- avatar_data->len,
- mime_type,
- token);
-}
-
-static void
-tp_contact_factory_request_avatars_cb (TpConnection *connection,
- const GError *error,
- gpointer user_data,
- GObject *tp_factory)
-{
- if (error) {
- DEBUG ("Error: %s", error->message);
- }
-}
-
-static gboolean
-tp_contact_factory_avatar_maybe_update (EmpathyTpContactFactory *tp_factory,
- guint handle,
- const gchar *token)
-{
- EmpathyContact *contact;
- EmpathyAvatar *avatar;
-
- contact = tp_contact_factory_find_by_handle (tp_factory, handle);
- if (!contact) {
- return TRUE;
- }
-
- /* Check if we have an avatar */
- if (EMP_STR_EMPTY (token)) {
- empathy_contact_set_avatar (contact, NULL);
- return TRUE;
- }
-
- /* Check if the avatar changed */
- avatar = empathy_contact_get_avatar (contact);
- if (avatar && !tp_strdiff (avatar->token, token)) {
- return TRUE;
- }
-
- /* The avatar changed, search the new one in the cache */
- if (empathy_contact_load_avatar_cache (contact, token)) {
- /* Got from cache, use it */
- return TRUE;
- }
-
- /* Avatar is not up-to-date, we have to request it. */
- return FALSE;
-}
-
-static void
-tp_contact_factory_got_known_avatar_tokens (TpConnection *connection,
- GHashTable *tokens,
- const GError *error,
- gpointer user_data,
- GObject *weak_object)
-{
- EmpathyTpContactFactory *tp_factory = EMPATHY_TP_CONTACT_FACTORY (weak_object);
- EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory);
- GArray *handles;
- GHashTableIter iter;
- gpointer key, value;
-
- if (error) {
- DEBUG ("Error: %s", error->message);
- return;
- }
-
- handles = g_array_new (FALSE, FALSE, sizeof (guint));
-
- g_hash_table_iter_init (&iter, tokens);
- while (g_hash_table_iter_next (&iter, &key, &value)) {
- guint handle = GPOINTER_TO_UINT (key);
- const gchar *token = value;
-
- if (!tp_contact_factory_avatar_maybe_update (tp_factory,
- handle, token)) {
- g_array_append_val (handles, handle);
- }
- }
-
- DEBUG ("Got %d tokens, need to request %d avatars",
- g_hash_table_size (tokens), handles->len);
-
- /* Request needed avatars */
- if (handles->len > 0) {
- tp_cli_connection_interface_avatars_call_request_avatars (priv->connection,
- -1,
- handles,
- tp_contact_factory_request_avatars_cb,
- NULL, NULL,
- G_OBJECT (tp_factory));
- }
-
- g_array_free (handles, TRUE);
-}
-
-static void
-tp_contact_factory_avatar_updated_cb (TpConnection *connection,
- guint handle,
- const gchar *new_token,
- gpointer user_data,
- GObject *tp_factory)
-{
- GArray *handles;
-
- if (tp_contact_factory_avatar_maybe_update (EMPATHY_TP_CONTACT_FACTORY (tp_factory),
- handle, new_token)) {
- /* Avatar was cached, nothing to do */
- return;
- }
-
- DEBUG ("Need to request avatar for token %s", new_token);
-
- handles = g_array_new (FALSE, FALSE, sizeof (guint));
- g_array_append_val (handles, handle);
-
- tp_cli_connection_interface_avatars_call_request_avatars (connection,
- -1,
- handles,
- tp_contact_factory_request_avatars_cb,
- NULL, NULL,
- tp_factory);
- g_array_free (handles, TRUE);
-}
-
-static void
-tp_contact_factory_got_avatar_requirements_cb (TpConnection *proxy,
- const gchar **mime_types,
- guint min_width,
- guint min_height,
- guint max_width,
- guint max_height,
- guint max_size,
- const GError *error,
- gpointer user_data,
- GObject *tp_factory)
-{
- EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory);
-
- if (error) {
- DEBUG ("Failed to get avatar requirements: %s", error->message);
- /* We'll just leave avatar_mime_types as NULL; the
- * avatar-setting code can use this as a signal that you can't
- * set avatars.
- */
- } else {
- priv->avatar_mime_types = g_strdupv ((gchar **) mime_types);
- priv->avatar_min_width = min_width;
- priv->avatar_min_height = min_height;
- priv->avatar_max_width = max_width;
- priv->avatar_max_height = max_height;
- priv->avatar_max_size = max_size;
- }
-}
-
-static void
-tp_contact_factory_add_contact (EmpathyTpContactFactory *tp_factory,
- EmpathyContact *contact)
-{
- EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory);
- TpHandle self_handle;
- TpHandle handle;
- GArray handles = {(gchar *) &handle, 1};
-
- /* Keep a weak ref to that contact */
- g_object_weak_ref (G_OBJECT (contact),
- tp_contact_factory_weak_notify,
- tp_factory);
- priv->contacts = g_list_prepend (priv->contacts, contact);
-
- /* The contact keeps a ref to its factory */
- g_object_set_data_full (G_OBJECT (contact), "empathy-factory",
- g_object_ref (tp_factory),
- g_object_unref);
-
- /* Set is-user property. Note that it could still be the handle is
- * different from the connection's self handle, in the case the handle
- * comes from a group interface. */
- self_handle = tp_connection_get_self_handle (priv->connection);
- handle = empathy_contact_get_handle (contact);
- empathy_contact_set_is_user (contact, self_handle == handle);
-
- /* FIXME: This should be done by TpContact */
- if (tp_proxy_has_interface_by_id (priv->connection,
- TP_IFACE_QUARK_CONNECTION_INTERFACE_AVATARS)) {
- tp_cli_connection_interface_avatars_call_get_known_avatar_tokens (
- priv->connection, -1, &handles,
- tp_contact_factory_got_known_avatar_tokens, NULL, NULL,
- G_OBJECT (tp_factory));
- }
-
- DEBUG ("Contact added: %s (%d)",
- empathy_contact_get_id (contact),
- empathy_contact_get_handle (contact));
-}
-
typedef union {
EmpathyTpContactFactoryContactsByIdCb ids_cb;
EmpathyTpContactFactoryContactsByHandleCb handles_cb;
@@ -352,7 +42,7 @@ typedef union {
} GetContactsCb;
typedef struct {
- EmpathyTpContactFactory *tp_factory;
+ TpConnection *connection;
GetContactsCb callback;
gpointer user_data;
GDestroyNotify destroy;
@@ -366,41 +56,21 @@ get_contacts_data_free (gpointer user_data)
if (data->destroy) {
data->destroy (data->user_data);
}
- g_object_unref (data->tp_factory);
+ g_object_unref (data->connection);
g_slice_free (GetContactsData, data);
}
-static EmpathyContact *
-dup_contact_for_tp_contact (EmpathyTpContactFactory *tp_factory,
- TpContact *tp_contact)
-{
- EmpathyContact *contact;
-
- contact = tp_contact_factory_find_by_tp_contact (tp_factory,
- tp_contact);
-
- if (contact != NULL) {
- g_object_ref (contact);
- } else {
- contact = empathy_contact_new (tp_contact);
- tp_contact_factory_add_contact (tp_factory, contact);
- }
-
- return contact;
-}
-
static EmpathyContact **
-contacts_array_new (EmpathyTpContactFactory *tp_factory,
- guint n_contacts,
- TpContact * const * contacts)
+contacts_array_new (guint n_contacts,
+ TpContact * const * contacts)
{
EmpathyContact **ret;
guint i;
ret = g_new0 (EmpathyContact *, n_contacts);
for (i = 0; i < n_contacts; i++) {
- ret[i] = dup_contact_for_tp_contact (tp_factory, contacts[i]);
+ ret[i] = empathy_contact_dup_from_tp_contact (contacts[i]);
}
return ret;
@@ -431,10 +101,9 @@ get_contacts_by_id_cb (TpConnection *connection,
GetContactsData *data = user_data;
EmpathyContact **empathy_contacts;
- empathy_contacts = contacts_array_new (data->tp_factory,
- n_contacts, contacts);
+ empathy_contacts = contacts_array_new (n_contacts, contacts);
if (data->callback.ids_cb) {
- data->callback.ids_cb (data->tp_factory,
+ data->callback.ids_cb (data->connection,
n_contacts, empathy_contacts,
requested_ids,
failed_id_errors,
@@ -447,7 +116,7 @@ get_contacts_by_id_cb (TpConnection *connection,
/* The callback is NOT given a reference to the EmpathyContact objects */
void
-empathy_tp_contact_factory_get_from_ids (EmpathyTpContactFactory *tp_factory,
+empathy_tp_contact_factory_get_from_ids (TpConnection *connection,
guint n_ids,
const gchar * const *ids,
EmpathyTpContactFactoryContactsByIdCb callback,
@@ -455,18 +124,17 @@ empathy_tp_contact_factory_get_from_ids (EmpathyTpContactFactory *tp_factory,
GDestroyNotify destroy,
GObject *weak_object)
{
- EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory);
GetContactsData *data;
- g_return_if_fail (EMPATHY_IS_TP_CONTACT_FACTORY (tp_factory));
+ g_return_if_fail (TP_IS_CONNECTION (connection));
g_return_if_fail (ids != NULL);
data = g_slice_new (GetContactsData);
data->callback.ids_cb = callback;
data->user_data = user_data;
data->destroy = destroy;
- data->tp_factory = g_object_ref (tp_factory);
- tp_connection_get_contacts_by_id (priv->connection,
+ data->connection = g_object_ref (connection);
+ tp_connection_get_contacts_by_id (connection,
n_ids, ids,
G_N_ELEMENTS (contact_features),
contact_features,
@@ -490,8 +158,7 @@ get_contact_by_id_cb (TpConnection *connection,
EmpathyContact *contact = NULL;
if (n_contacts == 1) {
- contact = dup_contact_for_tp_contact (data->tp_factory,
- contacts[0]);
+ contact = empathy_contact_dup_from_tp_contact (contacts[0]);
}
else if (error == NULL) {
GHashTableIter iter;
@@ -507,7 +174,7 @@ get_contact_by_id_cb (TpConnection *connection,
}
if (data->callback.contact_cb) {
- data->callback.contact_cb (data->tp_factory,
+ data->callback.contact_cb (data->connection,
contact,
error,
data->user_data, weak_object);
@@ -519,25 +186,24 @@ get_contact_by_id_cb (TpConnection *connection,
/* The callback is NOT given a reference to the EmpathyContact objects */
void
-empathy_tp_contact_factory_get_from_id (EmpathyTpContactFactory *tp_factory,
+empathy_tp_contact_factory_get_from_id (TpConnection *connection,
const gchar *id,
EmpathyTpContactFactoryContactCb callback,
gpointer user_data,
GDestroyNotify destroy,
GObject *weak_object)
{
- EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory);
GetContactsData *data;
- g_return_if_fail (EMPATHY_IS_TP_CONTACT_FACTORY (tp_factory));
+ g_return_if_fail (TP_IS_CONNECTION (connection));
g_return_if_fail (id != NULL);
data = g_slice_new (GetContactsData);
data->callback.contact_cb = callback;
data->user_data = user_data;
data->destroy = destroy;
- data->tp_factory = g_object_ref (tp_factory);
- tp_connection_get_contacts_by_id (priv->connection,
+ data->connection = g_object_ref (connection);
+ tp_connection_get_contacts_by_id (connection,
1, &id,
G_N_ELEMENTS (contact_features),
contact_features,
@@ -560,10 +226,9 @@ get_contacts_by_handle_cb (TpConnection *connection,
GetContactsData *data = user_data;
EmpathyContact **empathy_contacts;
- empathy_contacts = contacts_array_new (data->tp_factory,
- n_contacts, contacts);
+ empathy_contacts = contacts_array_new (n_contacts, contacts);
if (data->callback.handles_cb) {
- data->callback.handles_cb (data->tp_factory,
+ data->callback.handles_cb (data->connection,
n_contacts, empathy_contacts,
n_failed, failed,
error,
@@ -575,7 +240,7 @@ get_contacts_by_handle_cb (TpConnection *connection,
/* The callback is NOT given a reference to the EmpathyContact objects */
void
-empathy_tp_contact_factory_get_from_handles (EmpathyTpContactFactory *tp_factory,
+empathy_tp_contact_factory_get_from_handles (TpConnection *connection,
guint n_handles,
const TpHandle *handles,
EmpathyTpContactFactoryContactsByHandleCb callback,
@@ -583,23 +248,22 @@ empathy_tp_contact_factory_get_from_handles (EmpathyTpContactFactory *tp_factory
GDestroyNotify destroy,
GObject *weak_object)
{
- EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory);
GetContactsData *data;
if (n_handles == 0) {
- callback (tp_factory, 0, NULL, 0, NULL, NULL, user_data, weak_object);
+ callback (connection, 0, NULL, 0, NULL, NULL, user_data, weak_object);
return;
}
- g_return_if_fail (EMPATHY_IS_TP_CONTACT_FACTORY (tp_factory));
+ g_return_if_fail (TP_IS_CONNECTION (connection));
g_return_if_fail (handles != NULL);
data = g_slice_new (GetContactsData);
data->callback.handles_cb = callback;
data->user_data = user_data;
data->destroy = destroy;
- data->tp_factory = g_object_ref (tp_factory);
- tp_connection_get_contacts_by_handle (priv->connection,
+ data->connection = g_object_ref (connection);
+ tp_connection_get_contacts_by_handle (connection,
n_handles, handles,
G_N_ELEMENTS (contact_features),
contact_features,
@@ -625,8 +289,7 @@ get_contact_by_handle_cb (TpConnection *connection,
GError *err = NULL;
if (n_contacts == 1) {
- contact = dup_contact_for_tp_contact (data->tp_factory,
- contacts[0]);
+ contact = empathy_contact_dup_from_tp_contact (contacts[0]);
}
else {
if (error == NULL) {
@@ -644,7 +307,7 @@ get_contact_by_handle_cb (TpConnection *connection,
}
if (data->callback.contact_cb) {
- data->callback.contact_cb (data->tp_factory,
+ data->callback.contact_cb (data->connection,
contact,
err,
data->user_data, weak_object);
@@ -656,24 +319,23 @@ get_contact_by_handle_cb (TpConnection *connection,
}
void
-empathy_tp_contact_factory_get_from_handle (EmpathyTpContactFactory *tp_factory,
+empathy_tp_contact_factory_get_from_handle (TpConnection *connection,
TpHandle handle,
EmpathyTpContactFactoryContactCb callback,
gpointer user_data,
GDestroyNotify destroy,
GObject *weak_object)
{
- EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory);
GetContactsData *data;
- g_return_if_fail (EMPATHY_IS_TP_CONTACT_FACTORY (tp_factory));
+ g_return_if_fail (TP_IS_CONNECTION (connection));
data = g_slice_new (GetContactsData);
data->callback.contact_cb = callback;
data->user_data = user_data;
data->destroy = destroy;
- data->tp_factory = g_object_ref (tp_factory);
- tp_connection_get_contacts_by_handle (priv->connection,
+ data->connection = g_object_ref (connection);
+ tp_connection_get_contacts_by_handle (connection,
1, &handle,
G_N_ELEMENTS (contact_features),
contact_features,
@@ -683,327 +345,3 @@ empathy_tp_contact_factory_get_from_handle (EmpathyTpContactFactory *tp_factory,
weak_object);
}
-void
-empathy_tp_contact_factory_set_alias (EmpathyTpContactFactory *tp_factory,
- EmpathyContact *contact,
- const gchar *alias)
-{
- EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory);
- GHashTable *new_alias;
- guint handle;
-
- g_return_if_fail (EMPATHY_IS_TP_CONTACT_FACTORY (tp_factory));
- g_return_if_fail (EMPATHY_IS_CONTACT (contact));
-
- handle = empathy_contact_get_handle (contact);
-
- DEBUG ("Setting alias for contact %s (%d) to %s",
- empathy_contact_get_id (contact),
- handle, alias);
-
- new_alias = g_hash_table_new_full (g_direct_hash,
- g_direct_equal,
- NULL,
- g_free);
-
- g_hash_table_insert (new_alias,
- GUINT_TO_POINTER (handle),
- g_strdup (alias));
-
- tp_cli_connection_interface_aliasing_call_set_aliases (priv->connection,
- -1,
- new_alias,
- tp_contact_factory_set_aliases_cb,
- NULL, NULL,
- G_OBJECT (tp_factory));
-
- g_hash_table_destroy (new_alias);
-}
-
-static void
-tp_contact_factory_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EmpathyTpContactFactoryPriv *priv = GET_PRIV (object);
-
- switch (param_id) {
- case PROP_CONNECTION:
- g_value_set_object (value, priv->connection);
- break;
- case PROP_MIME_TYPES:
- g_value_set_boxed (value, priv->avatar_mime_types);
- break;
- case PROP_MIN_WIDTH:
- g_value_set_uint (value, priv->avatar_min_width);
- break;
- case PROP_MIN_HEIGHT:
- g_value_set_uint (value, priv->avatar_min_height);
- break;
- case PROP_MAX_WIDTH:
- g_value_set_uint (value, priv->avatar_max_width);
- break;
- case PROP_MAX_HEIGHT:
- g_value_set_uint (value, priv->avatar_max_height);
- break;
- case PROP_MAX_SIZE:
- g_value_set_uint (value, priv->avatar_max_size);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- };
-}
-
-static void
-tp_contact_factory_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- EmpathyTpContactFactoryPriv *priv = GET_PRIV (object);
-
- switch (param_id) {
- case PROP_CONNECTION:
- priv->connection = g_value_dup_object (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- };
-}
-
-static void
-tp_contact_factory_finalize (GObject *object)
-{
- EmpathyTpContactFactoryPriv *priv = GET_PRIV (object);
- GList *l;
-
- DEBUG ("Finalized: %p", object);
-
- for (l = priv->contacts; l; l = l->next) {
- g_object_weak_unref (G_OBJECT (l->data),
- tp_contact_factory_weak_notify,
- object);
- }
-
- g_list_free (priv->contacts);
-
- g_object_unref (priv->connection);
-
- g_strfreev (priv->avatar_mime_types);
-
- G_OBJECT_CLASS (empathy_tp_contact_factory_parent_class)->finalize (object);
-}
-
-static void
-connection_ready_cb (TpConnection *connection,
- const GError *error,
- gpointer user_data)
-{
- EmpathyTpContactFactory *tp_factory = EMPATHY_TP_CONTACT_FACTORY (user_data);
- EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory);
-
- if (error != NULL)
- goto out;
-
- /* FIXME: This should be moved to TpContact */
- tp_cli_connection_interface_avatars_connect_to_avatar_updated (priv->connection,
- tp_contact_factory_avatar_updated_cb,
- NULL, NULL,
- G_OBJECT (tp_factory),
- NULL);
- tp_cli_connection_interface_avatars_connect_to_avatar_retrieved (priv->connection,
- tp_contact_factory_avatar_retrieved_cb,
- NULL, NULL,
- G_OBJECT (tp_factory),
- NULL);
-
- tp_cli_connection_interface_avatars_call_get_avatar_requirements (priv->connection,
- -1,
- tp_contact_factory_got_avatar_requirements_cb,
- NULL, NULL,
- G_OBJECT (tp_factory));
-
-out:
- g_object_unref (tp_factory);
-}
-
-static GObject *
-tp_contact_factory_constructor (GType type,
- guint n_props,
- GObjectConstructParam *props)
-{
- GObject *tp_factory;
- EmpathyTpContactFactoryPriv *priv;
-
- tp_factory = G_OBJECT_CLASS (empathy_tp_contact_factory_parent_class)->constructor (type, n_props, props);
- priv = GET_PRIV (tp_factory);
-
- /* Ensure to keep the self object alive while the call_when_ready is
- * running */
- g_object_ref (tp_factory);
- tp_connection_call_when_ready (priv->connection, connection_ready_cb,
- tp_factory);
-
- return tp_factory;
-}
-
-static void
-empathy_tp_contact_factory_class_init (EmpathyTpContactFactoryClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = tp_contact_factory_finalize;
- object_class->constructor = tp_contact_factory_constructor;
- object_class->get_property = tp_contact_factory_get_property;
- object_class->set_property = tp_contact_factory_set_property;
-
- g_object_class_install_property (object_class,
- PROP_CONNECTION,
- g_param_spec_object ("connection",
- "Factory's Connection",
- "The connection associated with the factory",
- TP_TYPE_CONNECTION,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class,
- PROP_MIME_TYPES,
- g_param_spec_boxed ("avatar-mime-types",
- "Supported MIME types for avatars",
- "Types of images that may be set as "
- "avatars on this connection.",
- G_TYPE_STRV,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class,
- PROP_MIN_WIDTH,
- g_param_spec_uint ("avatar-min-width",
- "Minimum width for avatars",
- "Minimum width of avatar that may be set.",
- 0,
- G_MAXUINT,
- 0,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class,
- PROP_MIN_HEIGHT,
- g_param_spec_uint ("avatar-min-height",
- "Minimum height for avatars",
- "Minimum height of avatar that may be set.",
- 0,
- G_MAXUINT,
- 0,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class,
- PROP_MAX_WIDTH,
- g_param_spec_uint ("avatar-max-width",
- "Maximum width for avatars",
- "Maximum width of avatar that may be set "
- "or 0 if there is no maximum.",
- 0,
- G_MAXUINT,
- 0,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class,
- PROP_MAX_HEIGHT,
- g_param_spec_uint ("avatar-max-height",
- "Maximum height for avatars",
- "Maximum height of avatar that may be set "
- "or 0 if there is no maximum.",
- 0,
- G_MAXUINT,
- 0,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class,
- PROP_MAX_SIZE,
- g_param_spec_uint ("avatar-max-size",
- "Maximum size for avatars in bytes",
- "Maximum file size of avatar that may be "
- "set or 0 if there is no maximum.",
- 0,
- G_MAXUINT,
- 0,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
-
-
- g_type_class_add_private (object_class, sizeof (EmpathyTpContactFactoryPriv));
-}
-
-static void
-empathy_tp_contact_factory_init (EmpathyTpContactFactory *tp_factory)
-{
- EmpathyTpContactFactoryPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (tp_factory,
- EMPATHY_TYPE_TP_CONTACT_FACTORY, EmpathyTpContactFactoryPriv);
-
- tp_factory->priv = priv;
-}
-
-static GHashTable *factories = NULL;
-
-static void
-tp_contact_factory_connection_invalidated_cb (TpProxy *connection,
- guint domain,
- gint code,
- gchar *message,
- gpointer user_data)
-{
- DEBUG ("Message: %s", message);
- g_hash_table_remove (factories, connection);
-}
-
-static void
-tp_contact_factory_connection_weak_notify_cb (gpointer connection,
- GObject *where_the_object_was)
-{
- g_hash_table_remove (factories, connection);
-}
-
-static void
-tp_contact_factory_remove_connection (gpointer connection)
-{
- g_signal_handlers_disconnect_by_func (connection,
- tp_contact_factory_connection_invalidated_cb, NULL);
- g_object_unref (connection);
-}
-
-EmpathyTpContactFactory *
-empathy_tp_contact_factory_dup_singleton (TpConnection *connection)
-{
- EmpathyTpContactFactory *tp_factory;
-
- g_return_val_if_fail (TP_IS_CONNECTION (connection), NULL);
-
- if (factories == NULL) {
- factories = g_hash_table_new_full (empathy_proxy_hash,
- empathy_proxy_equal,
- tp_contact_factory_remove_connection,
- NULL);
- }
-
- tp_factory = g_hash_table_lookup (factories, connection);
- if (tp_factory == NULL) {
- tp_factory = g_object_new (EMPATHY_TYPE_TP_CONTACT_FACTORY,
- "connection", connection,
- NULL);
- g_hash_table_insert (factories, g_object_ref (connection),
- tp_factory);
- g_object_weak_ref (G_OBJECT (tp_factory),
- tp_contact_factory_connection_weak_notify_cb,
- connection);
- g_signal_connect (connection, "invalidated",
- G_CALLBACK (tp_contact_factory_connection_invalidated_cb),
- NULL);
- } else {
- g_object_ref (tp_factory);
- }
-
- return tp_factory;
-}
-
diff --git a/libempathy/empathy-tp-contact-factory.h b/libempathy/empathy-tp-contact-factory.h
index d2572f298..29146cb32 100644
--- a/libempathy/empathy-tp-contact-factory.h
+++ b/libempathy/empathy-tp-contact-factory.h
@@ -30,26 +30,7 @@
G_BEGIN_DECLS
-#define EMPATHY_TYPE_TP_CONTACT_FACTORY (empathy_tp_contact_factory_get_type ())
-#define EMPATHY_TP_CONTACT_FACTORY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_TP_CONTACT_FACTORY, EmpathyTpContactFactory))
-#define EMPATHY_TP_CONTACT_FACTORY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EMPATHY_TYPE_TP_CONTACT_FACTORY, EmpathyTpContactFactoryClass))
-#define EMPATHY_IS_TP_CONTACT_FACTORY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_TP_CONTACT_FACTORY))
-#define EMPATHY_IS_TP_CONTACT_FACTORY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_TP_CONTACT_FACTORY))
-#define EMPATHY_TP_CONTACT_FACTORY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_TP_CONTACT_FACTORY, EmpathyTpContactFactoryClass))
-
-typedef struct _EmpathyTpContactFactory EmpathyTpContactFactory;
-typedef struct _EmpathyTpContactFactoryClass EmpathyTpContactFactoryClass;
-
-struct _EmpathyTpContactFactory {
- GObject parent;
- gpointer priv;
-};
-
-struct _EmpathyTpContactFactoryClass {
- GObjectClass parent_class;
-};
-
-typedef void (*EmpathyTpContactFactoryContactsByIdCb) (EmpathyTpContactFactory *factory,
+typedef void (*EmpathyTpContactFactoryContactsByIdCb) (TpConnection *connection,
guint n_contacts,
EmpathyContact * const * contacts,
const gchar * const * requested_ids,
@@ -58,7 +39,7 @@ typedef void (*EmpathyTpContactFactoryContactsByIdCb) (EmpathyTpContactFactory *
gpointer user_data,
GObject *weak_object);
-typedef void (*EmpathyTpContactFactoryContactsByHandleCb) (EmpathyTpContactFactory *factory,
+typedef void (*EmpathyTpContactFactoryContactsByHandleCb) (TpConnection *connection,
guint n_contacts,
EmpathyContact * const * contacts,
guint n_failed,
@@ -67,43 +48,38 @@ typedef void (*EmpathyTpContactFactoryContactsByHandleCb) (EmpathyTpContactFacto
gpointer user_data,
GObject *weak_object);
-typedef void (*EmpathyTpContactFactoryContactCb) (EmpathyTpContactFactory *factory,
+typedef void (*EmpathyTpContactFactoryContactCb) (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
GObject *weak_object);
-GType empathy_tp_contact_factory_get_type (void) G_GNUC_CONST;
-EmpathyTpContactFactory *empathy_tp_contact_factory_dup_singleton (TpConnection *connection);
-void empathy_tp_contact_factory_get_from_ids (EmpathyTpContactFactory *tp_factory,
+void empathy_tp_contact_factory_get_from_ids (TpConnection *connection,
guint n_ids,
const gchar * const *ids,
EmpathyTpContactFactoryContactsByIdCb callback,
gpointer user_data,
GDestroyNotify destroy,
GObject *weak_object);
-void empathy_tp_contact_factory_get_from_handles (EmpathyTpContactFactory *tp_factory,
+void empathy_tp_contact_factory_get_from_handles (TpConnection *connection,
guint n_handles,
const TpHandle *handles,
EmpathyTpContactFactoryContactsByHandleCb callback,
gpointer user_data,
GDestroyNotify destroy,
GObject *weak_object);
-void empathy_tp_contact_factory_get_from_id (EmpathyTpContactFactory *tp_factory,
+void empathy_tp_contact_factory_get_from_id (TpConnection *connection,
const gchar *id,
EmpathyTpContactFactoryContactCb callback,
gpointer user_data,
GDestroyNotify destroy,
GObject *weak_object);
-void empathy_tp_contact_factory_get_from_handle (EmpathyTpContactFactory *tp_factory,
+void empathy_tp_contact_factory_get_from_handle (TpConnection *connection,
TpHandle handle,
EmpathyTpContactFactoryContactCb callback,
gpointer user_data,
GDestroyNotify destroy,
GObject *weak_object);
-void empathy_tp_contact_factory_set_alias (EmpathyTpContactFactory *tp_factory,
- EmpathyContact *contact,
- const gchar *alias);
G_END_DECLS
#endif /* __EMPATHY_TP_CONTACT_FACTORY_H__ */
diff --git a/libempathy/empathy-tp-contact-list.c b/libempathy/empathy-tp-contact-list.c
index f8d897185..a77bb10b4 100644
--- a/libempathy/empathy-tp-contact-list.c
+++ b/libempathy/empathy-tp-contact-list.c
@@ -41,7 +41,6 @@
#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpContactList)
typedef struct {
- EmpathyTpContactFactory *factory;
TpConnection *connection;
TpChannel *publish;
@@ -372,7 +371,7 @@ tp_contact_list_group_add (EmpathyTpContactList *list,
}
static void
-got_added_members_cb (EmpathyTpContactFactory *factory,
+got_added_members_cb (TpConnection *connection,
guint n_contacts,
EmpathyContact * const * contacts,
guint n_failed,
@@ -427,7 +426,7 @@ add_to_members (EmpathyTpContactList *list,
}
if (request->len > 0) {
- empathy_tp_contact_factory_get_from_handles (priv->factory,
+ empathy_tp_contact_factory_get_from_handles (priv->connection,
request->len, (TpHandle *) request->data,
got_added_members_cb, NULL, NULL, G_OBJECT (list));
}
@@ -436,7 +435,7 @@ add_to_members (EmpathyTpContactList *list,
}
static void
-tp_contact_list_got_local_pending_cb (EmpathyTpContactFactory *factory,
+tp_contact_list_got_local_pending_cb (TpConnection *connection,
guint n_contacts,
EmpathyContact * const * contacts,
guint n_failed,
@@ -562,7 +561,7 @@ tp_contact_list_publish_group_members_changed_cb (TpChannel *channel,
/* Those contacts want our presence, auto accept those that are already
* member, otherwise add in pendings. */
if (local_pending->len > 0) {
- empathy_tp_contact_factory_get_from_handles (priv->factory,
+ empathy_tp_contact_factory_get_from_handles (priv->connection,
local_pending->len, (TpHandle *) local_pending->data,
tp_contact_list_got_local_pending_cb, NULL, NULL,
G_OBJECT (list));
@@ -726,10 +725,6 @@ tp_contact_list_finalize (GObject *object)
g_object_unref (priv->connection);
}
- if (priv->factory) {
- g_object_unref (priv->factory);
- }
-
g_hash_table_iter_init (&iter, priv->groups);
while (g_hash_table_iter_next (&iter, NULL, &channel)) {
g_signal_handlers_disconnect_by_func (channel,
@@ -920,8 +915,6 @@ tp_contact_list_constructed (GObject *list)
{
EmpathyTpContactListPriv *priv = GET_PRIV (list);
- priv->factory = empathy_tp_contact_factory_dup_singleton (priv->connection);
-
/* call GetAliasFlags */
if (tp_proxy_has_interface_by_id (priv->connection,
TP_IFACE_QUARK_CONNECTION_INTERFACE_ALIASING)) {
diff --git a/po/es.po b/po/es.po
index a6b622895..d84b5d855 100644
--- a/po/es.po
+++ b/po/es.po
@@ -8,8 +8,8 @@ msgstr ""
"Project-Id-Version: empathy.HEAD\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?"
"product=empathy&component=general\n"
-"POT-Creation-Date: 2010-05-24 13:37+0000\n"
-"PO-Revision-Date: 2010-05-25 08:33+0200\n"
+"POT-Creation-Date: 2010-05-26 09:06+0000\n"
+"PO-Revision-Date: 2010-05-26 17:52+0200\n"
"Last-Translator: Jorge González <jorgegonz@svn.gnome.org>\n"
"Language-Team: Español <gnome-es-list@gnome.org>\n"
"MIME-Version: 1.0\n"
@@ -476,7 +476,7 @@ msgstr "Gestionar las cuentas de mensajería y Voz IP"
#. Tweak the dialog
#: ../data/empathy-accounts.desktop.in.in.h:2
-#: ../src/empathy-accounts-dialog.c:2064 ../src/cc-empathy-accounts-page.c:244
+#: ../src/empathy-accounts-dialog.c:2067 ../src/cc-empathy-accounts-page.c:244
#: ../src/cc-empathy-accounts-panel.c:91
msgid "Messaging and VoIP Accounts"
msgstr "Cuentas de mensajería y Voz IP"
@@ -1130,59 +1130,59 @@ msgstr "Todos los archivos"
msgid "Click to enlarge"
msgstr "Pulse para agrandar"
-#: ../libempathy-gtk/empathy-chat.c:235
+#: ../libempathy-gtk/empathy-chat.c:249
msgid "Failed to reconnect this chat"
msgstr "Falló al reconectar a este chat"
-#: ../libempathy-gtk/empathy-chat.c:657
+#: ../libempathy-gtk/empathy-chat.c:671
msgid "Failed to join chat room"
msgstr "Falló al unirse a la sala de chat"
-#: ../libempathy-gtk/empathy-chat.c:675
+#: ../libempathy-gtk/empathy-chat.c:689
msgid "Failed to open private chat"
msgstr "Falló al abrir el chat privado"
-#: ../libempathy-gtk/empathy-chat.c:714
+#: ../libempathy-gtk/empathy-chat.c:728
msgid "Topic not supported on this conversation"
msgstr "El tema no está soportado en esta conversación"
-#: ../libempathy-gtk/empathy-chat.c:720
+#: ../libempathy-gtk/empathy-chat.c:734
msgid "You are not allowed to change the topic"
msgstr "No le está permitido cambiar el tema"
-#: ../libempathy-gtk/empathy-chat.c:851
+#: ../libempathy-gtk/empathy-chat.c:865
msgid "/clear: clear all messages from the current conversation"
msgstr "/clear: limpiar todos los mensajes de la conversación actual"
-#: ../libempathy-gtk/empathy-chat.c:854
+#: ../libempathy-gtk/empathy-chat.c:868
msgid "/topic <topic>: set the topic of the current conversation"
msgstr "/topic <tema>: establecer el tema para la conversación actual"
-#: ../libempathy-gtk/empathy-chat.c:857
+#: ../libempathy-gtk/empathy-chat.c:871
msgid "/join <chat room ID>: join a new chat room"
msgstr "/join <id de sala de chat>: unirse a una sala de chat nueva"
-#: ../libempathy-gtk/empathy-chat.c:860
+#: ../libempathy-gtk/empathy-chat.c:874
msgid "/j <chat room ID>: join a new chat room"
msgstr "/j <id de sala de chat>: unirse a una sala de chat nueva"
-#: ../libempathy-gtk/empathy-chat.c:863
+#: ../libempathy-gtk/empathy-chat.c:877
msgid "/query <contact ID> [<message>]: open a private chat"
msgstr "/query <id del contacto> [<mensaje>]: abrir un chat privado"
-#: ../libempathy-gtk/empathy-chat.c:866
+#: ../libempathy-gtk/empathy-chat.c:880
msgid "/msg <contact ID> <message>: open a private chat"
msgstr "/msg <id del contacto> <mensaje>: abrir un chat privado"
-#: ../libempathy-gtk/empathy-chat.c:869
+#: ../libempathy-gtk/empathy-chat.c:883
msgid "/nick <nickname>: change your nickname on the current server"
msgstr "/nick <apodo>: cambiar su apodo en el servidor actual"
-#: ../libempathy-gtk/empathy-chat.c:872
+#: ../libempathy-gtk/empathy-chat.c:886
msgid "/me <message>: send an ACTION message to the current conversation"
msgstr "/me <mensaje>: enviar un mensaje de ACCIÓN a la conversación actual"
-#: ../libempathy-gtk/empathy-chat.c:875
+#: ../libempathy-gtk/empathy-chat.c:889
msgid ""
"/say <message>: send <message> to the current conversation. This is used to "
"send a message starting with a '/'. For example: \"/say /join is used to "
@@ -1192,7 +1192,7 @@ msgstr ""
"para enviar un mensaje comenzando por una «/». Por ejemplo: «/say /join se usa "
"para unirse a una sala de chat nueva»"
-#: ../libempathy-gtk/empathy-chat.c:880
+#: ../libempathy-gtk/empathy-chat.c:894
msgid ""
"/help [<command>]: show all supported commands. If <command> is defined, "
"show its usage."
@@ -1200,84 +1200,84 @@ msgstr ""
"/help [<comando>]: mostrar todos los comandos soportados. Si <comando> está "
"definido, muestra su uso."
-#: ../libempathy-gtk/empathy-chat.c:890
+#: ../libempathy-gtk/empathy-chat.c:904
#, c-format
msgid "Usage: %s"
msgstr "Uso: %s"
-#: ../libempathy-gtk/empathy-chat.c:919
+#: ../libempathy-gtk/empathy-chat.c:933
msgid "Unknown command"
msgstr "Comando desconocido"
-#: ../libempathy-gtk/empathy-chat.c:1040
+#: ../libempathy-gtk/empathy-chat.c:1054
msgid "Unknown command; see /help for the available commands"
msgstr "Comando desconocido; consulte /help para ver los comandos disponibles"
-#: ../libempathy-gtk/empathy-chat.c:1178
+#: ../libempathy-gtk/empathy-chat.c:1192
msgid "offline"
msgstr "desconectado"
-#: ../libempathy-gtk/empathy-chat.c:1181
+#: ../libempathy-gtk/empathy-chat.c:1195
msgid "invalid contact"
msgstr "contacto no válido"
-#: ../libempathy-gtk/empathy-chat.c:1184
+#: ../libempathy-gtk/empathy-chat.c:1198
msgid "permission denied"
msgstr "permiso denegado"
-#: ../libempathy-gtk/empathy-chat.c:1187
+#: ../libempathy-gtk/empathy-chat.c:1201
msgid "too long message"
msgstr "mensaje demasiado largo"
-#: ../libempathy-gtk/empathy-chat.c:1190
+#: ../libempathy-gtk/empathy-chat.c:1204
msgid "not implemented"
msgstr "no implementado"
-#: ../libempathy-gtk/empathy-chat.c:1193
+#: ../libempathy-gtk/empathy-chat.c:1207
msgid "unknown"
msgstr "desconocido"
-#: ../libempathy-gtk/empathy-chat.c:1197
+#: ../libempathy-gtk/empathy-chat.c:1211
#, c-format
msgid "Error sending message '%s': %s"
msgstr "Error al enviar el mensaje «%s»: %s"
-#: ../libempathy-gtk/empathy-chat.c:1307 ../src/empathy-chat-window.c:687
+#: ../libempathy-gtk/empathy-chat.c:1321 ../src/empathy-chat-window.c:687
msgid "Topic:"
msgstr "Tema:"
-#: ../libempathy-gtk/empathy-chat.c:1319
+#: ../libempathy-gtk/empathy-chat.c:1333
#, c-format
msgid "Topic set to: %s"
msgstr "El tema se ha establecido a: %s"
-#: ../libempathy-gtk/empathy-chat.c:1321
+#: ../libempathy-gtk/empathy-chat.c:1335
msgid "No topic defined"
msgstr "No se ha definido el tema"
-#: ../libempathy-gtk/empathy-chat.c:1717
+#: ../libempathy-gtk/empathy-chat.c:1811
msgid "(No Suggestions)"
msgstr "(Sin sugerencias)"
-#: ../libempathy-gtk/empathy-chat.c:1771
+#: ../libempathy-gtk/empathy-chat.c:1865
msgid "Insert Smiley"
msgstr "Insertar emoticono"
#. send button
-#: ../libempathy-gtk/empathy-chat.c:1789
+#: ../libempathy-gtk/empathy-chat.c:1883
#: ../libempathy-gtk/empathy-ui-utils.c:1619
msgid "_Send"
msgstr "E_nviar"
-#: ../libempathy-gtk/empathy-chat.c:1823
+#: ../libempathy-gtk/empathy-chat.c:1917
msgid "_Spelling Suggestions"
msgstr "_Sugerencias ortográficas"
-#: ../libempathy-gtk/empathy-chat.c:1917
+#: ../libempathy-gtk/empathy-chat.c:2011
msgid "Failed to retrieve recent logs"
msgstr "Falló al recibir los registros recientes"
-#: ../libempathy-gtk/empathy-chat.c:2048
+#: ../libempathy-gtk/empathy-chat.c:2142
#, c-format
msgid "%s has disconnected"
msgstr "%s se ha desconectado"
@@ -1285,12 +1285,12 @@ msgstr "%s se ha desconectado"
#. translators: reverse the order of these arguments
#. * if the kicked should come before the kicker in your locale.
#.
-#: ../libempathy-gtk/empathy-chat.c:2055
+#: ../libempathy-gtk/empathy-chat.c:2149
#, c-format
msgid "%1$s was kicked by %2$s"
msgstr "%2$s expulsó a %1$s"
-#: ../libempathy-gtk/empathy-chat.c:2058
+#: ../libempathy-gtk/empathy-chat.c:2152
#, c-format
msgid "%s was kicked"
msgstr "%s fue expulsado"
@@ -1298,17 +1298,17 @@ msgstr "%s fue expulsado"
#. translators: reverse the order of these arguments
#. * if the banned should come before the banner in your locale.
#.
-#: ../libempathy-gtk/empathy-chat.c:2066
+#: ../libempathy-gtk/empathy-chat.c:2160
#, c-format
msgid "%1$s was banned by %2$s"
msgstr "%2$s vetó a %1$s"
-#: ../libempathy-gtk/empathy-chat.c:2069
+#: ../libempathy-gtk/empathy-chat.c:2163
#, c-format
msgid "%s was banned"
msgstr "%s fue vetado"
-#: ../libempathy-gtk/empathy-chat.c:2073
+#: ../libempathy-gtk/empathy-chat.c:2167
#, c-format
msgid "%s has left the room"
msgstr "%s ha dejado la sala"
@@ -1318,46 +1318,46 @@ msgstr "%s ha dejado la sala"
#. * given by the user living the room. If this poses a problem,
#. * please let us know. :-)
#.
-#: ../libempathy-gtk/empathy-chat.c:2082
+#: ../libempathy-gtk/empathy-chat.c:2176
#, c-format
msgid " (%s)"
msgstr " (%s)"
-#: ../libempathy-gtk/empathy-chat.c:2107
+#: ../libempathy-gtk/empathy-chat.c:2201
#, c-format
msgid "%s has joined the room"
msgstr "%s ha entrado en la sala"
-#: ../libempathy-gtk/empathy-chat.c:2132
+#: ../libempathy-gtk/empathy-chat.c:2226
#, c-format
msgid "%s is now known as %s"
msgstr "Ahora %s se llama %s"
-#: ../libempathy-gtk/empathy-chat.c:2271 ../src/empathy-call-window.c:1653
+#: ../libempathy-gtk/empathy-chat.c:2365 ../src/empathy-call-window.c:1653
msgid "Disconnected"
msgstr "Desconectado"
-#: ../libempathy-gtk/empathy-chat.c:2801
+#: ../libempathy-gtk/empathy-chat.c:3004
msgid "Wrong password; please try again:"
msgstr "Contraseña incorrecta; inténtelo de nuevo:"
-#: ../libempathy-gtk/empathy-chat.c:2802
+#: ../libempathy-gtk/empathy-chat.c:3005
msgid "Retry"
msgstr "Volver a intentarlo"
-#: ../libempathy-gtk/empathy-chat.c:2807
+#: ../libempathy-gtk/empathy-chat.c:3010
msgid "This room is protected by a password:"
msgstr "Esta sala está protegida por contraseña:"
-#: ../libempathy-gtk/empathy-chat.c:2808
+#: ../libempathy-gtk/empathy-chat.c:3011
msgid "Join"
msgstr "Unirse"
-#: ../libempathy-gtk/empathy-chat.c:2948
+#: ../libempathy-gtk/empathy-chat.c:3151
msgid "Connected"
msgstr "Conectado"
-#: ../libempathy-gtk/empathy-chat.c:3001
+#: ../libempathy-gtk/empathy-chat.c:3204
#: ../libempathy-gtk/empathy-log-window.c:707
msgid "Conversation"
msgstr "Conversación"
@@ -1451,11 +1451,11 @@ msgid "_Previous Conversations"
msgstr "Conversaciones an_teriores"
#: ../libempathy-gtk/empathy-contact-menu.c:373
-msgid "Send file"
+msgid "Send File"
msgstr "Enviar archivo"
#: ../libempathy-gtk/empathy-contact-menu.c:396
-msgid "Share my desktop"
+msgid "Share My Desktop"
msgstr "Compartir mi escritorio"
#: ../libempathy-gtk/empathy-contact-menu.c:436
@@ -1478,8 +1478,8 @@ msgid "Inviting you to this room"
msgstr "Invitándolo a esta sala"
#: ../libempathy-gtk/empathy-contact-menu.c:597
-msgid "_Invite to chat room"
-msgstr "_Invitar a la sala de chat"
+msgid "_Invite to Chat Room"
+msgstr "_Invitar a sala de chat"
#: ../libempathy-gtk/empathy-contact-selector.c:129
msgid "Select a contact"
@@ -2152,7 +2152,7 @@ msgstr ""
"Editar."
#: ../src/empathy-account-assistant.c:221
-#: ../src/empathy-account-assistant.c:1309
+#: ../src/empathy-account-assistant.c:1312
msgid "An error occurred"
msgstr "Ocurrió un error"
@@ -2166,31 +2166,31 @@ msgstr "Ocurrió un error"
msgid "New %s account"
msgstr "Cuenta de %s nueva"
-#: ../src/empathy-account-assistant.c:508
+#: ../src/empathy-account-assistant.c:511
msgid "What kind of chat account do you have?"
msgstr "¿Qué tipo de cuenta tiene?"
-#: ../src/empathy-account-assistant.c:514
+#: ../src/empathy-account-assistant.c:517
msgid "Do you have any other chat accounts you want to set up?"
msgstr "¿Tiene otras cuentas de chat que quiera configurar?"
-#: ../src/empathy-account-assistant.c:520
+#: ../src/empathy-account-assistant.c:523
msgid "Enter your account details"
msgstr "Introducir los detalles de su cuenta"
-#: ../src/empathy-account-assistant.c:525
+#: ../src/empathy-account-assistant.c:528
msgid "What kind of chat account do you want to create?"
msgstr "¿Qué tipo de cuenta quiere crear?"
-#: ../src/empathy-account-assistant.c:531
+#: ../src/empathy-account-assistant.c:534
msgid "Do you want to create other chat accounts?"
msgstr "¿Quiere crear otras cuentas de chat?"
-#: ../src/empathy-account-assistant.c:538
+#: ../src/empathy-account-assistant.c:541
msgid "Enter the details for the new account"
msgstr "Introducir los detalles para la cuenta nueva"
-#: ../src/empathy-account-assistant.c:653
+#: ../src/empathy-account-assistant.c:656
msgid ""
"With Empathy you can chat with people online nearby and with friends and "
"colleagues who use Google Talk, AIM, Windows Live and many other chat "
@@ -2201,41 +2201,41 @@ msgstr ""
"Google Talk, AIM, Windows Live y muchos otros programas de chat. Con un "
"micrófono o una cámara web puede hacer incluso llamadas de voz o vídeo."
-#: ../src/empathy-account-assistant.c:670
+#: ../src/empathy-account-assistant.c:673
msgid "Do you have an account you've been using with another chat program?"
msgstr "¿Tiene una cuenta que haya estado usando con otro programa de chat?"
-#: ../src/empathy-account-assistant.c:693
+#: ../src/empathy-account-assistant.c:696
msgid "Yes, import my account details from "
msgstr "Sí, importar los detalles de mi cuenta desde "
-#: ../src/empathy-account-assistant.c:714
+#: ../src/empathy-account-assistant.c:717
msgid "Yes, I'll enter my account details now"
msgstr "Sí, introduciré ahora los detalles de mi cuenta"
-#: ../src/empathy-account-assistant.c:736
+#: ../src/empathy-account-assistant.c:739
msgid "No, I want a new account"
msgstr "No, quiero crear una cuenta nueva"
-#: ../src/empathy-account-assistant.c:746
+#: ../src/empathy-account-assistant.c:749
msgid "No, I just want to see people online nearby for now"
msgstr "No, por ahora sólo quiero ver la gente conectada cerca"
-#: ../src/empathy-account-assistant.c:767
+#: ../src/empathy-account-assistant.c:770
msgid "Select the accounts you want to import:"
msgstr "Seleccione las cuentas que quiere importar:"
-#: ../src/empathy-account-assistant.c:851
+#: ../src/empathy-account-assistant.c:854
#: ../src/empathy-new-chatroom-dialog.c:607
#: ../src/empathy-new-chatroom-dialog.c:608
msgid "Yes"
msgstr "Sí"
-#: ../src/empathy-account-assistant.c:858
+#: ../src/empathy-account-assistant.c:861
msgid "No, that's all for now"
msgstr "No, eso es todo por ahora"
-#: ../src/empathy-account-assistant.c:1123
+#: ../src/empathy-account-assistant.c:1126
msgid ""
"Empathy can automatically discover and chat with the people connected on the "
"same network as you. If you want to use this feature, please check that the "
@@ -2248,16 +2248,16 @@ msgstr ""
"estos detalles posteriormente o desactivar esta característica usando el "
"diálogo «Cuentas»."
-#: ../src/empathy-account-assistant.c:1129
-#: ../src/empathy-account-assistant.c:1185
+#: ../src/empathy-account-assistant.c:1132
+#: ../src/empathy-account-assistant.c:1188
msgid "Edit->Accounts"
msgstr "Editar->Cuentas"
-#: ../src/empathy-account-assistant.c:1145
+#: ../src/empathy-account-assistant.c:1148
msgid "I don't want to enable this feature for now"
msgstr "No quiero activar esta característica por ahora"
-#: ../src/empathy-account-assistant.c:1181
+#: ../src/empathy-account-assistant.c:1184
msgid ""
"You won't be able to chat with people connected to your local network, as "
"telepathy-salut is not installed. If you want to enable this feature, please "
@@ -2269,23 +2269,23 @@ msgstr ""
"instale el paquete telepathy-salut y cree una cuenta de Gente cerca desde el "
"diálogo Cuentas."
-#: ../src/empathy-account-assistant.c:1187
+#: ../src/empathy-account-assistant.c:1190
msgid "telepathy-salut not installed"
msgstr "telepathy-salut no está instalado"
-#: ../src/empathy-account-assistant.c:1233
+#: ../src/empathy-account-assistant.c:1236
msgid "Messaging and VoIP Accounts Assistant"
msgstr "Asistente de cuentas de mensajería y Voz IP"
-#: ../src/empathy-account-assistant.c:1267
+#: ../src/empathy-account-assistant.c:1270
msgid "Welcome to Empathy"
msgstr "Bienvenido a Empathy"
-#: ../src/empathy-account-assistant.c:1276
+#: ../src/empathy-account-assistant.c:1279
msgid "Import your existing accounts"
msgstr "Importar sus cuentas existentes"
-#: ../src/empathy-account-assistant.c:1294
+#: ../src/empathy-account-assistant.c:1297
msgid "Please enter personal details"
msgstr "Introduzca los detalles personales"
@@ -2328,7 +2328,7 @@ msgstr "Estado desconocido"
msgid "Offline — Account Disabled"
msgstr "Desconectado: cuenta desactivada"
-#: ../src/empathy-accounts-dialog.c:767
+#: ../src/empathy-accounts-dialog.c:770
msgid ""
"You are about to create a new account, which will discard\n"
"your changes. Are you sure you want to proceed?"
@@ -2336,16 +2336,16 @@ msgstr ""
"Va a crear una cuenta nueva que descartará sus cambios.\n"
"¿Seguro que quiere continuar?"
-#: ../src/empathy-accounts-dialog.c:1114
+#: ../src/empathy-accounts-dialog.c:1117
#, c-format
msgid "Do you want to remove %s from your computer?"
msgstr "¿Quiere quitar %s de su equipo?"
-#: ../src/empathy-accounts-dialog.c:1118
+#: ../src/empathy-accounts-dialog.c:1121
msgid "This will not remove your account on the server."
msgstr "Esto no quitará su cuenta del servidor."
-#: ../src/empathy-accounts-dialog.c:1355
+#: ../src/empathy-accounts-dialog.c:1358
msgid ""
"You are about to select another account, which will discard\n"
"your changes. Are you sure you want to proceed?"
@@ -2353,7 +2353,7 @@ msgstr ""
"Va a seleccionar otra cuenta lo que descartará sus cambios.\n"
"¿Seguro que quiere continuar?"
-#: ../src/empathy-accounts-dialog.c:1932
+#: ../src/empathy-accounts-dialog.c:1935
msgid ""
"You are about to close the window, which will discard\n"
"your changes. Are you sure you want to proceed?"
@@ -3235,7 +3235,6 @@ msgid "Themes"
msgstr "Temas"
#: ../src/empathy-preferences.ui.h:24
-#| msgid "Automatically _connect on startup "
msgid "_Automatically connect on startup"
msgstr "C_onectarse automáticamente al inicio"
@@ -3360,6 +3359,11 @@ msgstr "Invitar participante"
msgid "Choose a contact to invite into the conversation:"
msgstr "Elegir un contacto para invitar a la conversación:"
+#: ../src/empathy-invite-participant-dialog.c:45
+#| msgid "Invisible"
+msgid "Invite"
+msgstr "Invitar"
+
#: ../src/empathy-accounts.c:213
msgid "Don't display any dialogs; do any work (eg, importing) and exit"
msgstr ""
diff --git a/po/et.po b/po/et.po
index 3dec209fb..85e25d0c6 100644
--- a/po/et.po
+++ b/po/et.po
@@ -12,8 +12,8 @@ msgstr ""
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?"
"product=empathy&component=general\n"
"POT-Creation-Date: 2010-03-18 07:49+0000\n"
-"PO-Revision-Date: 2010-03-21 15:11+0200\n"
-"Last-Translator: Ivar Smolin <okul@linux.ee>\n"
+"PO-Revision-Date: 2010-05-22 08:23+0300\n"
+"Last-Translator: Mattias Põldaru <mahfiaz gmail com>\n"
"Language-Team: Estonian <et@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -1085,7 +1085,7 @@ msgid "Send file"
msgstr "Saada fail"
msgid "Share my desktop"
-msgstr "Minu töölauda jagatakse"
+msgstr "Jaga minu töölauda"
msgid "Favorite"
msgstr "Lemmik"
@@ -1598,7 +1598,7 @@ msgid "What kind of chat account do you have?"
msgstr "Mis sorti konto sul on?"
msgid "Do you have any other chat accounts you want to set up?"
-msgstr "On Sul veel mõni konto, mida Sa soovid seadistada?"
+msgstr "Kas sul on veel mõni konto, mida soovid seadistada?"
msgid "Enter your account details"
msgstr "Määra oma konto üksikasjad"
@@ -1928,8 +1928,8 @@ msgstr[1] "%s (%d lugemata)"
#, c-format
msgid "%s (and %u other)"
msgid_plural "%s (and %u others)"
-msgstr[0] "%s (ja %u veel)"
-msgstr[1] "%s (ja %u veel)"
+msgstr[0] "%s (ja veel %u)"
+msgstr[1] "%s (ja veel %u)"
#, c-format
msgid "%s (%d unread from others)"
@@ -2538,4 +2538,3 @@ msgstr "Empathy kontod"
msgid "Empathy Debugger"
msgstr "Empathy siluja"
-
diff --git a/release.py b/release.py
index 5c170186b..98dd24a1a 100755
--- a/release.py
+++ b/release.py
@@ -9,7 +9,7 @@ import time
from string import Template
from optparse import OptionParser
-last_tag_patern = 'EMPATHY_2_31*'
+last_tag_pattern = 'EMPATHY_2_31*'
upload_server = 'master.gnome.org'
template = '''\
$name $version is now available for download from:
@@ -67,7 +67,7 @@ class Project:
version_dir = self.package_version[:second]
self.package_dl_url = 'http://download.gnome.org/sources/%s/%s/' % (self.package_name.lower(),
version_dir)
- tags_str = self.exec_cmd('git tag -l %s' % (last_tag_patern))
+ tags_str = self.exec_cmd('git tag -l %s' % (last_tag_pattern))
tags = tags_str.splitlines()
self.last_tag = tags[len(tags)-1]
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index 598f483ab..40c461488 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -1257,7 +1257,7 @@ contact_avatar_changed_cb (EmpathyContact *contact,
}
static void
-empathy_call_window_got_self_contact_cb (EmpathyTpContactFactory *factory,
+empathy_call_window_got_self_contact_cb (TpConnection *connection,
EmpathyContact *contact, const GError *error, gpointer user_data,
GObject *weak_object)
{
@@ -1282,7 +1282,6 @@ empathy_call_window_setup_avatars (EmpathyCallWindow *self,
if (priv->contact != NULL)
{
TpConnection *connection;
- EmpathyTpContactFactory *factory;
set_window_title (self);
@@ -1294,12 +1293,9 @@ empathy_call_window_setup_avatars (EmpathyCallWindow *self,
/* Retreiving the self avatar */
connection = empathy_contact_get_connection (priv->contact);
- factory = empathy_tp_contact_factory_dup_singleton (connection);
- empathy_tp_contact_factory_get_from_handle (factory,
+ empathy_tp_contact_factory_get_from_handle (connection,
tp_connection_get_self_handle (connection),
empathy_call_window_got_self_contact_cb, self, NULL, G_OBJECT (self));
-
- g_object_unref (factory);
}
else
{
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index d47e942f5..73c5f9472 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -94,6 +94,7 @@ typedef struct {
GtkUIManager *ui_manager;
GtkAction *menu_conv_insert_smiley;
GtkAction *menu_conv_favorite;
+ GtkAction *menu_conv_always_urgent;
GtkAction *menu_conv_toggle_contacts;
GtkAction *menu_edit_cut;
@@ -785,6 +786,13 @@ chat_window_conv_activate_cb (GtkAction *action,
DEBUG ("This room %s favorite", found ? "is" : "is not");
gtk_toggle_action_set_active (
GTK_TOGGLE_ACTION (priv->menu_conv_favorite), found);
+
+ if (chatroom != NULL)
+ found = empathy_chatroom_is_always_urgent (chatroom);
+
+ gtk_toggle_action_set_active (
+ GTK_TOGGLE_ACTION (priv->menu_conv_always_urgent),
+ found);
}
gtk_action_set_visible (priv->menu_conv_favorite, is_room);
@@ -828,19 +836,38 @@ chat_window_favorite_toggled_cb (GtkToggleAction *toggle_action,
account = empathy_chat_get_account (priv->current_chat);
room = empathy_chat_get_id (priv->current_chat);
- chatroom = empathy_chatroom_manager_find (priv->chatroom_manager,
- account, room);
+ chatroom = empathy_chatroom_manager_ensure_chatroom (
+ priv->chatroom_manager,
+ account,
+ room,
+ empathy_chat_get_name (priv->current_chat));
- if (chatroom == NULL) {
- const gchar *name;
+ empathy_chatroom_set_favorite (chatroom, active);
+ g_object_unref (chatroom);
+}
- name = empathy_chat_get_name (priv->current_chat);
- chatroom = empathy_chatroom_new_full (account, room, name, FALSE);
- empathy_chatroom_manager_add (priv->chatroom_manager, chatroom);
- g_object_unref (chatroom);
- }
+static void
+chat_window_always_urgent_toggled_cb (GtkToggleAction *toggle_action,
+ EmpathyChatWindow *window)
+{
+ EmpathyChatWindowPriv *priv = GET_PRIV (window);
+ gboolean active;
+ TpAccount *account;
+ const gchar *room;
+ EmpathyChatroom *chatroom;
- empathy_chatroom_set_favorite (chatroom, active);
+ active = gtk_toggle_action_get_active (toggle_action);
+ account = empathy_chat_get_account (priv->current_chat);
+ room = empathy_chat_get_id (priv->current_chat);
+
+ chatroom = empathy_chatroom_manager_ensure_chatroom (
+ priv->chatroom_manager,
+ account,
+ room,
+ empathy_chat_get_name (priv->current_chat));
+
+ empathy_chatroom_set_always_urgent (chatroom, active);
+ g_object_unref (chatroom);
}
static void
@@ -856,7 +883,7 @@ chat_window_contacts_toggled_cb (GtkToggleAction *toggle_action,
}
static void
-got_contact_cb (EmpathyTpContactFactory *factory,
+got_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -900,7 +927,6 @@ chat_window_invite_participant_activate_cb (GtkAction *action,
if (response == GTK_RESPONSE_ACCEPT) {
TpConnection *connection;
- EmpathyTpContactFactory *factory;
const char *id;
id = empathy_contact_selector_dialog_get_selected (
@@ -908,12 +934,8 @@ chat_window_invite_participant_activate_cb (GtkAction *action,
if (EMP_STR_EMPTY (id)) goto out;
connection = tp_channel_borrow_connection (channel);
- factory = empathy_tp_contact_factory_dup_singleton (connection);
-
- empathy_tp_contact_factory_get_from_id (factory, id,
+ empathy_tp_contact_factory_get_from_id (connection, id,
got_contact_cb, tp_chat, NULL, NULL);
-
- g_object_unref (factory);
}
out:
@@ -1360,11 +1382,27 @@ chat_window_new_message_cb (EmpathyChat *chat,
/* If empathy_chat_is_room () returns TRUE, that means it's a named MUC.
* If empathy_chat_get_remote_contact () returns NULL, that means it's
* an unamed MUC (msn-like).
- * In case of a MUC, we set urgency only if the message contains our
- * alias. */
+ * In case of a MUC, we set urgency if either:
+ * a) the chatroom's always_urgent property is TRUE
+ * b) the message contains our alias
+ */
if (empathy_chat_is_room (chat) ||
empathy_chat_get_remote_contact (chat) == NULL) {
- needs_urgency = empathy_message_should_highlight (message);
+ TpAccount *account;
+ const gchar *room;
+ EmpathyChatroom *chatroom;
+
+ account = empathy_chat_get_account (chat);
+ room = empathy_chat_get_id (chat);
+
+ chatroom = empathy_chatroom_manager_find (priv->chatroom_manager,
+ account, room);
+
+ if (empathy_chatroom_is_always_urgent (chatroom)) {
+ needs_urgency = TRUE;
+ } else {
+ needs_urgency = empathy_message_should_highlight (message);
+ }
} else {
needs_urgency = TRUE;
}
@@ -1865,6 +1903,7 @@ empathy_chat_window_init (EmpathyChatWindow *window)
"ui_manager", &priv->ui_manager,
"menu_conv_insert_smiley", &priv->menu_conv_insert_smiley,
"menu_conv_favorite", &priv->menu_conv_favorite,
+ "menu_conv_always_urgent", &priv->menu_conv_always_urgent,
"menu_conv_toggle_contacts", &priv->menu_conv_toggle_contacts,
"menu_edit_cut", &priv->menu_edit_cut,
"menu_edit_copy", &priv->menu_edit_copy,
@@ -1883,6 +1922,7 @@ empathy_chat_window_init (EmpathyChatWindow *window)
"menu_conv", "activate", chat_window_conv_activate_cb,
"menu_conv_clear", "activate", chat_window_clear_activate_cb,
"menu_conv_favorite", "toggled", chat_window_favorite_toggled_cb,
+ "menu_conv_always_urgent", "toggled", chat_window_always_urgent_toggled_cb,
"menu_conv_toggle_contacts", "toggled", chat_window_contacts_toggled_cb,
"menu_conv_invite_participant", "activate", chat_window_invite_participant_activate_cb,
"menu_conv_close", "activate", chat_window_close_activate_cb,
diff --git a/src/empathy-chat-window.ui b/src/empathy-chat-window.ui
index 362286a09..a4285bc96 100644
--- a/src/empathy-chat-window.ui
+++ b/src/empathy-chat-window.ui
@@ -32,6 +32,12 @@
</object>
</child>
<child>
+ <object class="GtkToggleAction" id="menu_conv_always_urgent">
+ <property name="name">menu_conv_always_urgent</property>
+ <property name="label" translatable="yes">Important Room</property>
+ </object>
+ </child>
+ <child>
<object class="GtkToggleAction" id="menu_conv_toggle_contacts">
<property name="name">menu_conv_toggle_contacts</property>
<property name="active">TRUE</property>
@@ -166,6 +172,7 @@
<menuitem action="menu_conv_clear"/>
<menuitem action="menu_conv_insert_smiley"/>
<menuitem action="menu_conv_favorite"/>
+ <menuitem action="menu_conv_always_urgent"/>
<menuitem action="menu_conv_toggle_contacts"/>
<menuitem action="menu_conv_invite_participant"/>
<separator/>
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index a7283594f..08f490966 100644
--- a/src/empathy-event-manager.c
+++ b/src/empathy-event-manager.c
@@ -624,7 +624,7 @@ event_room_channel_process_func (EventPriv *event)
}
static void
-event_manager_muc_invite_got_contact_cb (EmpathyTpContactFactory *factory,
+event_manager_muc_invite_got_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -665,7 +665,7 @@ event_manager_muc_invite_got_contact_cb (EmpathyTpContactFactory *factory,
}
static void
-event_manager_ft_got_contact_cb (EmpathyTpContactFactory *factory,
+event_manager_ft_got_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -730,20 +730,16 @@ event_manager_approve_channel_cb (EmpathyDispatcher *dispatcher,
channel, self_handle, &inviter, NULL, NULL))
{
/* We are invited to a room */
- EmpathyTpContactFactory *factory;
TpConnection *connection;
DEBUG ("Have been invited to %s. Ask user if he wants to accept",
tp_channel_get_identifier (channel));
connection = empathy_tp_chat_get_connection (tp_chat);
- factory = empathy_tp_contact_factory_dup_singleton (connection);
-
- empathy_tp_contact_factory_get_from_handle (factory,
+ empathy_tp_contact_factory_get_from_handle (connection,
inviter, event_manager_muc_invite_got_contact_cb,
approval, NULL, G_OBJECT (manager));
- g_object_unref (factory);
return;
}
@@ -781,17 +777,13 @@ event_manager_approve_channel_cb (EmpathyDispatcher *dispatcher,
TpChannel *channel;
TpConnection *connection;
TpHandle handle;
- EmpathyTpContactFactory *factory;
channel = empathy_dispatch_operation_get_channel (operation);
handle = tp_channel_get_handle (channel, NULL);
connection = tp_channel_borrow_connection (channel);
- factory = empathy_tp_contact_factory_dup_singleton (connection);
- empathy_tp_contact_factory_get_from_handle (factory, handle,
+ empathy_tp_contact_factory_get_from_handle (connection, handle,
event_manager_ft_got_contact_cb, approval, NULL, G_OBJECT (manager));
-
- g_object_unref (factory);
}
else
{
@@ -851,8 +843,7 @@ event_manager_pendings_changed_cb (EmpathyContactList *list,
}
static void
-event_manager_presence_changed_cb (EmpathyContactMonitor *monitor,
- EmpathyContact *contact,
+event_manager_presence_changed_cb (EmpathyContact *contact,
TpConnectionPresenceType current,
TpConnectionPresenceType previous,
EmpathyEventManager *manager)
@@ -872,33 +863,45 @@ event_manager_presence_changed_cb (EmpathyContactMonitor *monitor,
TP_CONNECTION_PRESENCE_TYPE_OFFLINE) > 0)
{
/* contact was online */
- empathy_conf_get_bool (empathy_conf_get (),
- EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNOUT, &preference);
- if (preference && tp_connection_presence_type_cmp_availability (current,
+ if (tp_connection_presence_type_cmp_availability (current,
TP_CONNECTION_PRESENCE_TYPE_OFFLINE) <= 0)
{
/* someone is logging off */
- header = g_strdup_printf (_("%s is now offline."),
- empathy_contact_get_name (contact));
+ empathy_sound_play (empathy_main_window_get (),
+ EMPATHY_SOUND_CONTACT_DISCONNECTED);
- event_manager_add (manager, contact, EMPATHY_EVENT_TYPE_PRESENCE,
- EMPATHY_IMAGE_AVATAR_DEFAULT, header, NULL, NULL, NULL, NULL);
+ empathy_conf_get_bool (empathy_conf_get (),
+ EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNOUT, &preference);
+ if (preference)
+ {
+ header = g_strdup_printf (_("%s is now offline."),
+ empathy_contact_get_name (contact));
+
+ event_manager_add (manager, contact, EMPATHY_EVENT_TYPE_PRESENCE,
+ EMPATHY_IMAGE_AVATAR_DEFAULT, header, NULL, NULL, NULL, NULL);
+ }
}
}
else
{
/* contact was offline */
- empathy_conf_get_bool (empathy_conf_get (),
- EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNIN, &preference);
if (preference && tp_connection_presence_type_cmp_availability (current,
TP_CONNECTION_PRESENCE_TYPE_OFFLINE) > 0)
{
/* someone is logging in */
- header = g_strdup_printf (_("%s is now online."),
- empathy_contact_get_name (contact));
+ empathy_sound_play (empathy_main_window_get (),
+ EMPATHY_SOUND_CONTACT_CONNECTED);
+
+ empathy_conf_get_bool (empathy_conf_get (),
+ EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNIN, &preference);
+ if (preference)
+ {
+ header = g_strdup_printf (_("%s is now online."),
+ empathy_contact_get_name (contact));
- event_manager_add (manager, contact, EMPATHY_EVENT_TYPE_PRESENCE,
- EMPATHY_IMAGE_AVATAR_DEFAULT, header, NULL, NULL, NULL, NULL);
+ event_manager_add (manager, contact, EMPATHY_EVENT_TYPE_PRESENCE,
+ EMPATHY_IMAGE_AVATAR_DEFAULT, header, NULL, NULL, NULL, NULL);
+ }
}
}
g_free (header);
@@ -907,6 +910,22 @@ out:
g_object_unref (idle);
}
+static void
+event_manager_members_changed_cb (EmpathyContactList *list,
+ EmpathyContact *contact,
+ EmpathyContact *actor,
+ guint reason,
+ gchar *message,
+ gboolean is_member,
+ EmpathyEventManager *manager)
+{
+ if (is_member)
+ g_signal_connect (contact, "presence-changed",
+ G_CALLBACK (event_manager_presence_changed_cb), manager);
+ else
+ g_signal_handlers_disconnect_by_func (contact,
+ event_manager_presence_changed_cb, manager);
+}
static GObject *
event_manager_constructor (GType type,
@@ -989,12 +1008,6 @@ empathy_event_manager_init (EmpathyEventManager *manager)
{
EmpathyEventManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
EMPATHY_TYPE_EVENT_MANAGER, EmpathyEventManagerPriv);
- EmpathyContactMonitor *monitor;
- EmpathyContactList *list_iface;
-
- list_iface = EMPATHY_CONTACT_LIST (empathy_contact_manager_dup_singleton ());
- monitor = empathy_contact_list_get_monitor (list_iface);
- g_object_unref (list_iface);
manager->priv = priv;
@@ -1004,8 +1017,8 @@ empathy_event_manager_init (EmpathyEventManager *manager)
G_CALLBACK (event_manager_approve_channel_cb), manager);
g_signal_connect (priv->contact_manager, "pendings-changed",
G_CALLBACK (event_manager_pendings_changed_cb), manager);
- g_signal_connect (monitor, "contact-presence-changed",
- G_CALLBACK (event_manager_presence_changed_cb), manager);
+ g_signal_connect (priv->contact_manager, "members-changed",
+ G_CALLBACK (event_manager_members_changed_cb), manager);
}
EmpathyEventManager *
diff --git a/src/empathy-invite-participant-dialog.c b/src/empathy-invite-participant-dialog.c
index 77fb93738..da75e72cd 100644
--- a/src/empathy-invite-participant-dialog.c
+++ b/src/empathy-invite-participant-dialog.c
@@ -42,7 +42,7 @@ empathy_invite_participant_dialog_init (EmpathyInviteParticipantDialog *self)
gtk_widget_show (label);
parent->button_action = gtk_dialog_add_button (GTK_DIALOG (self),
- "Invite", GTK_RESPONSE_ACCEPT);
+ _("Invite"), GTK_RESPONSE_ACCEPT);
gtk_widget_set_sensitive (parent->button_action, FALSE);
gtk_window_set_title (GTK_WINDOW (self), _("Invite Participant"));
diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c
index b526a4c0b..ae1667622 100644
--- a/src/empathy-main-window.c
+++ b/src/empathy-main-window.c
@@ -124,7 +124,7 @@ typedef struct {
GList *actions_connected;
/* The idle event source to migrate butterfly's logs */
- guint butterfly_log_migration_contact_added_id;
+ guint butterfly_log_migration_members_changed_id;
} EmpathyMainWindow;
static EmpathyMainWindow *main_window = NULL;
@@ -556,49 +556,6 @@ main_window_connection_changed_cb (TpAccount *account,
}
static void
-main_window_contact_presence_changed_cb (EmpathyContactMonitor *monitor,
- EmpathyContact *contact,
- TpConnectionPresenceType current,
- TpConnectionPresenceType previous,
- EmpathyMainWindow *window)
-{
- TpAccount *account;
- gboolean should_play = FALSE;
- EmpathyIdle *idle;
-
- account = empathy_contact_get_account (contact);
- idle = empathy_idle_dup_singleton ();
-
- should_play = !empathy_idle_account_is_just_connected (idle, account);
-
- if (!should_play)
- goto out;
-
- if (tp_connection_presence_type_cmp_availability (previous,
- TP_CONNECTION_PRESENCE_TYPE_OFFLINE) > 0)
- {
- /* contact was online */
- if (tp_connection_presence_type_cmp_availability (current,
- TP_CONNECTION_PRESENCE_TYPE_OFFLINE) <= 0)
- /* someone is logging off */
- empathy_sound_play (GTK_WIDGET (window->window),
- EMPATHY_SOUND_CONTACT_DISCONNECTED);
- }
- else
- {
- /* contact was offline */
- if (tp_connection_presence_type_cmp_availability (current,
- TP_CONNECTION_PRESENCE_TYPE_OFFLINE) > 0)
- /* someone is logging in */
- empathy_sound_play (GTK_WIDGET (window->window),
- EMPATHY_SOUND_CONTACT_CONNECTED);
- }
-
-out:
- g_object_unref (idle);
-}
-
-static void
main_window_accels_load (void)
{
gchar *filename;
@@ -1302,14 +1259,21 @@ account_manager_prepared_cb (GObject *source_object,
}
static void
-main_window_contact_added_cb (EmpathyContactMonitor *monitor,
- EmpathyContact *contact,
- EmpathyMainWindow *window)
+main_window_members_changed_cb (EmpathyContactList *list,
+ EmpathyContact *contact,
+ EmpathyContact *actor,
+ guint reason,
+ gchar *message,
+ gboolean is_member,
+ EmpathyMainWindow *window)
{
+ if (!is_member)
+ return;
+
if (!empathy_migrate_butterfly_logs (contact)) {
- g_signal_handler_disconnect (monitor,
- window->butterfly_log_migration_contact_added_id);
- window->butterfly_log_migration_contact_added_id = 0;
+ g_signal_handler_disconnect (list,
+ window->butterfly_log_migration_members_changed_id);
+ window->butterfly_log_migration_members_changed_id = 0;
}
}
@@ -1318,7 +1282,6 @@ empathy_main_window_show (void)
{
EmpathyMainWindow *window;
EmpathyContactList *list_iface;
- EmpathyContactMonitor *monitor;
GtkBuilder *gui;
EmpathyConf *conf;
GtkWidget *sw;
@@ -1451,15 +1414,13 @@ empathy_main_window_show (void)
window->throbber_tool_item = GTK_WIDGET (item);
list_iface = EMPATHY_CONTACT_LIST (empathy_contact_manager_dup_singleton ());
- monitor = empathy_contact_list_get_monitor (list_iface);
window->list_store = empathy_contact_list_store_new (list_iface);
window->list_view = empathy_contact_list_view_new (window->list_store,
EMPATHY_CONTACT_LIST_FEATURE_ALL,
EMPATHY_CONTACT_FEATURE_ALL);
- g_signal_connect (monitor, "contact-presence-changed",
- G_CALLBACK (main_window_contact_presence_changed_cb), window);
- window->butterfly_log_migration_contact_added_id = g_signal_connect (monitor, "contact-added",
- G_CALLBACK (main_window_contact_added_cb), window);
+ window->butterfly_log_migration_members_changed_id = g_signal_connect (
+ list_iface, "members-changed",
+ G_CALLBACK (main_window_members_changed_cb), window);
g_object_unref (list_iface);
gtk_widget_show (GTK_WIDGET (window->list_view));
diff --git a/tools/with-session-bus.sh b/tools/with-session-bus.sh
index 519b9b1c8..063bd7e17 100644
--- a/tools/with-session-bus.sh
+++ b/tools/with-session-bus.sh
@@ -15,6 +15,7 @@ set -e
me=with-session-bus
dbus_daemon_args="--print-address=5 --print-pid=6 --fork"
+sleep=0
usage ()
{
@@ -29,6 +30,11 @@ usage ()
while test "z$1" != "z--"; do
case "$1" in
+ --sleep=*)
+ sleep="$1"
+ sleep="${sleep#--sleep=}"
+ shift
+ ;;
--session)
dbus_daemon_args="$dbus_daemon_args --session"
shift
@@ -73,11 +79,15 @@ export DBUS_SESSION_BUS_ADDRESS
if [ -n "$WITH_SESSION_BUS_FORK_DBUS_MONITOR" ] ; then
echo -n "Forking dbus-monitor $WITH_SESSION_BUS_FORK_DBUS_MONITOR_OPT" >&2
dbus-monitor $WITH_SESSION_BUS_FORK_DBUS_MONITOR_OPT \
- &> $me-$$.dbus-monitor-logs &
+ > $me-$$.dbus-monitor-logs 2>&1 &
fi
"$@" || e=$?
+if test $sleep != 0; then
+ sleep $sleep
+fi
+
trap - INT HUP TERM
cleanup