#include <stdlib.h>
+#include <stdint.h>
#include <sys/time.h>
#include "../core/hooks.h"
#include "../lib/irc_string.h"
#include "jupe.h"
-jupe_t *jupes;
+jupe_t *jupes = NULL;
int handlejupe(void *source, int cargc, char **cargv);
void sendjupeburst(int hook, void *args);
void _init() {
- jupes = NULL;
-
registerhook(HOOK_IRC_SENDBURSTBURSTS, &sendjupeburst);
registerserverhandler("JU", &handlejupe, 5);
}
int handlejupe(void *source, int cargc, char **cargv) {
- char *target, *server, *expire, *modtime, *reason;
+ char *server, *expire, *modtime, *reason;
jupe_t *jupe;
unsigned int flags;
if (cargc < 5)
return CMD_OK; /* local jupe or not a valid.. we don't care */
- target = cargv[0];
server = cargv[1];
expire = cargv[2];
modtime = cargv[3];
}
jupe_t *make_jupe(char *server, char *reason, time_t expirets, time_t lastmod, unsigned int flags) {
- jupe_t *jupe, *last_jupe;
+ jupe_t *jupe;
jupe = (jupe_t*)malloc(sizeof(jupe_t));
jupe->ju_next = NULL;
/* add the jupe to our linked list */
- if (jupes == NULL)
- jupes = jupe;
- else {
- last_jupe = jupes;
-
- while (last_jupe->ju_next)
- last_jupe = last_jupe->ju_next;
-
- last_jupe->ju_next = jupe;
- }
+ jupe->ju_next = jupes;
+ jupes = jupe;
return jupe;
}
void jupe_propagate(jupe_t *jupe) {
- irc_send("%s JU * %c%s %d %d :%s", mynumeric->content,
+ irc_send("%s JU * %c%s %jd %jd :%s", mynumeric->content,
JupeIsRemActive(jupe) ? '+' : '-',
JupeServer(jupe),
- jupe->ju_expire - getnettime(),
- JupeLastMod(jupe),
+ (intmax_t)(jupe->ju_expire - getnettime()),
+ (intmax_t)JupeLastMod(jupe),
JupeReason(jupe));
}