/userip NICK

These are old archives. They are kept for historic purposes only.
Post Reply
kenshinxl
Posts: 5
Joined: Sat Jul 03, 2004 11:15 pm

/userip NICK

Post by kenshinxl » Sun Jul 04, 2004 12:18 am

hi, it would be useful to have a command /userip NICK which would return the NICK's IP in a raw numeric. Just like the /userhost NICK does. Of course the /userip would only be allowed for opers, and for normal users it could return the cloaed IP, like KAG7724.7242GA.IP

do you think such a module is doable? i know unreal 3.2.1 can show the NICK's IP in a /whois reply, but i need a more faster way to read a Users IP :)

Like when my bot (it's an oper) joins my irc, then it would retrieve IPs of all clients currently connected to the server, and doing this via the /whois command would be very slow.

please helpppppp...

aquanight
Official supporter
Posts: 862
Joined: Tue Mar 09, 2004 10:47 pm
Location: Boise, ID

Post by aquanight » Sun Jul 04, 2004 2:02 am

Well, I would assume the best way to do this is with a bit of research.

It appears that the User structure does have a field for the IP Address. It is char* ip_str, and the code says it stores the IP in string form (so I'm assuming dotted-quad for IPv4 and colon-hex (or whatever it's called ;p) for IPv6). After this you could simply do an IsOper(sptr) if you want to show it for all opers or IsEyes(sptr) if you want +s +e required. Failing the check, you can probably look to see how Unreal passes an IP address to the cloak module, and use this to cloak the IP using the appropriate routine :) .

How you obtain a pointer to the User structure from the nick list (if you want /userhost-like support :P ) is another matter. I suppose you could see how /userhost does it (read through m_userhost.c).

AngryWolf
Posts: 554
Joined: Sat Mar 06, 2004 10:53 am
Location: Hungary
Contact:

Post by AngryWolf » Sun Jul 04, 2004 12:50 pm

To kenshinxl & aquanight: for example like this? (By the way, no documentation yet, and the module requires Unreal3.2.1.) Yes, the easiest and most recommended way of coding a /userip that works like /userhost is to take the code of /userhost do modifications in it like I did, because then /userip will be also suitable for scripts). What I don't agree with is showing the IP only to eyes (+e) users. That snomask has an other meaning, I think.

kenshinxl
Posts: 5
Joined: Sat Jul 03, 2004 11:15 pm

Post by kenshinxl » Sun Jul 04, 2004 1:11 pm

hi aquanight, thx for the reply! the problem is, i dunno anything about C coding hehe. i tried looking at the m_userhost.c to understand the structure, but it would take forever for me to understand =|

kenshinxl
Posts: 5
Joined: Sat Jul 03, 2004 11:15 pm

Post by kenshinxl » Sun Jul 04, 2004 1:13 pm

angrywolf, THX! did u try that module yet? im going to try it now :) will post again after i tried

AngryWolf
Posts: 554
Joined: Sat Mar 06, 2004 10:53 am
Location: Hungary
Contact:

Post by AngryWolf » Sun Jul 04, 2004 1:31 pm

Certainly, I did, and seemingly it's working well. Opinions about the module are welcomed. If everything's OK, I'll write a doc for the module and release it.

kenshinxl
Posts: 5
Joined: Sat Jul 03, 2004 11:15 pm

Post by kenshinxl » Sun Jul 04, 2004 1:53 pm

AngryWolf, the module works perfectly as i hoped it would :)) thanks again!!

aquanight
Official supporter
Posts: 862
Joined: Tue Mar 09, 2004 10:47 pm
Location: Boise, ID

Post by aquanight » Sun Jul 04, 2004 4:23 pm

AngryWolf wrote:What I don't agree with is showing the IP only to eyes (+e) users. That snomask has an other meaning, I think.
Yep. It shows Oper Override notices, probably SA* usage...

It also shows the realhost in a /whois request :P .

codemastr
Former UnrealIRCd head coder
Posts: 811
Joined: Sat Mar 06, 2004 8:47 pm
Location: United States
Contact:

Post by codemastr » Sun Jul 04, 2004 4:49 pm

For the next version, I intend to include a /userip command (that will probably be almost exactly like the one AngryWolf made).

AngryWolf, you have one major bad thing in your module. Don't create numeric conflicts! A numeric for /userip already exists courtesy of ircu. RPL_USERIP is 340, not 710. I'd strongly suggest you use 340 instead.

I don't know if you are aware, but http://www.alien.net.au/irc/irc2numerics.html lists the numerics in use by several IRCds. It's a good place to look when adding a feature that is supported by other IRCds or when trying to avoid conflicts.
-- codemastr

kenshinxl
Posts: 5
Joined: Sat Jul 03, 2004 11:15 pm

Post by kenshinxl » Sun Jul 04, 2004 7:40 pm

thanks for that too codemastr, i change to numeric 340 then

AngryWolf
Posts: 554
Joined: Sat Mar 06, 2004 10:53 am
Location: Hungary
Contact:

Post by AngryWolf » Sun Jul 04, 2004 8:49 pm

Thanks for your help, codemastr. Unfortunately I didn't know that website, but it's extremely useful. I wonder why I haven't seen it yet.

Until the next version gets released, I will make this module available for people who don't want to wait. So the module with the numeric correction and the documentation is available from my modules page (or from this link).

Dremth
Posts: 3
Joined: Fri Aug 06, 2004 2:10 am

Post by Dremth » Fri Aug 06, 2004 2:41 am

i dont see m_userhost.c in my modules folder :(

Dremth
Posts: 3
Joined: Fri Aug 06, 2004 2:10 am

Post by Dremth » Fri Aug 06, 2004 2:42 am

i see m_userhost.dll but i cant read it :?

w00t
Posts: 1136
Joined: Thu Mar 25, 2004 3:31 am
Location: Nowra, Australia

Post by w00t » Fri Aug 06, 2004 3:48 am

You probably downloaded the win32 binary, rather than the source.
-ChatSpike IRC Network [http://www.chatspike.net]
-Denora Stats [http://denora.nomadirc.net]
-Omerta [http://www.barafranca.com]

Post Reply