Beispiel #1
0
 void handler(cs_zkrobot.zkRobot robot, object userdata, string from_jid, string command, string cmd_options, ref string result, ref string result_options)
 {
     // TODO: 增加命令 ...
     result = "err";
     result_options = "unsupported cmd:" + command;
 }
Beispiel #2
0
 static void cb_response(string from_jid, cs_zkrobot.RequestToken token, string result, string options)
 {
     System.Console.WriteLine("res: from:" + from_jid + ", result=" + result + ", options=" + options);
     System.Threading.AutoResetEvent evt = (System.Threading.AutoResetEvent)token.userdata();
     evt.Set();
 }
Beispiel #3
0
        void response(string from_jid, cs_zkrobot.RequestToken token, string result, string options)
        {
            if (token.command() == "list_conferences") {
                if (result == "ok") {
                    // cids=1,2&
                    List<int> cids = null;

                    string sp = get_kv(options, "cids");
                    if (sp != null) {
                        string[] ss = sp.Split(new char[] { ',' });
                        cids = new List<int>();
                        foreach (string s in ss) {
                            try {
                                int cid = int.Parse(s);
                                cids.Add(cid);
                            }
                            catch { }
                        }
                    }

                    ((delegate_list_conference_result)token.userdata())(cids);
                }
                else {
                    // TODO: 错误处理
                    ((delegate_list_conference_result)token.userdata())(null);
                }
            }
            else if (token.command() == "info_conference") {
                if (result == "ok") {
                    string sp = get_kv(options, "info");
                    ((delegate_info_conference_result)token.userdata())(sp);
                }
                else {
                    // TODO: 错误处理 ...
                    ((delegate_info_conference_result)token.userdata())(null);
                }
            }
            else {
                // TODO: 更多的 ....
            }
        }