summaryrefslogtreecommitdiff
path: root/src/misc.c
diff options
context:
space:
mode:
authorrburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864>2009-02-15 22:29:18 +0000
committerrburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864>2009-02-15 22:29:18 +0000
commitd1611b640bcd27e1a91a99ef32127bc722e50a36 (patch)
treeb18c77b07b74b70f5613b106aa2a81baa6227f35 /src/misc.c
parent0e5b71923b25d908167e7ef9d07c6c217827e901 (diff)
Remove User::na, use User::nc everywhere. Will probably break everything, but opens the door to decoupling NC from NA, and means commands can now be run without bothering about changinc nick :)
More tweaking for na/nc usage. It compiles, but it's still a work in progress. Again, this compiles, but I *bet* there's no chance in hell it'll work. :) Slightly better. Set User::nc correctly. Fix crash with unregistered nicks in core and ns_access. Fix glist to work when you're not on that particular nick. Fix ns_set to not crash and burn horribly. Fix ns_set and ns_logout to not do bad things. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2076 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/misc.c')
-rw-r--r--src/misc.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/misc.c b/src/misc.c
index 28f0009a1..51c6dac3e 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -365,13 +365,13 @@ int dotime(const char *s)
* @param seconds time in seconds
* @return buffer
*/
-char *duration(NickAlias * na, char *buf, int bufsize, time_t seconds)
+const char *duration(NickCore *nc, char *buf, int bufsize, time_t seconds)
{
int days = 0, hours = 0, minutes = 0;
int need_comma = 0;
char buf2[64], *end;
- const char *comma = getstring(na, COMMA_SPACE);
+ const char *comma = getstring(nc, COMMA_SPACE);
/* We first calculate everything */
days = seconds / 86400;
@@ -382,7 +382,7 @@ char *duration(NickAlias * na, char *buf, int bufsize, time_t seconds)
if (!days && !hours && !minutes) {
snprintf(buf, bufsize,
- getstring(na,
+ getstring(nc,
(seconds <=
1 ? DURATION_SECOND : DURATION_SECONDS)),
seconds);
@@ -390,7 +390,7 @@ char *duration(NickAlias * na, char *buf, int bufsize, time_t seconds)
end = buf;
if (days) {
snprintf(buf2, sizeof(buf2),
- getstring(na,
+ getstring(nc,
(days == 1 ? DURATION_DAY : DURATION_DAYS)),
days);
end += snprintf(end, bufsize - (end - buf), "%s", buf2);
@@ -398,7 +398,7 @@ char *duration(NickAlias * na, char *buf, int bufsize, time_t seconds)
}
if (hours) {
snprintf(buf2, sizeof(buf2),
- getstring(na,
+ getstring(nc,
(hours ==
1 ? DURATION_HOUR : DURATION_HOURS)),
hours);
@@ -409,7 +409,7 @@ char *duration(NickAlias * na, char *buf, int bufsize, time_t seconds)
}
if (minutes) {
snprintf(buf2, sizeof(buf2),
- getstring(na,
+ getstring(nc,
(minutes ==
1 ? DURATION_MINUTE : DURATION_MINUTES)),
minutes);
@@ -433,27 +433,27 @@ char *duration(NickAlias * na, char *buf, int bufsize, time_t seconds)
* @param seconds time in seconds
* @return buffer
*/
-char *expire_left(NickAlias * na, char *buf, int len, time_t expires)
+const char *expire_left(NickCore *nc, char *buf, int len, time_t expires)
{
time_t now = time(NULL);
if (!expires) {
- strncpy(buf, getstring(na, NO_EXPIRE), len);
+ strncpy(buf, getstring(nc, NO_EXPIRE), len);
} else if (expires <= now) {
- strncpy(buf, getstring(na, EXPIRES_SOON), len);
+ strncpy(buf, getstring(nc, EXPIRES_SOON), len);
} else {
time_t diff = expires - now + 59;
if (diff >= 86400) {
int days = diff / 86400;
snprintf(buf, len,
- getstring(na, (days == 1) ? EXPIRES_1D : EXPIRES_D),
+ getstring(nc, (days == 1) ? EXPIRES_1D : EXPIRES_D),
days);
} else {
if (diff <= 3600) {
int minutes = diff / 60;
snprintf(buf, len,
- getstring(na,
+ getstring(nc,
(minutes ==
1) ? EXPIRES_1M : EXPIRES_M), minutes);
} else {
@@ -461,7 +461,7 @@ char *expire_left(NickAlias * na, char *buf, int len, time_t expires)
diff -= (hours * 3600);
minutes = diff / 60;
snprintf(buf, len,
- getstring(na,
+ getstring(nc,
((hours == 1
&& minutes ==
1) ? EXPIRES_1H1M : ((hours == 1