1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-09 01:23:12 +02:00

+- Added protoctl SJB64, which adds B64-9 timestamps to many timestamping

+  operations
+- Added ircsprintf %B (base64-9^10) with ! as prefix, and %b (no prefix)
This commit is contained in:
stskeeps
2000-10-26 17:09:35 +00:00
parent 857b3c3a84
commit 71bdc5c08d
8 changed files with 101 additions and 13 deletions
+3
View File
@@ -647,3 +647,6 @@
numerics)
- Fixed SJOIN (mp2parv) bug, that caused insane desynchs
- Changed Cannot find server message to be to sendto_realops
- Fixed a warning in CENSOR_QUIT
- Fixed the G:Line user wrongly matching (ip-alike addys didnt check user)
- Added protoctl SJB64, which adds B64-9 timestamps to many timestamping
+11 -1
View File
@@ -246,7 +246,17 @@ extern struct SLink *find_user_link( /* struct SLink *, struct Client * */ );
"(ohv)@%+"
/* Server-Server PROTOCTL -Stskeeps */
#define PROTOCTL_SERVER "NOQUIT TOKEN NICKv2 SJOIN SJOIN2 UMODE2 VL SJ3 NS" ZIPSTUFF
#define PROTOCTL_SERVER "NOQUIT" \
" TOKEN" \
" NICKv2" \
" SJOIN" \
" SJOIN2" \
" UMODE2" \
" VL" \
" SJ3" \
" NS" \
" SJB64" \
ZIPSTUFF
#ifdef _WIN32
/*
+1
View File
@@ -286,6 +286,7 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */
#define PROTO_SJ3 0x200 /* Negotiated SJ3 protocol */
#define PROTO_VHP 0x400 /* Send hostnames in NICKv2 even if not
sethosted */
#define PROTO_SJB64 0x800
/*
* flags macros.
*/
+21
View File
@@ -63,6 +63,13 @@ char *base64enc(unsigned long i)
return int_to_base64(i);
}
char *xbase64enc(unsigned long i)
{
if (i > 1000)
i = i - 900000000;
return int_to_base64(i);
}
unsigned long base64dec(char *b64)
{
if (b64)
@@ -71,6 +78,20 @@ unsigned long base64dec(char *b64)
return 0;
}
unsigned long xbase64dec(char *b64)
{
unsigned long r;
if (b64)
{
r = base64_to_int(b64);
if (r > 1000)
r = r - 900000000;
return r;
}
else
return 0;
}
int numeric_collides(unsigned long numeric)
{
Link *lp;
+13 -8
View File
@@ -3422,8 +3422,8 @@ int m_topic(cptr, sptr, parc, parv)
{
if (!MyClient(sptr) && !IsULine(cptr, sptr))
{
sendto_realops
("Remote TOPIC for unknown channel %s (%s)",
sendto_umode
(UMODE_JUNK,"Remote TOPIC for unknown channel %s (%s)",
parv[1], backupbuf);
}
sendto_one(sptr, rpl_str(ERR_NOSUCHCHANNEL),
@@ -3444,7 +3444,7 @@ int m_topic(cptr, sptr, parc, parv)
if (parc > 4)
{
tnick = parv[2];
ttime = atol(parv[3]);
ttime = (*parv[3] == '!' ? xbase64dec(parv[3] + 1) : atol(parv[3]));
topic = parv[4];
}
@@ -4523,8 +4523,10 @@ int m_sjoin(cptr, sptr, parc, parv)
}
chptr = get_channel(cptr, parv[2], CREATE);
ts = atol(parv[1]);
if (*parv[1] != '!')
ts = atol(parv[1]);
else
ts = xbase64dec(parv[1] + 1);
if (chptr->creationtime > ts)
{
removeours = 1;
@@ -5366,20 +5368,23 @@ void send_channel_modes_sjoin3(cptr, chptr)
if (nomode && nopara)
{
ircsprintf(buf, "%s %ld %s :",
ircsprintf(buf,
(cptr->proto & PROTO_SJB64 ? "%s %B %s :" : "%s %ld %s :"),
(IsToken(cptr) ? TOK_SJOIN : MSG_SJOIN),
chptr->creationtime, chptr->chname);
}
if (nopara && !nomode)
{
ircsprintf(buf, "%s %ld %s %s :",
ircsprintf(buf,
(cptr->proto & PROTO_SJB64 ? "%s %B %s %s :" : "%s %ld %s %s :"),
(IsToken(cptr) ? TOK_SJOIN : MSG_SJOIN),
chptr->creationtime, chptr->chname, modebuf);
}
if (!nopara && !nomode)
{
ircsprintf(buf, "%s %ld %s %s %s :",
ircsprintf(buf,
(cptr->proto & PROTO_SJB64 ? "%s %B %s %s %s :" : "%s %ld %s %s %s :"),
(IsToken(cptr) ? TOK_SJOIN : MSG_SJOIN),
chptr->creationtime, chptr->chname, modebuf, parabuf);
}
+23
View File
@@ -290,6 +290,7 @@ char *ircvsprintf(char *str, const char *format, va_list vl)
while ((*++str = *++p1));
continue;
}
if (c == 'l' && *format == 'u') /* Prints time_t value in interval
[ 100000000 , 4294967295 ]
Actually prints like "%09lu" */
@@ -364,6 +365,28 @@ char *ircvsprintf(char *str, const char *format, va_list vl)
continue;
}
#endif
/* Send base64 value */
if (c == 'b')
{
unsigned long v1;
char *ap;
v1 = va_arg(vl, unsigned long);
for (ap = (char *) xbase64enc(v1); *ap; ap++)
*str++ = *ap;
continue;
}
if (c == 'B')
{
unsigned long v1;
char *ap;
v1 = va_arg(vl, unsigned long);
*str++ = '!';
for (ap = (char *) xbase64enc(v1); *ap; ap++)
*str++ = *ap;
continue;
}
if (c == 'd')
{
unsigned int v1, v2;
+25 -3
View File
@@ -544,6 +544,20 @@ int m_protoctl(cptr, sptr, parc, parv)
proto, cptr->name));
SetSJ3(cptr);
}
else if (strcmp(s, "SJB64") == 0)
{
#ifndef PROTOCTL_MADNESS
if (remove)
{
cptr->proto &=~ PROTO_SJB64;
continue;
}
#endif
Debug((DEBUG_ERROR,
"Chose protocol %s for link %s",
proto, cptr->name));
cptr->proto |= PROTO_SJB64;
}
/*
* Add other protocol extensions here, with proto
* containing the base option, and options containing
@@ -1305,7 +1319,8 @@ int m_server_estab(cptr)
if (!SupportNICKv2(cptr))
{
sendto_one(cptr, "%s %s %d %d %s %s %s %lu :%s",
sendto_one(cptr,
"%s %s %d %d %s %s %s %lu :%s",
(IsToken(cptr) ? TOK_NICK : MSG_NICK),
acptr->name, acptr->hopcount + 1,
acptr->lastnick, acptr->user->username,
@@ -1328,7 +1343,10 @@ int m_server_estab(cptr)
send_umode(NULL, acptr, 0, SEND_UMODES, buf);
if (!SupportVHP(cptr))
sendto_one(cptr,
"%s %s %d %d %s %s %s %lu %s %s :%s",
(cptr->proto & PROTO_SJB64 ?
"%s %s %d %B %s %s %s %lu %s %s :%s"
:
"%s %s %d %d %s %s %s %lu %s %s :%s"),
(IsToken(cptr) ? TOK_NICK :
MSG_NICK), acptr->name,
acptr->hopcount + 1,
@@ -1396,7 +1414,11 @@ int m_server_estab(cptr)
else
send_channel_modes_sjoin3(cptr, chptr);
if (chptr->topic_time)
sendto_one(cptr, "%s %s %s %lu :%s",
sendto_one(cptr,
(cptr->proto & PROTO_SJB64 ?
"%s %s %s %B :%s"
:
"%s %s %s %lu :%s"),
(IsToken(cptr) ? TOK_TOPIC : MSG_TOPIC),
chptr->chname, chptr->topic_nick,
chptr->topic_time, chptr->topic);
+4 -1
View File
@@ -1358,7 +1358,10 @@ int m_nick(cptr, sptr, parc, parv)
*/
if (parc > 3)
{
lastnick = atoi(parv[3]);
if (*parv[3] != '!')
lastnick = atoi(parv[3]);
else
lastnick = xbase64dec(parv[3] + 1);
if (parc > 5)
differ = (mycmp(acptr->user->username, parv[4])
|| mycmp(acptr->user->realhost, parv[5]));