]>
jfr.im git - irc/quakenet/newserv.git/blob - chandump/chandump.c
4 #include "../core/schedule.h"
5 #include "../channel/channel.h"
6 #include "../lib/version.h"
12 void dodump(void *arg
) {
18 FILE *fp
= fopen("chandump/chandump.txt.1", "w");
22 fprintf(fp
, "M T %lld\n", (unsigned long long)time(NULL
));
24 for(i
=0;i
<CHANNELHASHSIZE
;i
++)
25 for(c
=chantable
[i
];c
;c
=c
->next
)
26 if(c
->channel
&& !IsSecret(c
->channel
))
27 fprintf(fp
, "C %s %d%s%s\n", c
->name
->content
, c
->channel
->users
->totalusers
, (c
->channel
->topic
&&c
->channel
->topic
->content
)?" ":"", (c
->channel
->topic
&&c
->channel
->topic
->content
)?c
->channel
->topic
->content
:"");
29 for(i
=0;i
<NICKHASHSIZE
;i
++)
30 for(n
=nicktable
[i
];n
;n
=n
->next
)
31 fprintf(fp
, "N %s %s %s %s %s\n", n
->nick
, n
->ident
, strchr(visibleuserhost(n
, buf
), '@') + 1, (IsAccount(n
) && n
->authname
) ? n
->authname
: "0", n
->realname
->name
->content
);
35 rename("chandump/chandump.txt.1", "chandump/chandump.txt");
39 dumpsched
= (void *)schedulerecurring(time(NULL
), 0, 60, &dodump
, NULL
);
43 deleteschedule(dumpsched
, &dodump
, NULL
);