/// <summary>
        ///     Get users in current room
        /// </summary>
        /// <param name="roomPos"></param>
        /// <param name="roomId">Room Id</param>
        /// <returns>List of the users and access</returns>
        public virtual CurrentProvider GetUsersInRoom
        (
            int roomPos,
            int roomId
        )
        {
            List <object[]> usersInRoom;

            using (ISelect db = new QQContext())
            {
                usersInRoom = db.GetUsersInRoom
                              (
                    roomId
                              );
            }
            User.Rooms[roomPos].ListUsersInRoom = new List <Room.SmallUser>();
            usersInRoom.ForEach(user => User.Rooms[roomPos].ListUsersInRoom.Add(new Room.SmallUser()
            {
                AddressId = (int)user[0],
                UserId    = (int)user[1],
                FIO       = (string)user[2],
                Access    = (string)user[3]
            }));

            return(this);
        }
Exemple #2
0
 /**
  * <p>Constructor for GetGroupPicAction.</p>
  *
  * @param context a {@link iqq.im.core.QQContext} object.
  * @param listener a {@link iqq.im.QQActionListener} object.
  * @param cface a {@link iqq.im.bean.content.CFaceItem} object.
  * @param msg a {@link iqq.im.bean.QQMsg} object.
  * @param picOut a {@link java.io.OutputStream} object.
  */
 public GetGroupPicAction(QQContext context, QQActionListener.OnActionEvent listener,
                          CFaceItem cface, QQMsg msg, byte[] picOut) : base(context, listener)
 {
     this.cface  = cface;
     this.msg    = msg;
     this.picOut = picOut;
 }
 public UploadOfflinePictureAction(QQContext context,
         QQActionEventHandler listener, QQUser user, string file)
     : base(context, listener)
 {
     this.user = user;
     this.file = file;
 }
Exemple #4
0
 public HttpActor(HttpActorType type, QQContext context, IHttpAction action, Exception throwable)
 {
     _type      = type;
     _context   = context;
     _action    = action;
     _throwable = throwable;
 }
        public void SetNewSettings
        (
            string newCfg,
            params int[] ids
        )
        {
            using (IUpdate update = new QQContext()) {
                update.UpdateConfig
                (
                    ids[0],
                    newCfg
                );
            }

            using (IInsert insert = new QQContext()) {
                switch (ids[1])
                {
                case 0:
                    insert.InsertNewValue(19, newCfg[0] == '1' ? "Открыто" : "Закрыто");
                    break;

                case 1:
                    insert.InsertNewValue(20, newCfg[1] == '1' ? "Открыто" : "Закрыто");
                    break;

                case 2:
                    insert.InsertNewValue(21, newCfg[2] == '1' ? "Открыто" : "Закрыто");
                    break;
                }
            }
        }
Exemple #6
0
 public AbstractHttpAction(QQContext context, QQActionListener.OnActionEvent handler)
 {
     this.context    = context;
     evtHandlers    += handler;
     this.retryTimes = 0;
     this.future     = new AbstractActionFuture(handler);
 }
        public CurrentProvider GetManipulatedData
        (
            int posRoom
        )
        {
            List <object[]> result;

            using (ISelect select = new QQContext()) {
                result = select.GetManipulatedRooms
                         (
                    User.Rooms[posRoom]
                    .RoomId
                         );
            }

            User.Rooms[posRoom].ListSensors = new List <Room.Sensor>();
            result.ForEach(line => User.Rooms[posRoom].ListSensors.Add(new Room.Sensor()
            {
                Name     = (string)line[0],
                Fam      = (string)line[1],
                State    = (string)line[2],
                Data     = (string)line[3],
                SensorId = (int)line[4],
                OptionId = (int)line[5]
            }));

            return(this);
        }
