UserHost command implementation (untested) #1

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@marcofalcioni

It seems that UserHost is required by some clients (mIRC wants it). This implementation simply echoes the nicknames that match the current room.

@erh erh commented on the diff May 4, 2012
src/main/xgen/irc/commands/UserHostCommand.java
+package xgen.irc.commands;
+
+import xgen.irc.*;
+
+public class UserHostCommand extends Command {
+
+ public UserHostCommand() {
+ super( "USERHOST" );
+ }
+
+ public void handle( Context context , Connection conn , String line ) {
+ String[] nicknames = line.trim().split( "\\s+" );
+ // for each nickname, if found in room, return ident
+ StringBuilder sb = new StringBuilder();
+ for(String nickname : nicknames) {
+ if(conn.inRoom(nickname)) {
@erh
erh May 4, 2012 Owner

conn.inRoom( x ) is if the user associated with conn is in room x, not if nickname is in room

@marcofalcioni
marcofalcioni May 4, 2012

Thanks,
I am having a hard time following: a command is issued in a room, but when I handle it, i can't seem to find the room either in the context or the connection.
Thanks
Marco

 
Marco Falcioni
415 886 7363


From: Eliot reply@reply.github.com
To: marcofalcioni marcofalcioni@yahoo.com
Sent: Friday, May 4, 2012 12:30 PM
Subject: Re: [mongo-irc] UserHost command implementation (untested) (#1)

+package xgen.irc.commands;
+
+import xgen.irc.*;
+
+public class UserHostCommand extends Command {
+   
+    public UserHostCommand() {
+        super( "USERHOST" );
+    }
+
+    public void handle( Context context , Connection conn , String line ) {
+        String[] nicknames = line.trim().split( "\s+" );
+        // for each nickname, if found in room, return ident
+        StringBuilder sb = new StringBuilder();
+        for(String nickname : nicknames) {
+            if(conn.inRoom(nickname)) {

conn.inRoom( x ) is if the user associated with conn is in room x, not if nickname is in room


Reply to this email directly or view it on GitHub:
https://github.com/erh/mongo-irc/pull/1/files#r776402

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment