/**
         * API: rooms by ids
         *
         * @param room id array
         *
         * @return rooms
         *
         * Room
         *
         */
        public IEnumerable <WebimRoom> RoomsByIds(String uid, String[] ids)
        {
            // TODO: 示例代码,需要替换
            List <WebimRoom> rooms = new List <WebimRoom>();
            WebimRoom        room  = new WebimRoom("room1", "Room1");

            room.Avatar = "/static/images/room.png";
            rooms.Add(room);
            return(rooms);
        }
 /**
  * 根据roomId读取群组
  *
  * @param roomId
  * @return WebimRoom
  */
 public WebimRoom FindRoom(string roomId)
 {
     // TODO: 示例代码,需要替换
     if (roomId.Equals("room1"))
     {
         WebimRoom room = new WebimRoom("room1", "Room1");
         room.Avatar = "/static/images/room.png";
         return(room);
     }
     return(null);
 }
Esempio n. 3
0
        public ActionResult Join()
        {
            WebimClient c    = CurrentClient(Request["ticket"]);
            string      id   = Request["id"];
            WebimRoom   room = plugin.FindRoom(id);

            if (room == null)
            {
                room = model.FindRoom(id);
            }
            if (room != null)
            {
                c.Join(id);
                return(Json(room.Data(), JsonRequestBehavior.AllowGet));
            }
            return(null);
        }
Esempio n. 4
0
        public ActionResult Members()
        {
            WebimClient c      = CurrentClient(Request["ticket"]);
            string      roomId = Request["id"];
            WebimRoom   room   = this.plugin.FindRoom(roomId);
            IEnumerable <WebimMember> members = null;

            if (room != null)
            {
                members = plugin.Members(roomId);
            }
            else
            {
                room = model.FindRoom(roomId);
                if (room != null)
                {
                    members = model.Members(roomId);
                }
            }
            if (room == null)
            {
                return(null);
            }
            JsonObject presences = c.Members(roomId);

            foreach (WebimMember member in members)
            {
                if (presences.ContainsKey(member.Id))
                {
                    member.Presence = "online";
                    member.Show     = (string)presences[member.Id];
                }
                else
                {
                    member.Presence = "offline";
                    member.Show     = "unavailable";
                }
            }
            var data = from m in members select m.Data();

            return(Json(data.ToArray(), JsonRequestBehavior.AllowGet));
        }