Exemple #8
0
 public HttpActor(HttpActorType type, QQContext context, IHttpAction action, QQHttpResponse response)
 {
     _type     = type;
     _context  = context;
     _action   = action;
     _response = response;
 }
 public UploadOfflinePictureAction(QQContext context,
                                   QQActionEventHandler listener, QQUser user, string file)
     : base(context, listener)
 {
     this.user = user;
     this.file = file;
 }
        public CurrentProvider GetRoomSensors
        (
            int posRoom,
            int roomId
        )
        {
            List <object[]> result;

            using (ISelect select = new QQContext()) {
                result = select.GetRoomSensors
                         (
                    roomId
                         );
            }

            User.Rooms[posRoom].ListSensors = new List <Room.Sensor>();
            result.ForEach(line => User.Rooms[posRoom].ListSensors.Add(new Room.Sensor()
            {
                Name  = (string)line[0],
                Fam   = (string)line[1],
                State = (string)line[2],
                Data  = (string)line[3]
            }));

            return(this);
        }
Exemple #11
0
 /**
  * <p>Constructor for HttpActor.</p>
  *
  * @param type a {@link iqq.im.actor.HttpActor.Type} object.
  * @param context a {@link iqq.im.core.QQContext} object.
  * @param action a {@link iqq.im.action.AbstractHttpAction} object.
  * @param response a {@link iqq.im.http.QQHttpResponse} object.
  */
 public HttpActor(Type type, QQContext context, AbstractHttpAction action, QQHttpResponse response)
 {
     this.type     = type;
     this.context  = context;
     this.action   = action;
     this.response = response;
 }
Exemple #12
0
 public MarkEmailAction(bool status, List <QQEmail> markList,
                        QQContext context, QQActionEventHandler listener)
     : base(context, listener)
 {
     this.status   = status;
     this.markList = markList;
 }
Exemple #13
0
 public MarkEmailAction(bool status, List<QQEmail> markList,
         QQContext context, QQActionEventHandler listener)
     : base(context, listener)
 {
     this.status = status;
     this.markList = markList;
 }
Exemple #14
0
 /**
  * <p>Constructor for HttpActor.</p>
  *
  * @param type a {@link iqq.im.actor.HttpActor.Type} object.
  * @param context a {@link iqq.im.core.QQContext} object.
  * @param action a {@link iqq.im.action.AbstractHttpAction} object.
  * @param throwable a {@link java.lang.Throwable} object.
  */
 public HttpActor(Type type, QQContext context, AbstractHttpAction action, Exception throwable)
 {
     this.type      = type;
     this.context   = context;
     this.action    = action;
     this.throwable = throwable;
 }
Exemple #15
0
 /**
  * <p>Constructor for GetGroupPicAction.</p>
  *
  * @param context a {@link iqq.im.core.QQContext} object.
  * @param listener a {@link iqq.im.IQQActionListener} object.
  * @param cface a {@link iqq.im.bean.content.CFaceItem} object.
  * @param msg a {@link iqq.im.bean.QQMsg} object.
  * @param picOut a {@link java.io.OutputStream} object.
  */
 public GetGroupPicAction(QQContext context, QQActionEventHandler listener,
                          CFaceItem cface, QQMsg msg, Stream picOut)
     : base(context, listener)
 {
     this.cface  = cface;
     this.msg    = msg;
     this.picOut = picOut;
 }
Exemple #16
0
 /**
  * <p>Constructor for WebLoginAction.</p>
  *
  * @param context a {@link iqq.im.core.QQContext} object.
  * @param listener a {@link iqq.im.QQActionListener.OnActionEvent} object.
  * @param username a {@link java.lang.String} object.
  * @param password a {@link java.lang.String} object.
  * @param uin a long.
  * @param verifyCode a {@link java.lang.String} object.
  */
 public WebLoginAction(QQContext context, QQActionListener.OnActionEvent listener,
                       String username, String password, long uin, String verifyCode) : base(context, listener)
 {
     this.username   = username;
     this.password   = password;
     this.uin        = uin;
     this.verifyCode = verifyCode;
 }
Exemple #17
0
 /**
  * <p>Constructor for HttpActor.</p>
  *
  * @param type a {@link iqq.im.actor.HttpActor.Type} object.
  * @param context a {@link iqq.im.core.QQContext} object.
  * @param action a {@link iqq.im.action.AbstractHttpAction} object.
  * @param current a long.
  * @param total a long.
  */
 public HttpActor(Type type, QQContext context, AbstractHttpAction action, long current, long total)
 {
     this.type    = type;
     this.context = context;
     this.action  = action;
     this.current = current;
     this.total   = total;
 }
