예제 #1
0
        /// <summary>
        /// 群组有变动的时候触发此方法
        /// </summary>
        /// <param name="dic"></param>
        /// <returns></returns>
        private async Task handle_mod(JObject dic)
        {
            WriteLog("handle modify");
            await handle_msg(dic);

            JArray modContactList = (JArray)dic["ModContactList"];

            foreach (JObject contact in modContactList)
            {
                //JsonObject m = element.getAsJsonObject();
                string userName = ((JValue)contact["UserName"]).Value.ToString();
                if (userName.StartsWith("@@"))
                {
                    Boolean in_list = false;
                    String  g_id    = userName;
                    foreach (Group group in groupList.Values.ToArray())
                    {
                        //JsonObject group = ge.getAsJsonObject();
                        if (g_id == group.UserName)
                        {
                            in_list = true;
                            //todo:未改完
                            //group.Add("MemberCount", contact["MemberCount"]);
                            //group.Add("NickName", contact["NickName"]);
                            //this.groupMemeberList.Add(g_id, (JArray)contact["MemberList"]);
                            if (null != messageHandle)
                            {
                                messageHandle.groupMemberChange(g_id, (JArray)contact["MemberList"]);
                            }
                            break;
                        }
                    }
                    if (!in_list)
                    {
                        //todo:未改完
                        //this.groupList.Add(contact);
                        //this.groupMemeberList.Add(g_id, (JArray)contact["MemberList"]);
                        if (null != messageHandle)
                        {
                            messageHandle.groupListChange(g_id, (JArray)contact["MemberList"]);
                            messageHandle.groupMemberChange(g_id, (JArray)contact["MemberList"]);
                        }
                    }
                }
                else if (userName == "@")
                {
                    //todo:未改完
                    //Boolean in_list = false;
                    //foreach (ObjectBase ue in memberList)
                    //{
                    //    String u_id = userName;
                    //    if (u_id == ue.UserName)
                    //    {
                    //        u = contact;
                    //        in_list = true;
                    //        break;
                    //    }
                    //}
                    //if (!in_list)
                    //{
                    //    this.memberList.Add(contact);
                    //}
                }
            }
        }
예제 #2
0
        private void handle_mod(JObject dic)
        {
            WriteLog("handle modify");
            handle_msg(dic);

            JArray modContactList = (JArray)dic["ModContactList"];

            foreach (JObject contact in modContactList)
            {
                //JsonObject m = element.getAsJsonObject();
                string userName = ((JValue)contact["UserName"]).Value.ToString();
                if (userName.StartsWith("@@"))
                {
                    Boolean in_list = false;
                    String  g_id    = userName;
                    foreach (JObject group in groupList)
                    {
                        //JsonObject group = ge.getAsJsonObject();
                        if (g_id == ((JValue)group["UserName"]).Value.ToString())
                        {
                            in_list = true;
                            group.Add("MemberCount", contact["MemberCount"]);
                            group.Add("NickName", contact["NickName"]);
                            this.groupMemeberList.Add(g_id, (JArray)contact["MemberList"]);
                            if (null != messageHandle)
                            {
                                messageHandle.groupMemberChange(g_id, (JArray)contact["MemberList"]);
                            }
                            break;
                        }
                    }
                    if (!in_list)
                    {
                        this.groupList.Add(contact);
                        this.groupMemeberList.Add(g_id, (JArray)contact["MemberList"]);
                        if (null != messageHandle)
                        {
                            messageHandle.groupListChange(g_id, (JArray)contact["MemberList"]);
                            messageHandle.groupMemberChange(g_id, (JArray)contact["MemberList"]);
                        }
                    }
                }
                else if (userName == "@")
                {
                    Boolean in_list = false;
                    foreach (JObject ue in memberList)
                    {
                        JObject u    = ue;
                        String  u_id = userName;
                        if (u_id == ((JValue)u["UserName"]).Value.ToString())
                        {
                            u       = contact;
                            in_list = true;
                            break;
                        }
                    }
                    if (!in_list)
                    {
                        this.memberList.Add(contact);
                    }
                }
            }
        }