private void HandleIM(String flap) { if(Message != null) { StringTokenizer stk = new StringTokenizer(flap,':'); string from = stk.ReadToken(); bool autoResponse = stk.ReadToken() == "T"; if(protocol == ProtocolVersion.TOCv2){ string unknownParam = stk.ReadToken(); } string message = stk.ReadToEnd(); MessageEventArgs e = new MessageEventArgs(from, message, autoResponse); Message(this,e); } }
private void ProcessTocEvents() { isShuttingDown = false; while (!isShuttingDown) { string flap = ReadFlap(); if ( flap == null ) { continue; } StringTokenizer stk = new StringTokenizer(flap,':'); switch(stk.ReadToken().ToUpper()) { case "IM_IN": HandleIM(stk.ReadToEnd()); break; case "IM_IN2": HandleIM(stk.ReadToEnd()); break; case "ERROR": HandleError(stk.ReadToEnd()); break; case "CONFIG": HandleConfig(stk.ReadToEnd()); break; case "CONFIG2": HandleConfig(stk.ReadToEnd()); break; case "UPDATE_BUDDY": HandleUpdate(stk.ReadToEnd()); break; case "UPDATE_BUDDY2": HandleUpdate(stk.ReadToEnd()); break; } } }