Exemple #18
0
 public GetOffPicAction(QQContext context, QQActionEventHandler listener,
                        OffPicItem offpic, QQMsg msg, Stream picOut)
     : base(context, listener)
 {
     this.offpic = offpic;
     this.msg    = msg;
     this.picOut = picOut;
 }
Exemple #19
0
 public HttpActor(HttpActorType type, QQContext context, IHttpAction action, long current, long total)
 {
     _type    = type;
     _context = context;
     _action  = action;
     _current = current;
     _total   = total;
 }
        /**
         * <p>Constructor for GetGroupPicAction.</p>
         *
         * @param context a {@link iqq.im.core.QQContext} object.
         * @param listener a {@link iqq.im.IQQActionListener} object.
         * @param cface a {@link iqq.im.bean.content.CFaceItem} object.
         * @param msg a {@link iqq.im.bean.QQMsg} object.
         * @param picOut a {@link java.io.OutputStream} object.
         */
        public GetGroupPicAction(QQContext context, QQActionEventHandler listener,
                                            CFaceItem cface, QQMsg msg, Stream picOut)
            : base(context, listener)
        {

            this.cface = cface;
            this.msg = msg;
            this.picOut = picOut;
        }
Exemple #21
0
 public WebLoginAction(QQContext context, QQActionEventHandler listener, 
     string username, string password, long uin, string verifyCode)
     : base(context, listener)
 {
     _username = username;
     _password = password;
     _uin = uin;
     _verifyCode = verifyCode;
 }
Exemple #22
0
 public WebLoginAction(QQContext context, QQActionEventHandler listener,
                       string username, string password, long uin, string verifyCode)
     : base(context, listener)
 {
     _username   = username;
     _password   = password;
     _uin        = uin;
     _verifyCode = verifyCode;
 }
Exemple #23
0
        public GetOffPicAction(QQContext context, QQActionEventHandler listener,
            OffPicItem offpic, QQMsg msg, Stream picOut)
            : base(context, listener)
        {

            this.offpic = offpic;
            this.msg = msg;
            this.picOut = picOut;
        }
 public void UpdateStatusOfTheSensor
 (
     int sensorId,
     string newStatus
 )
 {
     using (IUpdate update = new QQContext()) {
         update.UpdateStatusSensor(sensorId, newStatus);
     }
 }
 public void Init(QQContext context)
 {
     if (_dispatchThread == null)
     {
         _dispatchThread = Task.Factory.StartNew(Run);
     }
     if (_pollDispatchThread == null)
     {
         _pollDispatchThread = Task.Factory.StartNew(DoPoll);
     }
 }
 public void Init(QQContext context)
 {
     if (_dispatchThread == null)
     {
         _dispatchThread = Task.Factory.StartNew(Run);
     }
     if (_pollDispatchThread == null)
     {
         _pollDispatchThread = Task.Factory.StartNew(DoPoll);
     }
 }
 /// <summary>
 ///     Update accesses
 /// </summary>
 /// <param name="accessedObjects">User id, access</param>
 public virtual void UpdateAccessesAsync
 (
     List <object[]> accessedObjects
 )
 {
     using (IUpdate db = new QQContext()) {
         db.UpdateAccesses
         (
             accessedObjects
         );
     }
 }
 /// <summary>
 ///     Delete user from the db
 /// </summary>
 /// <param name="addressId">Address Id</param>
 public virtual void DeleteUserAsync
 (
     int addressId
 )
 {
     using (IRemove db = new QQContext())
     {
         db.RemoveUser
         (
             addressId
         );
     }
 }
Exemple #29
0
 public override void Init(QQContext context)
 {
     base.Init(context);
     try
     {
         //                 cookieJar = new QQHttpCookieJar();
         //                 cookieCollection = new CookieCollection();
         _cookieContainer = new CookieContainer();
     }
     catch (Exception e)
     {
         throw new QQException(QQErrorCode.INIT_ERROR, e);
     }
 }
        /// <summary>
        ///     Update information
        /// </summary>
        /// <param name="args">Arguments</param>
        public virtual void UpdateAuthorizedHuman
        (
            NewPersonalInfoHandler args
        )
        {
            IUpdate db = new QQContext();

            switch (args.CurrentUpdateType)
            {
            case NewPersonalInfoHandler.UpdateType.Avatar:
            {
                db.UpdateAvatar
                (
                    User.Avatar,
                    User.UserId
                );
                break;
            }

            case NewPersonalInfoHandler.UpdateType.AvatarAndTextInfo:
            {
                db.UpdateExtraInformationAndAvatar
                (
                    User.Avatar,
                    User.Address,
                    User.Name,
                    User.SecondName,
                    User.FatherName,
                    User.EMail,
                    User.PhoneNumber,
                    User.Organization,
                    User.UserId
                );
                break;
            }

            case NewPersonalInfoHandler.UpdateType.Password:
            {
                db.UpdatePassword
                (
                    User.Password,
                    User.UserId
                );
                break;
            }

            default: return;
            }
        }
 /// <summary>
 ///     Check user on exist
 /// </summary>
 /// <param name="userId">User Id</param>
 /// <param name="password">Password</param>
 /// <returns>Exist user</returns>
 public virtual bool IsUserExist
 (
     int userId,
     string password
 )
 {
     using (ISelect db = new QQContext())
     {
         return(db.IsUserExist
                (
                    userId,
                    password
                ));
     }
 }
 /// <summary>
 ///     Check user on exist
 /// </summary>
 /// <param name="login">Login</param>
 /// <param name="password">Password</param>
 /// <returns>Exist user</returns>
 public virtual bool IsUserExist
 (
     string login,
     string password
 )
 {
     using (ISelect db = new QQContext())
     {
         return(db.IsUserExist
                (
                    login,
                    password
                ));
     }
 }
/*
        public void DoRobotReply()
        {
            try
            {
                while (DispatchAction(robotReplyActorQueue.Take())) { };
            }
            catch { }
        }
 */

        public void Init(QQContext context)
        {
            if (_dispatchThread == null)
            {
                _dispatchThread = Task.Factory.StartNew(Run);
            }
            if (_pollDispatchThread == null)
            {
                _pollDispatchThread = Task.Factory.StartNew(DoPoll);
            }
/*
            if (robotReplyDispatchThread == null)
            {
                robotReplyDispatchThread = Task.Factory.StartNew(DoRobotReply);
            }
 */
        }
 /// <summary>
 ///     Add new user to db
 /// </summary>
 /// <param name="login">Login</param>
 /// <param name="password">Password</param>
 /// <param name="roomId">Room Id</param>
 /// <param name="fio">FIO of the user</param>
 public virtual List <object> AddNewUserAsync
 (
     string login,
     string password,
     int roomId,
     params string[] fio
 )
 {
     using (IInsert db = new QQContext())
     {
         return(db.AddNewUser
                (
                    login,
                    password,
                    roomId,
                    fio
                ));
     }
 }
        /// <summary>
        ///     Check level of the access to the application
        /// </summary>
        /// <param name="args">Login and Password</param>
        /// <returns></returns>
        public virtual Tuple <object, bool, CurrentProvider> CheckAccess
        (
            AccessHandler args
        )
        {
            List <object>[] data;
            using (ISelect db = new QQContext())
            {
                data = db.IsAccess
                       (
                    args.Login,
                    args.Password
                       );
            }

            if (data == null)
            {
                return(new Tuple <object, bool, CurrentProvider>
                       (
                           "On",
                           false,
                           null
                       ));
            }

            CreatePersonalData
            (
                data[0]
            );
            CreateRoomData
            (
                data[1]
            );

            return(new Tuple <object, bool, CurrentProvider>
                   (
                       "Off",
                       true,
                       this
                   ));
        }
 public GetGroupListAction(QQContext context, QQActionEventHandler listener) : base(context, listener) { }
        public GetDiscuzInfoAction(QQContext context, QQActionEventHandler listener, QQDiscuz discuz)
            : base(context, listener)
        {

            this.discuz = discuz;
        }
Exemple #38
0
        public SendMsgAction(QQContext context, QQActionEventHandler listener, QQMsg msg)
            : base(context, listener)
        {

            this.msg = msg;
        }
