public Message(string readLine, vhAPI api) { SyncRef = new object(); if (readLine.ToLower().StartsWith("ping ")) { str = "PONG " + readLine.Substring(5) + "\r\n"; //sock.Send(Encoding.ASCII.GetBytes(str3)); } if (readLine.Contains(":(channel is full) transfering you to #")) { vhackxy = readLine .Substring(readLine .IndexOf(":(channel is full) transfering you to", 1)) .Replace(":(channel is full) transfering you to ", "") .Replace("\r", "") .Replace("\n", "") .Replace(" ", ""); } if (readLine.Contains(" 433 *")) { String str2 = "v[" + api.getUsername(); //var msg = ("NICK " + str2 + "\r\n"); //msg += ("USER " + api.getStats(Stats.id).Result + " 0 * : vHack XT@Android\r\n"); str = "NICK " + str2 + "_" + "\r\n"; } if (readLine.Contains("376")) { str = "PRIVMSG vHackXTGuard :.join " + api.getStats(Stats.id) + " " + api.getStats(Stats.hash) + "\r\n"; } }
public Join(vhAPI api) { //String str2 = "v[" + api.getUsername(); //String str2 = "v[" + api.getUsername() + "]"; String str2 = api.getUsername(); msg = ("NICK " + str2 + "\r\n"); msg += ("USER " + api.getStats(Stats.id).Result + " 0 * : vHack XT@Android\r\n"); }
public static void ConnectToChat(vhAPI api) { _threadA = new Thread(() => { try { Client = new Client("51.255.93.109", 7531); //bufferedWriter = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); //BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream())); //String str2 = "v[" + api.getUsername(); //bufferedWriter.write("NICK " + str2 + "\r\n"); //bufferedWriter.write("USER " + api.getStats(Stats.id) + " 0 * : vHack XT@Android\r\n"); //bufferedWriter.flush(); String str2 = "v[" + api.getUsername(); Client.OnResponse += (s) => { var lines = s.sb.ToString(); foreach (var line in lines.Split(new[] { "\r\n" }, StringSplitOptions.None)) { if (string.IsNullOrEmpty(line)) { continue; } procLine(line.Trim(), str2, api); } }; // starts connection Client.Connect(); Client.WaitConnect(); // handshake message var id = api.getStats(Stats.id).Result; var msg = $"NICK {str2}\r\nUSER {id} 0 * : vHack XT@Android\r\n"; Client.Send(msg); var t = new Thread(() => { while (true) { Client.Receive(); Client.WaitReceive(); } }); t.Start(); } catch (System.Net.WebException e) { // TODO Auto-generated catch block vhConsole.config.logger.Log(e.StackTrace); } catch (IOException e) { // TODO Auto-generated catch block vhConsole.config.logger.Log(e.StackTrace); } }); _threadA.Start(); _threadA.Join(); }