aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2016-10-18 09:17:14 +0200
committerMarius Halden <marius.h@lden.org>2016-10-18 09:17:14 +0200
commit5f35d535f22aaf747956aafafd301442a07626a4 (patch)
tree93db10075a6308a7cc0aa11e2c820d3dd25996fc
parent0ecf67ec71df1c119308d6501e6fc54df3ba10d2 (diff)
parentc94e20896107533058d7eae53d5244b10edc97f6 (diff)
Merge branch 'master' into patched-master
-rw-r--r--irc_send.c16
-rw-r--r--protocols/oscar/conn.c28
2 files changed, 9 insertions, 35 deletions
diff --git a/irc_send.c b/irc_send.c
index fd85f1ee..d133c530 100644
--- a/irc_send.c
+++ b/irc_send.c
@@ -53,19 +53,18 @@ void irc_send_login(irc_t *irc)
void irc_send_motd(irc_t *irc)
{
- char motd[2048];
- ssize_t len;
- int fd;
+ char *motd;
+ size_t len;
- fd = open(global.conf->motdfile, O_RDONLY);
- if (fd == -1 || (len = read(fd, motd, sizeof(motd) - 1)) <= 0) {
+ g_file_get_contents(global.conf->motdfile, &motd, &len, NULL);
+
+ if (!motd || !len) {
irc_send_num(irc, 422, ":We don't need MOTDs.");
} else {
char linebuf[80];
char *add = "", max, *in;
in = motd;
- motd[len] = '\0';
linebuf[79] = len = 0;
max = sizeof(linebuf) - 1;
@@ -100,9 +99,8 @@ void irc_send_motd(irc_t *irc)
irc_send_num(irc, 376, ":End of MOTD");
}
- if (fd != -1) {
- close(fd);
- }
+ g_free(motd);
+
}
/* Used by some funcs that generate PRIVMSGs to figure out if we're talking to
diff --git a/protocols/oscar/conn.c b/protocols/oscar/conn.c
index ce29abce..3e84f1a4 100644
--- a/protocols/oscar/conn.c
+++ b/protocols/oscar/conn.c
@@ -382,9 +382,6 @@ aim_conn_t *aim_getconn_type_all(aim_session_t *sess, int type)
aim_conn_t *aim_newconn(aim_session_t *sess, int type, const char *dest)
{
aim_conn_t *connstruct;
- guint16 port = AIM_LOGIN_PORT;
- char *host;
- int i;
if (!(connstruct = aim_conn_getnext(sess))) {
return NULL;
@@ -399,29 +396,8 @@ aim_conn_t *aim_newconn(aim_session_t *sess, int type, const char *dest)
return connstruct;
}
- /*
- * As of 23 Jul 1999, AOL now sends the port number, preceded by a
- * colon, in the BOS redirect. This fatally breaks all previous
- * libfaims. Bad, bad AOL.
- *
- * We put this here to catch every case.
- *
- */
-
- for (i = 0; i < (int) strlen(dest); i++) {
- if (dest[i] == ':') {
- port = atoi(&(dest[i + 1]));
- break;
- }
- }
-
- host = (char *) g_malloc(i + 1);
- strncpy(host, dest, i);
- host[i] = '\0';
-
- connstruct->fd = proxy_connect(host, port, NULL, NULL);
-
- g_free(host);
+ /* The code that used to be here was very broken */
+ g_return_val_if_reached(connstruct);
return connstruct;
}