Browse Source

m_chansno: Changed formatting of jesopo's contrib00tions to match mein cuz triggered kek

Wazakindjes 3 years ago
parent
commit
03a43ffc58
1 changed files with 16 additions and 33 deletions
  1. 16 33
      u4/m_chansno.c

+ 16 - 33
u4/m_chansno.c

@@ -59,7 +59,7 @@ extern OperFlag *config_binary_flags_search(OperFlag *table, char *cmd, int size
 #define CHSNO_SPAMFILTER 0x4000
 #define CHSNO_TKL_ADD 0x8000
 
-/* This MUST be alphabetized */
+// This MUST be alphabetised
 OperFlag _ChanSnoFlags[] = {
 	{ CHSNO_CHANNEL_CREATE,  "channel-creations" },
 	{ CHSNO_CHANNEL_DESTROY, "channel-destructions" },
@@ -548,7 +548,7 @@ int chansno_hook_channeldestroy(aChannel *chptr, int *should_destroy) {
 }
 
 int chansno_hook_spamfilter(aClient *acptr, char *str, char *str_in, int type, char *target, aTKline *tkl) {
-	ircsnprintf(msgbuf, BUFSIZE, "[Spamfilter] %s!%s@%s matches filter '%s': [%s%s: '%s'] [%s]",
+	snprintf(msgbuf, BUFSIZE, "[Spamfilter] %s!%s@%s matches filter '%s': [%s%s: '%s'] [%s]",
 		acptr->name, acptr->user->username, acptr->user->realhost, tkl->reason, cmdname_by_spamftarget(type),
 		target, str_in, unreal_decodespace(tkl->ptr.spamf->tkl_reason));
 	SendNotice_simple(CHSNO_SPAMFILTER, 0);
@@ -592,12 +592,9 @@ int chansno_hook_tkladd(aClient *cptr, aClient *sptr, aTKline *tkl, int parc, ch
 
 	setter = find_client(name, NULL);
 	if(setter == NULL || (!IsMe(setter) && !MyClient(setter)))
-	{
-		 return HOOK_CONTINUE;
-	}
+		return HOOK_CONTINUE;
 
-	switch (tkl->type)
-	{
+	switch(tkl->type) {
 		case TKL_KILL:
 			strlcpy(txt, "K:Line", sizeof(txt));
 			break;
@@ -621,6 +618,7 @@ int chansno_hook_tkladd(aClient *cptr, aClient *sptr, aTKline *tkl, int parc, ch
 			break;
 		default:
 			strlcpy(txt, "Unknown *:Line", sizeof(txt));
+			break;
 	}
 
 	timeret = asctime(gmtime((TS *)&tkl->set_at));
@@ -632,36 +630,21 @@ int chansno_hook_tkladd(aClient *cptr, aClient *sptr, aTKline *tkl, int parc, ch
 	iCstrip(set_at);
 	iCstrip(expire_at);
 
-	if (tkl->expire_at != 0)
-	{
-		if (tkl->type & TKL_NICK)
-		{
-			if (*tkl->usermask != 'H')
-			{
-				snprintf(msgbuf, BUFSIZE, "%s added for %s on %s GMT (from %s to expire at %s GMT: %s)",
-					txt, tkl->hostmask, set_at, tkl->setby, expire_at, tkl->reason);
-			}
+	if(tkl->expire_at != 0) {
+		if(tkl->type & TKL_NICK) {
+			if(*tkl->usermask != 'H')
+				snprintf(msgbuf, BUFSIZE, "%s added for %s on %s GMT (from %s to expire at %s GMT: %s)", txt, tkl->hostmask, set_at, tkl->setby, expire_at, tkl->reason);
 		}
 		else
-		{
-			snprintf(msgbuf, BUFSIZE, "%s added for %s@%s on %s GMT (from %s to expire at %s GMT: %s)",
-				txt, tkl->usermask, tkl->hostmask, set_at, tkl->setby, expire_at, tkl->reason);
-		}
+			snprintf(msgbuf, BUFSIZE, "%s added for %s@%s on %s GMT (from %s to expire at %s GMT: %s)", txt, tkl->usermask, tkl->hostmask, set_at, tkl->setby, expire_at, tkl->reason);
 	}
-	else
-	{
-		if (tkl->type & TKL_NICK)
-		{
-			if (*tkl->usermask != 'H')
-			{
-				snprintf(msgbuf, BUFSIZE, "Permanent %s added for %s on %s GMT (from %s: %s)",
-					txt, tkl->hostmask, set_at, tkl->setby, tkl->reason);
-			}
-		}
-		else {
-			snprintf(msgbuf, BUFSIZE, "Permanent %s added for %s on %s GMT (from %s: %s)",
-				txt, tkl->usermask, tkl->hostmask, set_at, tkl->setby, tkl->reason);
+	else {
+		if(tkl->type & TKL_NICK) {
+			if(*tkl->usermask != 'H')
+				snprintf(msgbuf, BUFSIZE, "Permanent %s added for %s on %s GMT (from %s: %s)", txt, tkl->hostmask, set_at, tkl->setby, tkl->reason);
 		}
+		else
+			snprintf(msgbuf, BUFSIZE, "Permanent %s added for %s on %s GMT (from %s: %s)", txt, tkl->usermask, tkl->hostmask, set_at, tkl->setby, tkl->reason);
 	}
 
 	SendNotice_simple(CHSNO_TKL_ADD, 0);