summaryrefslogtreecommitdiff
path: root/src/plugins/irc/irc-server.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-11-04 12:47:01 +0100
committerSebastien Helleu <flashcode@flashtux.org>2011-11-04 12:47:01 +0100
commit8503857d28a41e42e0d232a508b1534827c7e737 (patch)
tree0eb9030ef40b146214b5c991609d7244c5c9a6dc /src/plugins/irc/irc-server.c
parentabd95bf1b189c571a618bb0331deb4e6772b1d03 (diff)
downloadweechat-8503857d28a41e42e0d232a508b1534827c7e737.zip
irc: allow URL "irc://" in command /connect
Diffstat (limited to 'src/plugins/irc/irc-server.c')
-rw-r--r--src/plugins/irc/irc-server.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index eb76285e5..6f5c84055 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -705,11 +705,10 @@ irc_server_alloc (const char *name)
/*
* irc_server_alloc_with_url: init a server with url of this form:
* irc://nick:pass@irc.toto.org:6667
- * returns: 1 = ok
- * 0 = error
+ * return server pointer, or NULL if error
*/
-int
+struct t_irc_server *
irc_server_alloc_with_url (const char *irc_url)
{
char *irc_url2, *pos_server, *pos_nick, *pos_password;
@@ -720,7 +719,7 @@ irc_server_alloc_with_url (const char *irc_url)
irc_url2 = strdup (irc_url);
if (!irc_url2)
- return 0;
+ return NULL;
pos_server = NULL;
pos_nick = NULL;
@@ -733,10 +732,10 @@ irc_server_alloc_with_url (const char *irc_url)
ssl = 0;
pos_server = strstr (irc_url2, "://");
- if (!pos_server)
+ if (!pos_server || !pos_server[3])
{
free (irc_url2);
- return 0;
+ return NULL;
}
pos_server[0] = '\0';
pos_server += 3;
@@ -796,7 +795,7 @@ irc_server_alloc_with_url (const char *irc_url)
if (!pos)
{
free (irc_url2);
- return 0;
+ return NULL;
}
pos[0] = '\0';
pos++;
@@ -900,7 +899,7 @@ irc_server_alloc_with_url (const char *irc_url)
free (irc_url2);
- return (ptr_server) ? 1 : 0;
+ return ptr_server;
}
/*