#include "sort.h"
#include "mx.h"
#include "mime.h"
-#include "mailbox.h"
#include "nntp.h"
#include "rfc822.h"
#include "rfc1524.h"
#include "lib/mem.h"
#include "lib/str.h"
#include "lib/intl.h"
+#include "lib/debug.h"
#include <unistd.h>
#include <string.h>
strfcpy (group, line, len);
if ((data = (NNTP_DATA *) hash_find (news->newsgroups, group)) == NULL) {
data =
- (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + safe_strlen (group) + 1);
+ (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + str_len (group) + 1);
data->group = (char *) data + sizeof (NNTP_DATA);
strcpy (data->group, group);
data->nserv = news;
data->lastMessage = data->entries[x - 1].last;
data->num = x;
mutt_newsgroup_stat (data);
- dprint (2, (debugfile, "parse_line: Newsgroup %s\n", data->group));
+ debug_print (2, ("Newsgroup %s\n", data->group));
return 0;
}
return 0;
rewind (index);
while (fgets (buf, sizeof (buf), index)) {
- buf[safe_strlen (buf) - 1] = 0; /* strip ending '\n' */
- if (!safe_strncmp (buf, "#: ", 3) &&
- !safe_strcasecmp (buf + 3, news->conn->account.host))
+ buf[str_len (buf) - 1] = 0; /* strip ending '\n' */
+ if (!str_ncmp (buf, "#: ", 3) &&
+ !str_casecmp (buf + 3, news->conn->account.host))
break;
}
while (fgets (buf, sizeof (buf), index)) {
if (!*cp)
continue;
cp[0] = 0;
- if (!safe_strcmp (buf, "#:"))
+ if (!str_cmp (buf, "#:"))
break;
sscanf (cp + 1, "%s %d %d", file, &l, &m);
- if (!safe_strcmp (buf, "ALL")) {
- news->cache = safe_strdup (file);
+ if (!str_cmp (buf, "ALL")) {
+ news->cache = str_dup (file);
news->newgroups_time = m;
}
else if (news->newsgroups) {
if ((data = (NNTP_DATA *) hash_find (news->newsgroups, buf)) == NULL) {
data =
(NNTP_DATA *) safe_calloc (1,
- sizeof (NNTP_DATA) + safe_strlen (buf) + 1);
+ sizeof (NNTP_DATA) + str_len (buf) + 1);
data->group = (char *) data + sizeof (NNTP_DATA);
strcpy (data->group, buf);
data->nserv = news;
hash_insert (news->newsgroups, data->group, data, 0);
nntp_add_to_list (news, data);
}
- data->cache = safe_strdup (file);
+ data->cache = str_dup (file);
t = 0;
if (!data->firstMessage || data->lastMessage < m)
t = 1;
acct->port = NNTP_PORT;
acct->type = M_ACCT_TYPE_NNTP;
- c = safe_strdup (server);
+ c = str_dup (server);
url_parse_ciss (&url, c);
if (url.scheme == U_NNTP || url.scheme == U_NNTPS) {
{
ciss_url_t url;
- url.path = safe_strdup (line);
+ url.path = str_dup (line);
mutt_account_tourl (acct, &url);
url_ciss_tostring (&url, line, len, 0);
FREE (&url.path);
return NULL;
}
- buf = p = safe_calloc (safe_strlen (server) + 10, sizeof (char));
+ buf = p = safe_calloc (str_len (server) + 10, sizeof (char));
if (url_check_scheme (server) == U_UNKNOWN) {
strcpy (buf, "nntp://");
p = strchr (buf, '\0');
/* New newsserver */
serv = safe_calloc (1, sizeof (NNTP_SERVER));
serv->conn = conn;
- serv->newsrc = safe_strdup (file);
+ serv->newsrc = str_dup (file);
serv->newsgroups = hash_create (1009);
slurp_newsrc (serv); /* load .newsrc */
nntp_parse_cacheindex (serv); /* load .index */
if (!data) {
#ifdef DEBUG
if (group)
- dprint (3, (debugfile, "newsgroup %s not found\n", group));
+ debug_print (3, ("newsgroup %s not found\n", group));
#endif
return;
}
line = *buf + (*pline - line);
}
strcpy (line, data->group);
- len -= safe_strlen (line) + 1;
- line += safe_strlen (line);
+ len -= str_len (line) + 1;
+ line += str_len (line);
*line++ = data->subscribed ? ':' : '!';
*line++ = ' ';
*line = '\0';
if (!data || !data->rc)
continue;
nntp_create_newsrc_line (data, &buf, &line, &llen);
- dprint (2, (debugfile, "Added to newsrc: %s", line));
- line += safe_strlen (line);
+ debug_print (2, ("Added to newsrc: %s\n", line));
+ line += str_len (line);
}
/* newrc being fully rewritten */
if (news->newsrc &&
return fp;
nntp_cache_expand (buf, "cache-XXXXXX");
- pc = buf + safe_strlen (buf) - 12; /* positioning to "cache-XXXXXX" */
+ pc = buf + str_len (buf) - 12; /* positioning to "cache-XXXXXX" */
if ((fd = mkstemp (buf)) == -1)
return NULL;
strcpy (s, pc); /* generated name */
if (!data || data->subscribed || !data->cache)
continue;
nntp_delete_cache (data);
- dprint (2, (debugfile, "Removed from .index: %s\n", data->group));
+ debug_print (2, ("Removed from .index: %s\n", data->group));
}
return;
}
else {
strfcpy (buf, news->conn->account.host, sizeof (buf));
f = mutt_mkname (buf);
- news->cache = safe_strdup (buf);
+ news->cache = str_dup (buf);
nntp_cache_expand (file, buf);
}
if (!f)
((NNTP_DATA *) ctx->data)->nserv->conn->account.host,
((NNTP_DATA *) ctx->data)->group);
f = mutt_mkname (buf);
- ((NNTP_DATA *) ctx->data)->cache = safe_strdup (buf);
+ ((NNTP_DATA *) ctx->data)->cache = str_dup (buf);
nntp_cache_expand (file, buf);
}
if (!f)
return NULL;
if (!(data = (NNTP_DATA *) hash_find (news->newsgroups, group))) {
data =
- (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + safe_strlen (group) + 1);
+ (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + str_len (group) + 1);
data->group = (char *) data + sizeof (NNTP_DATA);
strcpy (data->group, group);
data->nserv = news;
if (data && data->subscribed && data->unread) {
if (Context && Context->magic == M_NNTP &&
- !safe_strcmp (data->group, ((NNTP_DATA *) Context->data)->group)) {
+ !str_cmp (data->group, ((NNTP_DATA *) Context->data)->group)) {
unsigned int i, unread = 0;
for (i = 0; i < Context->msgcount; i++)