...
 
Commits (15)
NEW in 3.4.2.3 (27/06/2012)
==============
This release includes 3 more patches I backported from master and fixing other
potential crashes.
Bugs fixed:
- Fixed #677641, Use a weak reference while loading the logs asynchronously to detect when the object has been destroyed (Debarshi Ray)
NEW in 3.4.2.2 (27/06/2012)
==============
This releases fixes an empathy-chat crash caused by a race in telepathy-glib.
Bugs fixed:
- Fixed #678307, irc connection parameters dialog: "apply" button stays unsensitive (Guillaume Desmottes)
- Fixed #678807, empathy-chat crashed with SIGSEGV in _tp_base_client_handle_channels() (Guillaume Desmottes)
NEW in 3.4.2.1 (21/05/2012)
==============
......
......@@ -4,7 +4,7 @@ m4_define(empathy_released, 0)
m4_define([empathy_major_version], [3])
m4_define([empathy_minor_version], [4])
m4_define([empathy_micro_version], [2])
m4_define([empathy_nano_version], [1])
m4_define([empathy_nano_version], [3])
dnl Display the nano_version only if it's not '0'
m4_define([empathy_base_version],
......
......@@ -174,14 +174,6 @@ static guint signals[LAST_SIGNAL] = { 0 };
/* Based on http://www.ietf.org/rfc/rfc2812.txt (section 2.3.1) */
#define IRC_SPECIAL "_\\[\\]{}\\\\|`^"
#define IRC_NICK_NAME "(["ALPHA IRC_SPECIAL"]["ALPHADIGITDASH IRC_SPECIAL"]*)"
/* user = 1*( %x01-09 / %x0B-0C / %x0E-1F / %x21-3F / %x41-FF )
* ; any octet except NUL, CR, LF, " " and "@"
*
* so technically, like so many other places in IRC, we should be using arrays
* of bytes here rather than UTF-8 strings. Life: too short. In practice this
* will always be ASCII.
*/
#define IRC_USER_NAME "([^\r\n@ ])+"
/* Based on http://www.ietf.org/rfc/rfc4622.txt (section 2.2)
* We just exclude invalid characters to avoid ucschars and other redundant
......@@ -198,7 +190,6 @@ static guint signals[LAST_SIGNAL] = { 0 };
#define ACCOUNT_REGEX_ICQ "^"ICQ_USER_NAME"$"
#define ACCOUNT_REGEX_IRC "^"IRC_NICK_NAME"$"
#define USERNAME_REGEX_IRC "^"IRC_USER_NAME"$"
#define ACCOUNT_REGEX_JABBER "^"JABBER_USER_NAME"@[^@/]+"
#define ACCOUNT_REGEX_MSN "^"MSN_USER_NAME"@"HOST"$"
#define ACCOUNT_REGEX_YAHOO "^"YAHOO_USER_NAME"$"
......@@ -1106,8 +1097,6 @@ account_widget_build_irc (EmpathyAccountWidget *self,
{
empathy_account_settings_set_regex (self->priv->settings, "account",
ACCOUNT_REGEX_IRC);
empathy_account_settings_set_regex (self->priv->settings, "username",
USERNAME_REGEX_IRC);
if (self->priv->simple)
{
......
......@@ -2520,26 +2520,35 @@ static gboolean
chat_log_filter (TplEvent *event,
gpointer user_data)
{
EmpathyChat *chat = user_data;
TpWeakRef *wr = user_data;
EmpathyChat *chat = tp_weak_ref_dup_object (wr);
EmpathyMessage *message;
EmpathyChatPriv *priv = GET_PRIV (chat);
EmpathyChatPriv *priv;
const GList *pending;
bool retval = FALSE;
if (chat == NULL)
return FALSE;
g_return_val_if_fail (TPL_IS_EVENT (event), FALSE);
g_return_val_if_fail (EMPATHY_IS_CHAT (chat), FALSE);
priv = GET_PRIV (chat);
pending = empathy_tp_chat_get_pending_messages (priv->tp_chat);
message = empathy_message_from_tpl_log_event (event);
for (; pending; pending = g_list_next (pending)) {
if (empathy_message_equal (message, pending->data)) {
g_object_unref (message);
return FALSE;
}
if (empathy_message_equal (message, pending->data))
goto out;
}
retval = TRUE;
out:
g_object_unref (message);
return TRUE;
g_object_unref (chat);
return retval;
}
......@@ -2572,10 +2581,18 @@ got_filtered_messages_cb (GObject *manager,
{
GList *l;
GList *messages;
EmpathyChat *chat = EMPATHY_CHAT (user_data);
EmpathyChatPriv *priv = GET_PRIV (chat);
TpWeakRef *wr = user_data;
EmpathyChat *chat = tp_weak_ref_dup_object (wr);
EmpathyChatPriv *priv;
GError *error = NULL;
if (chat == NULL) {
tp_weak_ref_destroy (wr);
return;
}
priv = GET_PRIV (chat);
if (!tpl_log_manager_get_filtered_events_finish (TPL_LOG_MANAGER (manager),
result, &messages, &error)) {
DEBUG ("%s. Aborting.", error->message);
......@@ -2637,6 +2654,9 @@ out:
/* Turn back on scrolling */
empathy_chat_view_scroll (chat->view, TRUE);
g_object_unref (chat);
tp_weak_ref_destroy (wr);
}
static void
......@@ -2644,6 +2664,7 @@ chat_add_logs (EmpathyChat *chat)
{
EmpathyChatPriv *priv = GET_PRIV (chat);
TplEntity *target;
TpWeakRef *wr;
if (!priv->id) {
return;
......@@ -2659,15 +2680,16 @@ chat_add_logs (EmpathyChat *chat)
target = tpl_entity_new (priv->id, TPL_ENTITY_CONTACT, NULL, NULL);
priv->retrieving_backlogs = TRUE;
wr = tp_weak_ref_new (chat, NULL, NULL);
tpl_log_manager_get_filtered_events_async (priv->log_manager,
priv->account,
target,
TPL_EVENT_MASK_TEXT,
5,
chat_log_filter,
chat,
wr,
got_filtered_messages_cb,
(gpointer) chat);
wr);
g_object_unref (target);
}
......
......@@ -342,6 +342,17 @@ contact_widget_details_update_edit (EmpathyContactWidget *information)
{
TpContactInfoField *field = l->data;
/* For some reason it can happen that the vCard contains fields the CM
* claims to be not supported. This is a workaround for gabble bug
* https://bugs.freedesktop.org/show_bug.cgi?id=64319. But we shouldn't
* crash on buggy CM anyway. */
if (get_spec_from_list (specs, field->field_name) == NULL)
{
DEBUG ("Buggy CM: self's vCard contains %s field but it is not in "
"Connection' supported fields", field->field_name);
continue;
}
/* make a copy for the details_to_set list */
field = tp_contact_info_field_copy (field);
DEBUG ("Field %s is in our vCard", field->field_name);
......
......@@ -45,12 +45,8 @@ empathy_client_factory_create_channel (TpSimpleClientFactory *factory,
if (!tp_strdiff (chan_type, TP_IFACE_CHANNEL_TYPE_TEXT))
{
TpAccount *account;
account = tp_connection_get_account (conn);
return TP_CHANNEL (empathy_tp_chat_new (
TP_SIMPLE_CLIENT_FACTORY (factory), account, conn, path,
TP_SIMPLE_CLIENT_FACTORY (factory), conn, path,
properties));
}
......
......@@ -225,9 +225,11 @@ ft_handler_outgoing_ready_cb (EmpathyFTHandler *handler,
GError *error,
gpointer user_data)
{
EmpathyFTFactory *factory = user_data;
EmpathyFTFactory *factory = EMPATHY_FT_FACTORY (user_data);
g_signal_emit (factory, signals[NEW_FT_HANDLER], 0, handler, error);
g_object_unref (factory);
}
/* public methods */
......@@ -266,7 +268,7 @@ empathy_ft_factory_new_transfer_outgoing (EmpathyFTFactory *factory,
g_return_if_fail (G_IS_FILE (source));
empathy_ft_handler_new_outgoing (contact, source, action_time,
ft_handler_outgoing_ready_cb, factory);
ft_handler_outgoing_ready_cb, g_object_ref (factory));
}
/**
......
......@@ -153,8 +153,7 @@ facebook_new_challenge_cb (TpChannel *channel,
GoaOAuth2Based *oauth2;
const gchar *client_id;
GHashTable *h;
GHashTable *params;
gchar *response;
GString *response_string;
GArray *response_array;
DEBUG ("new challenge for %s:\n%s",
......@@ -166,28 +165,30 @@ facebook_new_challenge_cb (TpChannel *channel,
oauth2 = goa_object_get_oauth2_based (data->goa_object);
client_id = goa_oauth2_based_get_client_id (oauth2);
/* See https://developers.facebook.com/docs/chat/#platauth */
params = g_hash_table_new (g_str_hash, g_str_equal);
g_hash_table_insert (params, "method", g_hash_table_lookup (h, "method"));
g_hash_table_insert (params, "nonce", g_hash_table_lookup (h, "nonce"));
g_hash_table_insert (params, "access_token", data->access_token);
g_hash_table_insert (params, "api_key", (gpointer) client_id);
g_hash_table_insert (params, "call_id", "0");
g_hash_table_insert (params, "v", "1.0");
response = soup_form_encode_hash (params);
DEBUG ("Response: %s", response);
/* See https://developers.facebook.com/docs/chat/#platauth.
* We don't use soup_form_encode() here because it would escape parameters
* and facebook server is not expecting that and would reject the response. */
response_string = g_string_new ("v=1.0&call_id=0");
g_string_append (response_string, "&access_token=");
g_string_append_uri_escaped (response_string, data->access_token, NULL, TRUE);
g_string_append (response_string, "&api_key=");
g_string_append_uri_escaped (response_string, client_id, NULL, TRUE);
g_string_append (response_string, "&method=");
g_string_append_uri_escaped (response_string, g_hash_table_lookup (h, "method"), NULL, TRUE);
g_string_append (response_string, "&nonce=");
g_string_append_uri_escaped (response_string, g_hash_table_lookup (h, "nonce"), NULL, TRUE);
DEBUG ("Response: %s", response_string->str);
response_array = g_array_new (FALSE, FALSE, sizeof (gchar));
g_array_append_vals (response_array, response, strlen (response));
g_array_append_vals (response_array, response_string->str, response_string->len);
tp_cli_channel_interface_sasl_authentication_call_respond (data->channel, -1,
response_array, NULL, NULL, NULL, NULL);
g_hash_table_unref (h);
g_hash_table_unref (params);
g_object_unref (oauth2);
g_free (response);
g_string_free (response_string, TRUE);
g_array_unref (response_array);
}
......
......@@ -179,6 +179,7 @@ tp_chat_add (EmpathyContactList *list,
const char *object_path;
GPtrArray channels = { (gpointer *) &object_path, 1 };
const char *invitees[2] = { NULL, };
TpAccount *account;
invitees[0] = empathy_contact_get_id (contact);
object_path = tp_proxy_get_object_path (self);
......@@ -195,7 +196,9 @@ tp_chat_add (EmpathyContactList *list,
/* FIXME: InvitationMessage ? */
NULL);
req = tp_account_channel_request_new (self->priv->account, props,
account = empathy_tp_chat_get_account (self);
req = tp_account_channel_request_new (account, props,
TP_USER_ACTION_TIME_NOT_USER_ACTION);
/* Although this is a MUC, it's anonymous, so CreateChannel is
......@@ -761,7 +764,6 @@ tp_chat_dispose (GObject *object)
{
EmpathyTpChat *self = EMPATHY_TP_CHAT (object);
tp_clear_object (&self->priv->account);
tp_clear_object (&self->priv->remote_contact);
tp_clear_object (&self->priv->user);
......@@ -1107,9 +1109,6 @@ tp_chat_get_property (GObject *object,
EmpathyTpChat *self = EMPATHY_TP_CHAT (object);
switch (param_id) {
case PROP_ACCOUNT:
g_value_set_object (value, self->priv->account);
break;
case PROP_SELF_CONTACT:
g_value_set_object (value, self->priv->user);
break;
......@@ -1134,24 +1133,6 @@ tp_chat_get_property (GObject *object,
};
}
static void
tp_chat_set_property (GObject *object,
guint param_id,
const GValue *value,
GParamSpec *pspec)
{
EmpathyTpChat *self = EMPATHY_TP_CHAT (object);
switch (param_id) {
case PROP_ACCOUNT:
self->priv->account = g_value_dup_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
};
}
enum {
FEAT_READY,
N_FEAT
......@@ -1187,20 +1168,9 @@ empathy_tp_chat_class_init (EmpathyTpChatClass *klass)
object_class->dispose = tp_chat_dispose;
object_class->finalize = tp_chat_finalize;
object_class->get_property = tp_chat_get_property;
object_class->set_property = tp_chat_set_property;
proxy_class->list_features = tp_chat_list_features;
g_object_class_install_property (object_class,
PROP_ACCOUNT,
g_param_spec_object ("account",
"TpAccount",
"the account associated with the chat",
TP_TYPE_ACCOUNT,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
/**
* EmpathyTpChat:self-contact:
*
......@@ -1315,20 +1285,17 @@ tp_chat_iface_init (EmpathyContactListIface *iface)
EmpathyTpChat *
empathy_tp_chat_new (
TpSimpleClientFactory *factory,
TpAccount *account,
TpConnection *conn,
const gchar *object_path,
const GHashTable *immutable_properties)
{
TpProxy *conn_proxy = (TpProxy *) conn;
g_return_val_if_fail (TP_IS_ACCOUNT (account), NULL);
g_return_val_if_fail (TP_IS_CONNECTION (conn), NULL);
g_return_val_if_fail (immutable_properties != NULL, NULL);
return g_object_new (EMPATHY_TYPE_TP_CHAT,
"factory", factory,
"account", account,
"connection", conn,
"dbus-daemon", conn_proxy->dbus_daemon,
"bus-name", conn_proxy->bus_name,
......@@ -1365,9 +1332,13 @@ empathy_tp_chat_get_remote_contact (EmpathyTpChat *self)
TpAccount *
empathy_tp_chat_get_account (EmpathyTpChat *self)
{
g_return_val_if_fail (EMPATHY_IS_TP_CHAT (self), NULL);
TpConnection *connection;
g_return_val_if_fail (EMPATHY_IS_TP_CHAT (self), NULL);
connection = tp_channel_borrow_connection (TP_CHANNEL (self));
return self->priv->account;
return tp_connection_get_account (connection);
}
void
......
......@@ -66,7 +66,6 @@ GType empathy_tp_chat_get_type (void) G_GNUC_CONST;
EmpathyTpChat *empathy_tp_chat_new (
TpSimpleClientFactory *factory,
TpAccount *account,
TpConnection *connection,
const gchar *object_path,
const GHashTable *immutable_properties);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -779,6 +779,8 @@ empathy_app_constructed (GObject *object)
tp_proxy_prepare_async (self->account_manager, NULL,
account_manager_ready_cb, self);
tp_account_manager_enable_restart (self->account_manager);
migrate_config_to_xdg_dir ();
/* Logging */
......