예제 #1
0
 public IMSession GetIMLogFrom(string id, int first, int last = -1)
 {
     if (IMLog.ContainsKey(id))
     {
         IMSession resp = IMSession.partialIMSession(IMLog[id], first, last);
         return(resp);
     }
     return(null);
 }
예제 #2
0
        public static IMSession partialIMSession(IMSession session, int first, int last)
        {
            IMSession sesh = new IMSession();

            sesh.user_id   = session.user_id;
            sesh.user_name = session.user_name;
            if (session.messages.Count > first)
            {
                int l = last - first;
                if (l < 0 || last < 0 || (l + first) >= session.messages.Count)
                {
                    l = session.messages.Count - first;
                }
                int read = session.messages.Count - (first + l);
                sesh.messages = session.messages.GetRange(first, l);
            }
            else
            {
                sesh.messages = null;
            }
            return(sesh);
        }
예제 #3
0
 public static IMSession partialIMSession(IMSession session,int first,int last)
 {
     IMSession sesh = new IMSession();
     sesh.user_id = session.user_id;
     sesh.user_name = session.user_name;
     if (session.messages.Count > first)
     {
         int l = last - first;
         if (l < 0 || last < 0 || (l + first) >= session.messages.Count) l = session.messages.Count - first;
         int read = session.messages.Count - (first + l);
         sesh.messages = session.messages.GetRange(first, l);
     }
     else sesh.messages = null;
     return sesh;
 }