*data->nserv->conn->account.pass ? data->nserv->conn->account.pass : "",
data->nserv->conn->account.host,
data->group);
*data->nserv->conn->account.pass ? data->nserv->conn->account.pass : "",
data->nserv->conn->account.host,
data->group);
snprintf (buf, sizeof (buf), "AUTHINFO PASS %s\r\n", conn->account.pass);
snprintf (buf, sizeof (buf), "AUTHINFO PASS %s\r\n", conn->account.pass);
if (mutt_socket_readln (buf, sizeof (buf), conn) < 0) {
conn->account.flags = flags;
return -1;
}
if (mutt_socket_readln (buf, sizeof (buf), conn) < 0) {
conn->account.flags = flags;
return -1;
}
if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
return nntp_connect_error (serv);
if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
return nntp_connect_error (serv);
- mutt_socket_close (conn);
- str_skip_trailws (buf);
- mutt_error ("%s", buf);
+ mutt_socket_close(conn);
+ m_strrtrim(buf);
+ mutt_error("%s", buf);
if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
return nntp_connect_error (serv);
if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
return nntp_connect_error (serv);
mutt_socket_write (conn, "XOVER\r\n");
if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
return nntp_connect_error (serv);
mutt_socket_write (conn, "XOVER\r\n");
if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
return nntp_connect_error (serv);
serv->hasXOVER = 1;
mutt_socket_write (conn, "XPAT\r\n");
if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
return nntp_connect_error (serv);
serv->hasXOVER = 1;
mutt_socket_write (conn, "XPAT\r\n");
if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
return nntp_connect_error (serv);
mutt_socket_write (conn, "LISTGROUP\r\n");
if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
return (nntp_connect_error (serv));
mutt_socket_write (conn, "LISTGROUP\r\n");
if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
return (nntp_connect_error (serv));
mutt_socket_write (conn, "XGTITLE +\r\n");
if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
return nntp_connect_error (serv);
mutt_socket_write (conn, "XGTITLE +\r\n");
if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
return nntp_connect_error (serv);
do {
if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
return nntp_connect_error (serv);
do {
if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
return nntp_connect_error (serv);
* -2 - invalid command or execution error,
* -3 - error in funct(*line, *data).
*/
* -2 - invalid command or execution error,
* -3 - error in funct(*line, *data).
*/
-static int mutt_nntp_fetch (NNTP_DATA * nntp_data, char *query, char *msg,
+static int mutt_nntp_fetch (NNTP_DATA * nntp_data, const char *query, char *msg,
progress_t* bar, int (*funct) (char *, void *),
void *data, int tagged)
{
progress_t* bar, int (*funct) (char *, void *),
void *data, int tagged)
{
- FOREVER {
- chunk = mutt_socket_readln_d (buf, sizeof (buf), nntp_data->nserv->conn,
- M_SOCK_LOG_HDR);
+ for (;;) {
+ chunk = mutt_socket_readln(buf, sizeof (buf), nntp_data->nserv->conn);
*colon = '\0';
colon++;
nntp_get_status (ctx, h, b, atoi (colon));
*colon = '\0';
colon++;
nntp_get_status (ctx, h, b, atoi (colon));
ret = mutt_nntp_fetch (nntp_data, buf, NULL, NULL, nntp_read_tempfile, f, 0);
if (ret) {
ret = mutt_nntp_fetch (nntp_data, buf, NULL, NULL, nntp_read_tempfile, f, 0);
if (ret) {
- str_cmp (d, data->desc)) {
- mem_free (&data->desc);
- data->desc = str_dup (d);
+ m_strcmp(d, data->desc)) {
+ p_delete(&data->desc);
+ data->desc = m_strdup(d);
-static void nntp_get_desc (NNTP_DATA * data, char *mask, char *msg, progress_t* bar)
+static void nntp_get_desc (NNTP_DATA * data, const char *mask, char *msg, progress_t* bar)
if (data->nserv->hasXGTITLE)
snprintf (buf, sizeof (buf), "XGTITLE %s\r\n", mask);
else
if (data->nserv->hasXGTITLE)
snprintf (buf, sizeof (buf), "XGTITLE %s\r\n", mask);
else
- snprintf (buf, sizeof (buf), "LIST NEWSGROUPS %s\r\n", mask);
+ snprintf (buf, sizeof (buf), "string_list_t NEWSGROUPS %s\r\n", mask);
if (mutt_nntp_fetch (data, buf, msg, bar, parse_description, data->nserv, 0) !=
0) {
if (mutt_nntp_fetch (data, buf, msg, bar, parse_description, data->nserv, 0) !=
0) {
- hdr->env = mutt_new_envelope ();
- hdr->env->newsgroups = str_dup (nntp_data->group);
- hdr->content = mutt_new_body ();
+ hdr->env = envelope_new();
+ hdr->env->newsgroups = m_strdup(nntp_data->group);
+ hdr->content = body_new();
hdr->content->encoding = ENC7BIT;
hdr->content->disposition = DISPINLINE;
hdr->content->length = -1;
hdr->content->encoding = ENC7BIT;
hdr->content->disposition = DISPINLINE;
hdr->content->length = -1;
nntp_get_status (ctx, hdr, NULL, hdr->article_num);
break;
case 1:
nntp_get_status (ctx, hdr, NULL, hdr->article_num);
break;
case 1:
hdr->env->from = rfc822_parse_adrlist (hdr->env->from, b);
/* same as for mutt_parse_rfc822_line():
* don't leave from info NULL if there's an invalid address (or
hdr->env->from = rfc822_parse_adrlist (hdr->env->from, b);
/* same as for mutt_parse_rfc822_line():
* don't leave from info NULL if there's an invalid address (or
nntp_parse_xref (ctx, nntp_data->group, b, hdr);
}
nntp_parse_xref (ctx, nntp_data->group, b, hdr);
}
static int _nntp_fetch_numbers (unsigned int num, void *c)
{
if (num < fc->base || num > fc->last)
static int _nntp_fetch_numbers (unsigned int num, void *c)
{
if (num < fc->base || num > fc->last)
ctx->hdrs[ctx->msgcount]->index = ctx->msgcount;
nntp_parse_xover (ctx, line, ctx->hdrs[ctx->msgcount]);
ctx->hdrs[ctx->msgcount]->index = ctx->msgcount;
nntp_parse_xover (ctx, line, ctx->hdrs[ctx->msgcount]);
mutt_message ("%s %d/%d", fc->msg, num, total);
}
else
mutt_message ("%s %d/%d", fc->msg, num, total);
}
else
if (nntp_data->nserv->hasLISTGROUP) {
snprintf (buf, sizeof (buf), "LISTGROUP %s\r\n", nntp_data->group);
if (mutt_nntp_fetch (nntp_data, buf, NULL, NULL, nntp_fetch_numbers, &fc, 0) !=
0) {
mutt_error (_("LISTGROUP command failed: %s"), buf);
sleep (2);
if (nntp_data->nserv->hasLISTGROUP) {
snprintf (buf, sizeof (buf), "LISTGROUP %s\r\n", nntp_data->group);
if (mutt_nntp_fetch (nntp_data, buf, NULL, NULL, nntp_fetch_numbers, &fc, 0) !=
0) {
mutt_error (_("LISTGROUP command failed: %s"), buf);
sleep (2);
mx_update_context (ctx, ctx->msgcount - oldmsgcount);
if (ret != 0) {
mutt_error (_("XOVER command failed: %s"), buf);
mx_update_context (ctx, ctx->msgcount - oldmsgcount);
if (ret != 0) {
mutt_error (_("XOVER command failed: %s"), buf);
h->index = ctx->msgcount;
ret = nntp_read_header (ctx, NULL, current);
h->index = ctx->msgcount;
ret = nntp_read_header (ctx, NULL, current);
- if (nntp_parse_url (ctx->path, &acct, buf, sizeof (buf)) < 0 || !*buf) {
+ if (nntp_parse_url (ctx->path, &act, buf, sizeof (buf)) < 0 || !*buf) {
/* create NNTP-specific state struct if nof found in list */
if ((nntp_data = (NNTP_DATA *) hash_find (serv->newsgroups, buf)) == NULL) {
/* create NNTP-specific state struct if nof found in list */
if ((nntp_data = (NNTP_DATA *) hash_find (serv->newsgroups, buf)) == NULL) {
nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA);
strcpy (nntp_data->group, buf);
hash_insert (serv->newsgroups, nntp_data->group, nntp_data, 0);
nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA);
strcpy (nntp_data->group, buf);
hash_insert (serv->newsgroups, nntp_data->group, nntp_data, 0);
- if (str_ncmp ("211", buf, 3)) {
- LIST *l = serv->list;
+ if (m_strncmp("211", buf, 3)) {
+ string_list_t *l = serv->list;
mutt_error (_("Newsgroup %s not found on server %s"),
nntp_data->group, serv->conn->account.host);
mutt_error (_("Newsgroup %s not found on server %s"),
nntp_data->group, serv->conn->account.host);
if (ret == 1) {
mutt_error (_("Article %d not found on server"),
ctx->hdrs[msgno]->article_num);
if (ret == 1) {
mutt_error (_("Article %d not found on server"),
ctx->hdrs[msgno]->article_num);
ctx->hdrs[msgno]->env =
mutt_read_rfc822_header (msg->fp, ctx->hdrs[msgno], 0, 0);
/* fix content length */
ctx->hdrs[msgno]->env =
mutt_read_rfc822_header (msg->fp, ctx->hdrs[msgno], 0, 0);
/* fix content length */
if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0) {
mutt_error (_("Can't post article. Connection to %s lost."),
nntp_data->nserv->conn->account.host);
if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0) {
mutt_error (_("Can't post article. Connection to %s lost."),
nntp_data->nserv->conn->account.host);
- if (buf[str_len (buf) - 1] != '\n')
- mutt_socket_write_d (nntp_data->nserv->conn, "\r\n", M_SOCK_LOG_HDR);
- mutt_socket_write_d (nntp_data->nserv->conn, ".\r\n", M_SOCK_LOG_HDR);
+ if (buf[m_strlen(buf) - 1] != '\n')
+ mutt_socket_write(nntp_data->nserv->conn, "\r\n");
+ mutt_socket_write(nntp_data->nserv->conn, ".\r\n");
if (mutt_socket_readln (buf, sizeof (buf), nntp_data->nserv->conn) < 0) {
mutt_error (_("Can't post article. Connection to %s lost."),
nntp_data->nserv->conn->account.host);
if (mutt_socket_readln (buf, sizeof (buf), nntp_data->nserv->conn) < 0) {
mutt_error (_("Can't post article. Connection to %s lost."),
nntp_data->nserv->conn->account.host);
for (i = 0; i < NNTP_CACHE_LEN; i++) {
if (data->acache[i].path) {
unlink (data->acache[i].path);
for (i = 0; i < NNTP_CACHE_LEN; i++) {
if (data->acache[i].path) {
unlink (data->acache[i].path);
- mem_free (&data->entries);
- mem_free (&data->desc);
- mem_free (&data->cache);
+ p_delete(&data->entries);
+ p_delete(&data->desc);
+ p_delete(&data->cache);
nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA);
strcpy (nntp_data->group, group);
nntp_data->nserv = s;
nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA);
strcpy (nntp_data->group, group);
nntp_data->nserv = s;
if (nntp_data->rc || nntp_data->lastCached)
mutt_newsgroup_stat (nntp_data);
else if (nntp_data->lastMessage &&
if (nntp_data->rc || nntp_data->lastCached)
mutt_newsgroup_stat (nntp_data);
else if (nntp_data->lastMessage &&
if (l->data && ((NNTP_DATA *) l->data)->subscribed)
_nntp_check_mailbox (NULL, (NNTP_DATA *) l->data);
}
if (l->data && ((NNTP_DATA *) l->data)->subscribed)
_nntp_check_mailbox (NULL, (NNTP_DATA *) l->data);
}
l = serv->tail;
if (mutt_nntp_fetch (&nntp_data, buf, _("Adding new newsgroups..."), NULL,
add_group, serv, 0) != 0) {
l = serv->tail;
if (mutt_nntp_fetch (&nntp_data, buf, _("Adding new newsgroups..."), NULL,
add_group, serv, 0) != 0) {
- if (mutt_nntp_fetch (&nntp_data, "LIST\r\n", msg, NULL, add_group, serv, 0) < 0) {
-#ifdef DEBUG
- nntp_error ("nntp_get_active()", "LIST\r\n");
-#endif
+ if (mutt_nntp_fetch (&nntp_data, "string_list_t\r\n", msg, NULL, add_group, serv, 0) < 0) {
mutt_message (msg);
nntp_get_desc (&nntp_data, "*", msg, NULL);
mutt_message (msg);
nntp_get_desc (&nntp_data, "*", msg, NULL);
ctx->hdrs[ctx->msgcount]->index = ctx->msgcount;
mutt_message (_("Fetching %s from server..."), msgid);
ctx->hdrs[ctx->msgcount]->index = ctx->msgcount;
mutt_message (_("Fetching %s from server..."), msgid);
/* since nntp_read_header() may set read flag, we must reset it */
ctx->hdrs[ctx->msgcount]->read = 0;
if (ret != 0)
/* since nntp_read_header() may set read flag, we must reset it */
ctx->hdrs[ctx->msgcount]->read = 0;
if (ret != 0)
if (mutt_nntp_fetch (nntp_data, buf, NULL, NULL, check_children, &cc, 0)) {
if (mutt_nntp_fetch (nntp_data, buf, NULL, NULL, check_children, &cc, 0)) {