[polari] room: Make username parameter to send_identify() optional
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] room: Make username parameter to send_identify() optional
- Date: Wed, 21 Jun 2017 16:42:56 +0000 (UTC)
commit dc9e9039244a2137ca3ad343e9537331d6839479
Author: Justyn Temme <Justyntemme gmail com>
Date: Wed May 10 06:49:51 2017 -0500
room: Make username parameter to send_identify() optional
Not all NickServ bots understand the username parameter, so the
identify command we send doesn't work at all on those networks.
We will address this by not sending the username unconditionally,
so as a first step make the parameter optional.
https://bugzilla.gnome.org/show_bug.cgi?id=772915
src/lib/polari-room.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/lib/polari-room.c b/src/lib/polari-room.c
index d741e83..80f52b9 100644
--- a/src/lib/polari-room.c
+++ b/src/lib/polari-room.c
@@ -268,6 +268,11 @@ on_identify_message_sent (GObject *source,
g_object_unref (task);
}
+/**
+ * polari_room_send_identify_message_async:
+ * @username: (nullable): Username to use in identify command or %NULL
+ */
+
void
polari_room_send_identify_message_async (PolariRoom *room,
const char *command,
@@ -282,7 +287,7 @@ polari_room_send_identify_message_async (PolariRoom *room,
char *text;
g_return_if_fail (POLARI_IS_ROOM (room));
- g_return_if_fail (command != NULL && username != NULL && password != NULL);
+ g_return_if_fail (command != NULL && password != NULL);
priv = room->priv;
@@ -299,7 +304,11 @@ polari_room_send_identify_message_async (PolariRoom *room,
/* Don't emit ::identify-sent for our own identify message */
room->priv->ignore_identify = TRUE;
- text = g_strdup_printf ("%s %s %s", command, username, password);
+ if (username == NULL)
+ text = g_strdup_printf ("%s %s", command, password);
+ else
+ text = g_strdup_printf ("%s %s %s", command, username, password);
+
message = tp_client_message_new_text (TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL, text);
tp_text_channel_send_message_async (TP_TEXT_CHANNEL (priv->channel), message,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]