|
@@ -60,7 +60,7 @@ static char *rtklhelp[] = {
|
|
|
// Dat dere module header
|
|
|
ModuleHeader MOD_HEADER(m_rtkl) = {
|
|
|
"m_rtkl", // Module name
|
|
|
- "$Id: v1.0 2017/07/24 Gottem$", // Version
|
|
|
+ "$Id: v1.01 2019/01/24 Gottem$", // Version
|
|
|
"Allows privileged opers to remove remote servers' local K/Z:Lines", // Description
|
|
|
"3.2-b8-1", // Modversion, not sure wat do
|
|
|
NULL
|
|
@@ -193,44 +193,44 @@ int hook_tkl_del(aClient *cptr, aClient *sptr, aTKline *tkl, int parc, char *par
|
|
|
int hook_tkl_main(aClient *cptr, aClient *sptr, aTKline *tkl, int parc, char *parv[], char flag) {
|
|
|
char *p, *nick; // To get just the nick bit from the full user!ident@host mask lol
|
|
|
aClient *acptr; // Pointer to the client using that nick
|
|
|
- if(sptr && !MyClient(sptr) && !BadPtr(parv[5]) && strchr("zk", *parv[2])) { // Only respond to non-local clients and _local_ K/Z:Lines ;];]
|
|
|
- nick = strdup(parv[5]);
|
|
|
- if(!(p = strrchr(nick, '!'))) // If for some reason the arg is malformed (expecting user!ident@host here), bail the fuck out
|
|
|
- return 0;
|
|
|
- *p = '\0';
|
|
|
- if(!(acptr = find_person(nick, NULL))) // Validate target nick
|
|
|
- return 0; // Lolnope
|
|
|
-
|
|
|
- char buf[BUFSIZE]; // Outbut buffer lol
|
|
|
- char *timeret; // Time buffer yo
|
|
|
+ if(sptr || MyClient(sptr) || parc < 6 || BadPtr(parv[5]) || !strchr("zk", *parv[2])) // Only respond to non-local clients and _local_ K/Z:Lines ;];]
|
|
|
+ return 0; // kbye
|
|
|
+ nick = strdup(parv[5]);
|
|
|
+ if(!(p = strrchr(nick, '!'))) // If for some reason the arg is malformed (expecting user!ident@host here), bail the fuck out
|
|
|
+ return 0;
|
|
|
+ *p = '\0';
|
|
|
+ if(!(acptr = find_person(nick, NULL))) // Validate target nick
|
|
|
+ return 0; // Lolnope
|
|
|
|
|
|
- memset(buf, '\0', BUFSIZE); // Just in caes lol
|
|
|
+ char buf[BUFSIZE]; // Outbut buffer lol
|
|
|
+ char *timeret; // Time buffer yo
|
|
|
|
|
|
- // Let's build that fucking message
|
|
|
- ircsnprintf(buf, BUFSIZE, "[m_rtkl] %s", (flag == '+' ? "Added" : "Removed")); // Let's start with the "direction"
|
|
|
+ memset(buf, '\0', BUFSIZE); // Just in caes lol
|
|
|
|
|
|
- // Check if the X:Line is permanent
|
|
|
- if(tkl->expire_at == 0)
|
|
|
- ircsnprintf(buf, BUFSIZE, "%s permanent", buf); // Append that shit
|
|
|
+ // Let's build that fucking message
|
|
|
+ ircsnprintf(buf, BUFSIZE, "[m_rtkl] %s", (flag == '+' ? "Added" : "Removed")); // Let's start with the "direction"
|
|
|
|
|
|
- // Always mention the X:Line type and the user@host mask
|
|
|
- ircsnprintf(buf, BUFSIZE, "%s (local) %c:Line for %s@%s", buf, toupper(*parv[2]), tkl->usermask, tkl->hostmask);
|
|
|
+ // Check if the X:Line is permanent
|
|
|
+ if(tkl->expire_at == 0)
|
|
|
+ ircsnprintf(buf, BUFSIZE, "%s permanent", buf); // Append that shit
|
|
|
|
|
|
- // If deleting only...
|
|
|
- if(flag == '-') {
|
|
|
- timeret = asctime(gmtime((TS *)&tkl->set_at)); // ...get original "set at" time as a char * ...
|
|
|
- ircsnprintf(buf, BUFSIZE, "%s set by %s at %s GMT", buf, tkl->setby, timeret); // ...as well as "setby", then append that shit
|
|
|
- }
|
|
|
+ // Always mention the X:Line type and the user@host mask
|
|
|
+ ircsnprintf(buf, BUFSIZE, "%s (local) %c:Line for %s@%s", buf, toupper(*parv[2]), tkl->usermask, tkl->hostmask);
|
|
|
|
|
|
- if(tkl->expire_at > 0) { // If the X:Line would've expired (deleting) or will expire at some point (adding) ...
|
|
|
- timeret = asctime(gmtime((TS *)&tkl->expire_at)); // ... get that shit too as a char * ...
|
|
|
- ircsnprintf(buf, BUFSIZE, "%s (to expire at %s GMT, reason: ", buf, timeret); // ...and append em w/o setby (is not necessary when adding)
|
|
|
- }
|
|
|
- else // Permanent X:Line, no need for expiration field
|
|
|
- ircsnprintf(buf, BUFSIZE, "%s (reason: ", buf); // Open parenthesis group thingy for da raisin
|
|
|
+ // If deleting only...
|
|
|
+ if(flag == '-') {
|
|
|
+ timeret = asctime(gmtime((TS *)&tkl->set_at)); // ...get original "set at" time as a char * ...
|
|
|
+ ircsnprintf(buf, BUFSIZE, "%s set by %s at %s GMT", buf, tkl->setby, timeret); // ...as well as "setby", then append that shit
|
|
|
+ }
|
|
|
|
|
|
- ircsnprintf(buf, BUFSIZE, "%s %s)", buf, tkl->reason); // Actual reason gets appended here lol, w/ closing parenthesis
|
|
|
- sendnotice(acptr, buf); // Send that fucking abomination
|
|
|
+ if(tkl->expire_at > 0) { // If the X:Line would've expired (deleting) or will expire at some point (adding) ...
|
|
|
+ timeret = asctime(gmtime((TS *)&tkl->expire_at)); // ... get that shit too as a char * ...
|
|
|
+ ircsnprintf(buf, BUFSIZE, "%s (to expire at %s GMT, reason: ", buf, timeret); // ...and append em w/o setby (is not necessary when adding)
|
|
|
}
|
|
|
+ else // Permanent X:Line, no need for expiration field
|
|
|
+ ircsnprintf(buf, BUFSIZE, "%s (reason: ", buf); // Open parenthesis group thingy for da raisin
|
|
|
+
|
|
|
+ ircsnprintf(buf, BUFSIZE, "%s %s)", buf, tkl->reason); // Actual reason gets appended here lol, w/ closing parenthesis
|
|
|
+ sendnotice(acptr, buf); // Send that fucking abomination
|
|
|
return 0; // Can't do shit anyways =]
|
|
|
}
|