Exemple #39
0
        public GetWPKeyAction(string sid, QQContext context, QQActionEventHandler listener)
            : base(context, listener)
        {

            this.sid = sid;
        }
 public ChangeStatusAction(QQContext context, QQActionEventHandler listener, QQStatus status)
     : base(context, listener)
 {
     this._status = status;
 }
        public UploadCustomFaceAction(QQContext context, QQActionEventHandler listener, string file)
            : base(context, listener)
        {

            this.file = file;
        }
        public GetFriendAccoutAction(QQContext context, QQActionEventHandler listener, QQUser buddy)
            : base(context, listener)
        {

            this.buddy = buddy;
        }
        public ShakeWindowAction(QQContext context, QQActionEventHandler listener, QQUser user)
            : base(context, listener)
        {

            this.user = user;
        }
Exemple #44
0
 public WebLogoutAction(QQContext context, QQActionEventHandler listener) : base(context, listener) { }
Exemple #45
0
 public PollEmailAction(string sid, long t, QQContext context, QQActionEventHandler listener)
     : base(context, listener)
 {
     this.sid = sid;
     this.t = t;
 }
 public GetOnlineFriendAction(QQContext context, QQActionEventHandler listener) : base(context, listener) { }
Exemple #47
0
 protected AbstractHttpAction(QQContext context, QQActionEventHandler listener)
 {
     Context = context;
     Listener = listener;
     _retryTimes = 0;
 }
Exemple #48
0
 public PollMsgAction(QQContext context, QQActionEventHandler listener) : base(context, listener) { }
 public AcceptBuddyAddAction(QQContext context, QQActionEventHandler listener, string account)
     : base(context, listener)
 {
     this._account = account;
 }
        public SendInputNotifyAction(QQContext context, QQActionEventHandler listener, QQUser user)
            : base(context, listener)
        {

            this.user = user;
        }
Exemple #51
0
 /**
  * <p>Constructor for ChangeStatusAction.</p>
  *
  * @param context a {@link iqq.im.core.QQContext} object.
  * @param listener a {@link iqq.im.QQActionListener} object.
  * @param status a {@link iqq.im.bean.QQStatus} object.
  */
 public ChangeStatusAction(QQContext context, QQActionListener.OnActionEvent listener,
                           QQStatus status) : base(context, listener)
 {
     this.status = status;
 }
Exemple #52
0
 public override void Init(QQContext context)
 {
     base.Init(context);
     try
     {
         //                 cookieJar = new QQHttpCookieJar();
         //                 cookieCollection = new CookieCollection();
         _cookieContainer = new CookieContainer();
     }
     catch (Exception e)
     {
         throw new QQException(QQErrorCode.INIT_ERROR, e);
     }
 }
 public DeleteEmailAction(List<QQEmail> markList,
         QQContext context, QQActionEventHandler listener)
     : base(context, listener)
 {
     this._markList = markList;
 }
 public GetSessionMsgSigAction(QQContext context, QQActionEventHandler listener,
         QQStranger user)
     : base(context, listener)
 {
     this.user = user;
 }
 public GetRobotReplyAction(QQContext context, QQActionEventHandler listener, QQMsg input, RobotType robotType)
     : base(context, listener)
 {
     this.input = input;
     this.robotType = robotType;
 }
 public GetStrangerInfoAction(QQContext context, QQActionEventHandler listener,
         QQUser user)
     : base(context, listener)
 {
     this.user = user;
 }
 public GetGroupMemberStatusAction(QQContext context, QQActionEventHandler listener, QQGroup group)
     : base(context, listener)
 {
     this.group = group;
 }
 public CheckVerifyAction(QQContext context, QQActionEventHandler listener, string qqAccount)
     : base(context, listener)
 {
     _qqAccount = qqAccount;
 }
Exemple #59
0
 public GetGroupMemberStatusAction(QQContext context, QQActionEventHandler listener, QQGroup group)
     : base(context, listener)
 {
     this.group = group;
 }
Exemple #60
0
 public GetPT4Auth(QQContext context, QQActionEventHandler listener) : base(context, listener) { }