Java IRC, processing login command correctly -


for school have create java irc client without using libraries (pircbot example). have created bot called "skynet". bot handles commands send it.

but login function need command processed senders username , not bots (skynet)

 bufferedwriter writer = new bufferedwriter(             new outputstreamwriter(socket.getoutputstream()))     else if (line.contains("!login")) //!login <username> <password>     {         string[] parts = line.split(" ");         string user = parts[4];         string pass = parts[5];         string inpuser = user;         string inppass = pass;           bufferedreader br = new bufferedreader(new filereader("c:/users/leroy/documents/users.txt"));         {             string userpass; //user#pass             while ((userpass = br.readline()) != null) {                 string pass = userpass.split("#")[1];                 string user = userpass.split("#")[0];                 if (inpuser.equals(user) && inppass.equals(pass))                  {                     system.out.print("login succesfull: " + "\r\n"); //word onder naam van user geprint                      writer.write("nick " + user + "\r\n"); //dit moet verstuurd worden onder naam van de user niet de bot                     writer.write("pass " + pass + "\r\n");                     writer.flush(); 

this gives following console output:

:skynet!~skynetbot@53533763.cm-6-4a.dynamic.ziggo.nl nick :boa 

here changes/logs bots name in specified username (boa). need change/login username of user send command.

for example, if join #channel username: leroy , send !login boa constrictor want change users nick given login username/nick. output needs be:

leroy!leroy@53533763.cm-6-4a.dynamic.ziggo.nl nick :boa 

any suggestions on doing wrong appreciated.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -