pidgin/pidgin

Make all irc login time commands skip the rate limiter.
release-2.x.y
24 months ago, Gary Kramlich
3230f4408394
Parents 13cdb7956bdc
Children a6fde7e0a5af
Make all irc login time commands skip the rate limiter.

Most networks don't rate limit during the login process but will time you out
if you take too long. Running through the SASL mechansism on Freenode with the
rate limiter was causing us to time out. The ideal solution is to handle the
908 reply and use those mechanisms directly, but I ran into some issues and
this is useful on its own.

Testing Done:
Connected to Freenode and verified we didn't time out during SASL login.

Reviewed at https://reviews.imfreedom.org/r/1391/
--- a/libpurple/protocols/irc/irc.c Wed Apr 27 23:41:06 2022 -0500
+++ b/libpurple/protocols/irc/irc.c Wed Apr 27 23:44:53 2022 -0500
@@ -101,13 +101,14 @@
return ret;
}
-void irc_priority_send(struct irc_conn *irc, const char *buf)
+int irc_priority_send(struct irc_conn *irc, const char *buf)
{
if(irc->sent_partial) {
g_queue_insert_after(irc->send_queue, irc->send_queue->head,
g_strdup(buf));
+ return 0;
} else {
- do_send(irc, buf, strlen(buf));
+ return do_send(irc, buf, strlen(buf));
}
}
@@ -459,7 +460,7 @@
else /* intended to fall through */
#endif
buf = irc_format(irc, "v:", "PASS", pass);
- if (do_send(irc, buf, strlen(buf)) < 0) {
+ if (irc_priority_send(irc, buf) < 0) {
g_free(buf);
return FALSE;
}
@@ -492,7 +493,7 @@
strlen(realname) ? realname : nickname);
g_free(tmp);
g_free(server);
- if (do_send(irc, buf, strlen(buf)) < 0) {
+ if (irc_priority_send(irc, buf) < 0) {
g_free(buf);
return FALSE;
}
@@ -501,7 +502,7 @@
buf = irc_format(irc, "vn", "NICK", nickname);
irc->reqnick = g_strdup(nickname);
irc->nickused = FALSE;
- if (do_send(irc, buf, strlen(buf)) < 0) {
+ if (irc_priority_send(irc, buf) < 0) {
g_free(buf);
return FALSE;
}
--- a/libpurple/protocols/irc/irc.h Wed Apr 27 23:41:06 2022 -0500
+++ b/libpurple/protocols/irc/irc.h Wed Apr 27 23:44:53 2022 -0500
@@ -129,7 +129,7 @@
void irc_send(struct irc_conn *irc, const char *buf);
void irc_send_len(struct irc_conn *irc, const char *buf, int len);
-void irc_priority_send(struct irc_conn *irc, const char *buf);
+int irc_priority_send(struct irc_conn *irc, const char *buf);
gboolean irc_blist_timeout(struct irc_conn *irc);
gboolean irc_who_channel_timeout(struct irc_conn *irc);
void irc_buddy_query(struct irc_conn *irc);
--- a/libpurple/protocols/irc/msgs.c Wed Apr 27 23:41:06 2022 -0500
+++ b/libpurple/protocols/irc/msgs.c Wed Apr 27 23:44:53 2022 -0500
@@ -1579,7 +1579,7 @@
purple_debug_info("irc", "Using SASL: %s\n", irc->current_mech);
buf = irc_format(irc, "vv", "AUTHENTICATE", irc->current_mech);
- irc_send(irc, buf);
+ irc_priority_send(irc, buf);
g_free(buf);
}
@@ -1710,7 +1710,7 @@
authinfo = g_strdup("+");
buf = irc_format(irc, "vv", "AUTHENTICATE", authinfo);
- irc_send(irc, buf);
+ irc_priority_send(irc, buf);
g_free(buf);
g_free(authinfo);
g_free(serverin);
@@ -1733,7 +1733,7 @@
/* Finish auth session */
buf = irc_format(irc, "vv", "CAP", "END");
- irc_send(irc, buf);
+ irc_priority_send(irc, buf);
g_free(buf);
}
@@ -1812,7 +1812,7 @@
/* Auth failed, abort */
buf = irc_format(irc, "vv", "CAP", "END");
- irc_send(irc, buf);
+ irc_priority_send(irc, buf);
g_free(buf);
}
#endif
--- a/libpurple/protocols/irc/parse.c Wed Apr 27 23:41:06 2022 -0500
+++ b/libpurple/protocols/irc/parse.c Wed Apr 27 23:44:53 2022 -0500
@@ -645,7 +645,7 @@
break;
case ':':
g_string_append_c(string, ':');
- /* no break! */
+ /* fallthrough */
case 't':
case 'n':
case 'c':