Пример #1
0
        /// <summary>
        /// 最最开始的一个全局变量的初始化
        /// </summary>
        private static void initi()
        {
            // sip = "172.16.49.192";

            // sip = "192.168.113.168";
            isdebug    = true;
            run        = true;
            SqlManager = new MySQL_Manager();
        }
Пример #2
0
        private static bool InviteFriendToUsePlugin(List <int> list)
        {
            bool result = false;

            try
            {
                int        Plugin_id  = list[0];
                int        invitor_id = list[1];
                List <int> msg        = new List <int>();
                msg.Add(Plugin_id);
                msg.Add(invitor_id);
                for (int i = 2; i < list.Count; i++)//遍历每个好友id,放入消息
                {
                    if (isOnline(list[i]))
                    {
                        //Message_Dic[list[i]].Add(new UserMessage(3,msg));
                        OnlineUserManager.user_list[list[i]].ReciveMessage(invitor_id, new OnlineUserMessge(3, msg, MySQL_Manager.getTimestampOfNow()));
                        result = true;
                    }
                }
            }
            catch (Exception e)
            {
                result = false;
                Console.WriteLine("error in InviteFriendToUsePlugin,{0}", e.Message);
            }
            return(result);
        }
Пример #3
0
 public OnlineUserMessge(byte _m, object _o) : base(_m, _o)
 {
     timestamp = MySQL_Manager.getTimestampOfNow();
 }
Пример #4
0
 /// <summary>
 /// 上线之后通知所有在线好友
 /// </summary>
 /// <param name="user"></param>
 public static void addOnlineUser(OnlineUser user)
 {
     foreach (var item in user_list.Values)
     {
         if (Program.SqlManager.isFriend(item.ID, user.ID))
         {
             item.ReciveMessage(user.ID, new OnlineUserMessge(1, new pair <int, byte[]>(user.ID, user.IP), MySQL_Manager.getTimestampOfNow()));
         }
     }
     user.first_login_max_vitality();
     user_list.Add(user.ID, user);
 }
Пример #5
0
 /// <summary>
 /// 完成对在线用户的离线操作,返回一个该用户下线的UserMessage
 /// 离线操作包括将自己的消息盒子消息选择性的存入数据库,并清空自己的消息,
 /// </summary>
 private OnlineUserMessge Offline()
 {
     msgList.Clear();
     UploadMessageToDatabase();
     return(new OnlineUserMessge(2, ID, MySQL_Manager.getTimestampOfNow()));
 }