Browse Source

m_message_commonchans/pmdelay/textshun: PRE*MSG hewk functions should probs check for MyConnect xd

Wazakindjes 1 month ago
parent
commit
6685ca4e9a
3 changed files with 14 additions and 10 deletions
  1. 2 2
      u4/m_message_commonchans.c
  2. 8 7
      u4/m_pmdelay.c
  3. 4 1
      uncommon/m_textshun.c

+ 2 - 2
u4/m_message_commonchans.c

@@ -28,7 +28,7 @@ long commchans_extumode = 0; // Store bitwise value latur
 // Dat dere module header
 ModuleHeader MOD_HEADER(m_message_commonchans) = {
 	"m_message_commonchans", // Module name
-	"$Id: v1.03 2018/12/01 Gottem$", // Version
+	"$Id: v1.04 2018/12/22 Gottem$", // Version
 	"Adds umode +c to prevent people who aren't in a common channel with you from messaging you", // Description
 	"3.2-b8-1", // Modversion, not sure wat do
 	NULL
@@ -64,7 +64,7 @@ MOD_UNLOAD(m_message_commonchans) {
 
 // Actual hewk function m8
 char *commchans_hook_pre_usermsg(aClient *sptr, aClient *to, char *text, int notice) {
-	if(!sptr || !to || sptr == to || IsULine(sptr) || IsULine(to) || IsOper(sptr) || !IsPerson(sptr) || !IsPerson(to) || !(to->umodes & commchans_extumode) || has_common_channels(sptr, to))
+	if(!MyConnect(sptr) || sptr == to || IsULine(sptr) || IsULine(to) || IsOper(sptr) || !IsPerson(sptr) || !IsPerson(to) || !(to->umodes & commchans_extumode) || has_common_channels(sptr, to))
 		return text;
 
 	sendnotice(sptr, "*** You need to be on a common channel with %s to privately message them", to->name);

+ 8 - 7
u4/m_pmdelay.c

@@ -24,7 +24,7 @@ int muhDelay = 60; // Default to 1 minute yo
 // Dat dere module header
 ModuleHeader MOD_HEADER(m_pmdelay) = {
 	"m_pmdelay", // Module name
-	"$Id: v1.0 2017/03/15 Gottem$", // Version
+	"$Id: v1.01 2018/12/22 Gottem$", // Version
 	"Disallow new clients trying to send private messages until exceeding a certain timeout", // Description
 	"3.2-b8-1", // Modversion, not sure wat do
 	NULL
@@ -77,12 +77,13 @@ char *pmdelay_hook_preusermsg(aClient *sptr, aClient *to, char *text, int notice
 	** notice: Should be obvious ;];]
 	*/
 	// Let's allow opers/servers/U:Lines to always send, also from anyone TO U:Lines (muh /ns identify lol)
-	if(!IsServer(sptr) && !IsMe(sptr) && !IsOper(sptr) && !IsULine(sptr) && !IsULine(to)) {
-		// Sanity check + delay check =]
-		if(sptr->local && TStime() - sptr->local->firsttime < muhDelay) {
-			sendnotice(sptr, "You have to be connected for at least %d seconds before sending private messages", muhDelay);
-			return NULL;
-		}
+	if(!MyConnect(sptr) || sptr == to || IsULine(sptr) || IsULine(to) || IsOper(sptr) || !IsPerson(sptr) || !IsPerson(to))
+		return text;
+
+	// Sanity check + delay check =]
+	if(sptr->local && TStime() - sptr->local->firsttime < muhDelay) {
+		sendnotice(sptr, "You have to be connected for at least %d seconds before sending private messages", muhDelay);
+		return NULL;
 	}
 	return text;
 }

+ 4 - 1
uncommon/m_textshun.c

@@ -97,7 +97,7 @@ static char *muhhalp[] = {
 // Dat dere module header
 ModuleHeader MOD_HEADER(m_textshun) = {
 	"m_textshun", // Module name
-	"$Id: v1.05 2018/04/16 Gottem$", // Version
+	"$Id: v1.06 2018/12/22 Gottem$", // Version
 	"Drop messages based on nick and body", // Description
 	"3.2-b8-1", // Modversion, not sure wat do
 	NULL
@@ -364,6 +364,9 @@ char *_check_premsg(aClient *sptr, char *text) {
 	TLine *tEntry; // Iter8or
 	char *body;
 
+	if(!MyConnect(sptr)) // No need to check if it's not our client =]
+		return text;
+
 	// Strip all markup shit (bold, italikk etc) and colours
 	if(!(body = (char *)StripControlCodes(text)))
 		return text;