From fcbb0fcd69eb1bba919b2dd5b0b58b93bd340b99 Mon Sep 17 00:00:00 2001 From: wolfsage Date: Sat, 9 Jun 2007 19:15:18 +0000 Subject: [PATCH] Index: Changes =================================================================== RCS file: /home/cmunk/ircsystems/cvsroot/unreal/Changes,v retrieving revision 1.1.1.1.2.1.2.1.2.2422 diff -u -r1.1.1.1.2.1.2.1.2.2422 Changes --- Changes 9 Jun 2007 18:00:05 -0000 1.1.1.1.2.1.2.1.2.2422 +++ Changes 9 Jun 2007 19:15:14 -0000 @@ -1745,3 +1745,4 @@ directive which loads velcro modules - #0003382 reported by stealth regarding nested C-style comments messing - up example.conf parsing +- #0003107 feature request by Sakkath regarding new WHO flag: +p --- Changes | 1 + src/modules/m_who.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/Changes b/Changes index 7880f4629..e6ae51706 100644 --- a/Changes +++ b/Changes @@ -1745,3 +1745,4 @@ MOTDs directive which loads velcro modules - #0003382 reported by stealth regarding nested C-style comments messing - up example.conf parsing +- #0003107 feature request by Sakkath regarding new WHO flag: +p diff --git a/src/modules/m_who.c b/src/modules/m_who.c index 3d2978e38..c52ed4ec8 100644 --- a/src/modules/m_who.c +++ b/src/modules/m_who.c @@ -137,6 +137,8 @@ struct { char *user; int want_ip; char *ip; + int want_port; + int port; int want_umode; int umodes_dontwant; int umodes_want; @@ -244,6 +246,8 @@ static void who_sendhelp(aClient *sptr) " wildcards accepted", "Flag i : user has string in his/her IP address,", " wildcards accepted", + "Flag p : user is connecting on port ,", + " local connections only", "Flag m : user has set", "Flag n : user has string in his/her nickname,", " wildcards accepted", @@ -370,6 +374,14 @@ int i = 1; } i++; break; + case 'p': + REQUIRE_PARAM() + if (!IsAnOper(sptr)) + break; /* oper-only */ + wfl.port = atoi(argv[i]); + SET_OPTION(wfl.want_port); + i++; + break; case 'M': SET_OPTION(wfl.common_channels_only); break; @@ -495,6 +507,23 @@ char has_common_chan = 0; } } + /* if they only want people connecting on a certain port */ + if (wfl.want_port != WHO_DONTCARE) + { + int port; + + if (!MyClient(acptr)) + return WHO_CANTSEE; + + port = acptr->listener->port; + + if (((wfl.want_port == WHO_WANT) && wfl.port != port) || + ((wfl.want_port == WHO_DONTWANT) && wfl.port == port)) + { + return WHO_CANTSEE; + } + } + /* if they only want people with a certain nick.. */ if (wfl.want_nick != WHO_DONTCARE) {