Mattie

Mattie

Jan 5th, 2011
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.30 KB | None | 0 0
  1. else if (code == RPL_USERHOST)//in gebruik om de userhost te krijgen DOOR MATTIE GEMAAKT
  2.         {
  3.             //get nickname
  4.             String nickFromMessage = response.substring(response.indexOf(" :"), response.indexOf("="));
  5.             //get rid of some characters
  6.             nickFromMessage = nickFromMessage.replace(" :", "");
  7.             //get rid of a '*' sometimes (oper???)
  8.             nickFromMessage = nickFromMessage.replace("*", "");
  9.             //get the userhost
  10.             String hostfail = response.substring(response.indexOf("="), response.length());
  11.             //hostfail= everything from "=+...........nl"
  12.             String host = hostfail.substring(2, hostfail.length());
  13.             //remove the '+'
  14.             host = host.replace("+", "");
  15.             //get the realname from the hostname
  16.             String realname = host.substring(0, host.indexOf("@"));
  17.             //get rid of the realname in the hostname
  18.             host = host.substring(host.indexOf("@"), host.length());
  19.             //get rid of the "@" in the hostname
  20.             host = host.replace("@", "");
  21.  
  22.             User[] users = this.getUsers(chantemp);
  23.             for (int i = 0; i < users.length; i++)
  24.             {
  25. //  //DEBUG     System.out.println("nick from message: " + nickFromMessage + "    nick from nick: " + users[i].getNick());
  26.                 if (users[i].getNick().equals(nickFromMessage))
  27.                 {
  28.                     users[i].setHost(host);
  29.                     users[i].setRealName(realname);
  30.                 }
  31.             }
  32. //          chantemp = "";
  33.         }
Advertisement
Add Comment
Please, Sign In to add comment