diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2011-11-03 23:27:24 +0000 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2011-11-04 09:02:40 +0000 |
commit | b34a0207287a3976e1b880c5b958b9215c5930ad (patch) | |
tree | 85e2b0a8db759e3ac2f68cb1e63fb5458e2308c6 | |
parent | 9b81a8da064954b714474208d2fb4e7d5cb2d6b4 (diff) |
im_channel_receive: remove redundant 'sender' parameter
If we're passing an incoming message to a 1-1 IM channel, we don't need
to tell the channel who sent the message: it knows perfectly well. In
fact, we were telling it twice: once in handle form (which is
redundant), and once in full JID form (which is more useful: it lets the
channel update its resource binding).
-rw-r--r-- | src/im-channel.c | 8 | ||||
-rw-r--r-- | src/im-channel.h | 1 | ||||
-rw-r--r-- | src/im-factory.c | 2 |
3 files changed, 5 insertions, 6 deletions
diff --git a/src/im-channel.c b/src/im-channel.c index fdac5b224..ee458a2cc 100644 --- a/src/im-channel.c +++ b/src/im-channel.c @@ -396,7 +396,6 @@ _gabble_im_channel_send_message (GObject *object, * _gabble_im_channel_receive: * @chan: a channel * @type: the message type - * @sender: the sender of the message (which may not be 0) * @from: the full JID we received the message from * @timestamp: the time at which the message was sent (not the time it was * received) @@ -417,7 +416,6 @@ _gabble_im_channel_send_message (GObject *object, void _gabble_im_channel_receive (GabbleIMChannel *chan, TpChannelTextMessageType type, - TpHandle sender, const char *from, time_t timestamp, const gchar *id, @@ -429,6 +427,7 @@ _gabble_im_channel_receive (GabbleIMChannel *chan, GabbleIMChannelPrivate *priv; TpBaseChannel *base_chan; TpBaseConnection *base_conn; + TpHandle peer; TpMessage *msg; gchar *tmp; @@ -436,6 +435,7 @@ _gabble_im_channel_receive (GabbleIMChannel *chan, priv = chan->priv; base_chan = (TpBaseChannel *) chan; base_conn = tp_base_channel_get_connection (base_chan); + peer = tp_base_channel_get_target_handle (base_chan); if (send_error == GABBLE_TEXT_CHANNEL_SEND_NO_ERROR) { @@ -481,7 +481,7 @@ _gabble_im_channel_receive (GabbleIMChannel *chan, if (send_error == GABBLE_TEXT_CHANNEL_SEND_NO_ERROR) { - tp_cm_message_set_sender (msg, sender); + tp_cm_message_set_sender (msg, peer); tp_message_set_int64 (msg, 0, "message-received", time (NULL)); if (id != NULL) @@ -495,7 +495,7 @@ _gabble_im_channel_receive (GabbleIMChannel *chan, tp_message_set_uint32 (delivery_report, 0, "message-type", TP_CHANNEL_TEXT_MESSAGE_TYPE_DELIVERY_REPORT); - tp_cm_message_set_sender (delivery_report, sender); + tp_cm_message_set_sender (delivery_report, peer); tp_message_set_int64 (delivery_report, 0, "message-received", time (NULL)); diff --git a/src/im-channel.h b/src/im-channel.h index 17d6271b0..1280e44da 100644 --- a/src/im-channel.h +++ b/src/im-channel.h @@ -66,7 +66,6 @@ GType gabble_im_channel_get_type (void); void _gabble_im_channel_receive (GabbleIMChannel *chan, TpChannelTextMessageType type, - TpHandle sender, const char *from, time_t timestamp, const char *id, diff --git a/src/im-factory.c b/src/im-factory.c index 45856eef4..6c61b91af 100644 --- a/src/im-factory.c +++ b/src/im-factory.c @@ -273,7 +273,7 @@ im_factory_message_cb (LmMessageHandler *handler, } if (body != NULL) - _gabble_im_channel_receive (chan, msgtype, handle, from, stamp, id, body, + _gabble_im_channel_receive (chan, msgtype, from, stamp, id, body, send_error, delivery_status, state); else if (state != -1 && send_error == GABBLE_TEXT_CHANNEL_SEND_NO_ERROR) _gabble_im_channel_state_receive (chan, (TpChannelChatState) state); |