Skip to content

Commit

Permalink
completed the notifications, this now completes the rewrite of gseen.…
Browse files Browse the repository at this point in the history
…mod, i will be testing this for the next few weeks.
  • Loading branch information
loco committed May 7, 2024
1 parent d67fed9 commit 23cd057
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
26 changes: 19 additions & 7 deletions do_seen.c
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,10 @@ static void report_seenreq(char *channel, char *nick)
seenreq *l, *ll;
seenreq_by *b, *bb;
char *reply, *tmp;
char tmp2[20];
int nr;
time_t tt;
char t[20];

if (!tell_seens)
return;
Expand All @@ -775,24 +778,33 @@ static void report_seenreq(char *channel, char *nick)
nr = count_seenreq(l->by);
if (nr == 1) {
glob_seenrequest = l;
dprintf(DP_HELP, "NOTICE %s :%s\n", l->nick, SLONELOOK);
char slonelookout[200];
tt = glob_seenrequest->by->when;
strftime(t, sizeof(t), "%d.%m.%Y %H:%M", localtime(&tt));
sprintf(slonelookout, SLONELOOK, glob_seenrequest->by->who, glob_seenrequest->by->host, glob_seenrequest->by->chan, gseen_duration(now - glob_seenrequest->by->when), t);
dprintf(DP_HELP, "NOTICE %s :%s\n", l->nick, slonelookout);
} else {
sortrequests(l);
glob_seenrequest = l;
glob_seenrequests = nr;
tmp = SLMORELOOKS;
tt = glob_seenrequest->by->when;
strftime(t, sizeof(t), "%d.%m.%Y %H:%M", localtime(&tt));
tmp = "";
snprintf(tmp2, sizeof(tmp2), "%d", glob_seenrequests);
sprintf(tmp, SLMORELOOKS, tmp2);
reply = nmalloc(strlen(tmp) + 1);
strcpy(reply, tmp);
nr = 0;
strcpy(reply, tmp);
nr = 0;
for (b = l->by; b; b = b->next) {
nr++;
reply = nrealloc(reply, strlen(reply) + ((nr == 1) ? 1 : 2) + strlen(b->who) + 1);
sprintf(reply, "%s%s%s", reply, (nr == 1) ? " " : ", ", b->who);
}
tmp = SLLASTLOOK;
}
tmp = "";
sprintf(tmp, SLLASTLOOK, glob_seenrequest->by->who, glob_seenrequest->by->host, glob_seenrequest->by->chan, gseen_duration(now - glob_seenrequest->by->when), t);
reply = nrealloc(reply, strlen(reply) + 2 + strlen(tmp) + 1);
sprintf(reply, "%s. %s", reply, tmp);
dprintf(DP_HELP, "NOTICE %s :%s\n", l->nick, reply);
dprintf(DP_HELP, "NOTICE %s :%s\n", l->nick, reply);
nfree(reply);
}
b = l->by;
Expand Down
6 changes: 3 additions & 3 deletions language/gseen.english.lang
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@
#
## seen notification
#
0xc170,<?rnick/?> (<?rhost/?>) was looking for you on <?rchan/?> <?rwhen/?> ago (<?rtime/?>).
0xc171,There have been <?requests/?> users looking for you:
0xc172,The last one was <?rnick/?> (<?rhost/?>) on <?rchan/?> <?rwhen/?> ago (<?rtime/?>).
0xc170,%s (%s) was looking for you on %s %s ago (%s).
0xc171,There have been %s users looking for you:
0xc172,The last one was %s (%s) on %s %s ago (%s).

#
## seen stats
Expand Down

0 comments on commit 23cd057

Please sign in to comment.