示例#1
0
 //TODO: QUERY DATABASE OR CALL API
 public IEnumerable<WebimEndpoint> GetBuddiesByUid(long uid, int limit = 1000)
 {
     //TODO: STUB CODE
     WebimEndpoint ep1 = new WebimEndpoint("1", "uid:1", "user1");
     WebimEndpoint ep2 = new WebimEndpoint("2", "uid:2", "user2");
     return new List<WebimEndpoint>() {ep1, ep2};
 }
示例#2
0
 public WebimClient(WebimEndpoint ep, string domain, string apikey, string host, int port)
 {
     this.ep = ep;
     this.domain = domain;
     this.apikey = apikey;
     this.host = host;
     this.port = port;
 }
 /**
 * API: current user
 *
 * 返回当前的Webim端点(用户)
 */
 public WebimEndpoint Endpoint()
 {
     // TODO: 应替换该代码,返回集成系统的当前用户。
     WebimEndpoint ep = new WebimEndpoint("1", "user1");
     ep.Avatar = "/static/images/male.png";
     ep.Presence = "online";
     ep.Show = "available";
     ep.Url = "#";// 用户空间
     ep.Status = ""; // 用户状态
     return ep;
 }
 /**
 * API: buddies by ids
 *
 * @param buddy id array
 *
 * @return Buddy list
 *
 */
 public IEnumerable<WebimEndpoint> BuddiesByIds(string uid, string[] ids)
 {
     List<WebimEndpoint> buddies = new List<WebimEndpoint>();
     WebimEndpoint e = new WebimEndpoint("1", "user1");
     e.Avatar = "/static/images/male.png";
     buddies.Add(e);
     e = new WebimEndpoint("2", "user2");
     e.Avatar = "/static/images/female.png";
     buddies.Add(e);
     return buddies;
 }
        /**
         * API: Buddies of current user.
         *
         * Buddy:
         *
         *  id:         uid
         *  uid:        uid
         *  nick:       nick
         *  avatar:    url of photo
         *  presence:   online | offline
         *  show:       available | unavailable | away | busy | hidden
         *  url:        url of home page of buddy
         *  status:     buddy status information
         *  group:      group of buddy

         * @param string current uid
         *
         * @return Buddy list
         *
         */
        public IEnumerable<WebimEndpoint> Buddies(string uid)
        {
            //TODO: STUB CODE
            List<WebimEndpoint> buddies = new List<WebimEndpoint>();
            WebimEndpoint e = new WebimEndpoint("1", "user1");
            e.Avatar = "/static/images/male.png";
            buddies.Add(e);
            e = new WebimEndpoint("2", "user2");
            e.Avatar = "/static/images/female.png";
            buddies.Add(e);
            return buddies;
        }
 //TODO: you should read current user, and mapping to endpoint
 public WebimEndpoint CurrentEndpoint()
 {
     WebimEndpoint ep = new WebimEndpoint(
         "1",
         "uid:1",
         "user1");
     ep.PicUrl = ""; //用户头像
     ep.Show = "available";
     ep.Url = ""; //用户空间
     ep.Status = ""; //用户状态
     return ep;
 }
 /// <summary>
 /// Webim控制器
 /// </summary>
 public WebimController()
 {
     this.model = new WebimModel();
     this.plugin = new WebimPlugin();
     this.endpoint = this.plugin.Endpoint();
 }
 private WebimEndpoint Mapping(IUser u)
 {
     WebimEndpoint ep = new WebimEndpoint(
         u.UserId.ToString(),
         u.NickName);
     ep.Avatar = SiteUrls.Instance().UserAvatarUrl(u, AvatarSizeType.Small);
     ep.Show = "available";
     ep.Url = SiteUrls.Instance().SpaceHome(u.UserId);
     ep.Status = "";
     return ep;
 }