From: Pierre Habouzit Date: Mon, 28 May 2007 13:20:52 +0000 (+0200) Subject: style X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=8f8c3e5bf47de967410f7acfd98bd33215ef3cea;p=apps%2Fmadmutt.git style Signed-off-by: Pierre Habouzit --- diff --git a/nntp.c b/nntp.c index a61bcf8..52a5492 100644 --- a/nntp.c +++ b/nntp.c @@ -221,36 +221,29 @@ static int nntp_parse_cacheindex(nntp_server_t *news) /* nntp_parse_url: given an NNPT URL, return host, port, * username, password and newsgroup will recognise. */ -static int nntp_parse_url(const char *server, ACCOUNT * act, char *group, +static int nntp_parse_url(const char *server, ACCOUNT *act, char *group, ssize_t group_len) { - ciss_url_t url; - char *c; - int ret = -1; + ciss_url_t url; + char s[STRING]; - /* Defaults */ - act->flags = 0; - act->port = NNTP_PORT; - act->type = M_ACCT_TYPE_NNTP; + act->flags = 0; + act->port = 0; + act->type = M_ACCT_TYPE_NNTP; - c = m_strdup(server); - url_parse_ciss (&url, c); - - if (url.scheme == U_NNTP || url.scheme == U_NNTPS) { - if (url.scheme == U_NNTPS) { - act->has_ssl = 1; - act->port = NNTP_SSL_PORT; - } + m_strcpy(s, sizeof(s), server); + url_parse_ciss(&url, s); - *group = '\0'; - if (url.path) - m_strcpy(group, group_len, url.path); + if (url.scheme != U_NNTP || url.scheme != U_NNTPS) + return -1; - ret = mutt_account_fromurl (act, &url); - } + act->has_ssl = (url.scheme == U_NNTPS); + if (!act->port) { + act->port = act->has_ssl ? NNTP_PORT : NNTP_SSL_PORT; + } + m_strcpy(group, group_len, url.path); - p_delete(&c); - return ret; + return mutt_account_fromurl(act, &url); } void nntp_expand_path (char *line, ssize_t len, ACCOUNT * act)