Example #1
0
        /// <summary>
        /// 退出,下线
        /// </summary>
        /// <param name="listener"></param>
        /// <returns></returns>
        public IQQActionFuture DoLogout(QQActionListener listener)
        {
            CancelPoll();
            var login = Context.GetModule <LoginModule>(QQModuleType.LOGIN);

            return(login.Logout(listener));
        }
Example #2
0
 public MarkEmailAction(bool status, List <QQEmail> markList,
                        IQQContext context, QQActionListener listener)
     : base(context, listener)
 {
     this.status   = status;
     this.markList = markList;
 }
 public UploadOfflinePictureAction(IQQContext context,
         QQActionListener listener, QQUser user, string file)
     : base(context, listener)
 {
     _user = user;
     _file = file;
 }
 public UploadOfflinePictureAction(IQQContext context,
                                   QQActionListener listener, QQUser user, string file)
     : base(context, listener)
 {
     _user = user;
     _file = file;
 }
Example #5
0
 public MarkEmailAction(bool status, List<QQEmail> markList,
         IQQContext context, QQActionListener listener)
     : base(context, listener)
 {
     this.status = status;
     this.markList = markList;
 }
Example #6
0
 public GetOffPicAction(IQQContext context, QQActionListener listener,
     OffPicItem offpic, QQMsg msg, Stream picOut)
     : base(context, listener)
 {
     _offpic = offpic;
     _msg = msg;
     _picOut = picOut;
 }
Example #7
0
 public GetOffPicAction(IQQContext context, QQActionListener listener,
                        OffPicItem offpic, QQMsg msg, Stream picOut)
     : base(context, listener)
 {
     _offpic = offpic;
     _msg    = msg;
     _picOut = picOut;
 }
Example #8
0
 public GetUserPicAction(IQQContext context, QQActionListener listener,
     CFaceItem cface, QQMsg msg, Stream picOut)
     : base(context, listener)
 {
     this.cface = cface;
     this.msg = msg;
     this.picOut = picOut;
 }
Example #9
0
 /**
  * <p>Constructor for GetGroupPicAction.</p>
  *
  * @param context a {@link iqq.im.core.IQQContext} 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(IQQContext context, QQActionListener listener,
                          CFaceItem cface, QQMsg msg, Stream picOut)
     : base(context, listener)
 {
     _cface  = cface;
     _msg    = msg;
     _picOut = picOut;
 }
Example #10
0
 /**
  * <p>Constructor for GetGroupPicAction.</p>
  *
  * @param context a {@link iqq.im.core.IQQContext} 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(IQQContext context, QQActionListener listener,
                                     CFaceItem cface, QQMsg msg, Stream picOut)
     : base(context, listener)
 {
     _cface = cface;
     _msg = msg;
     _picOut = picOut;
 }
Example #11
0
 public GetUserPicAction(IQQContext context, QQActionListener listener,
                         CFaceItem cface, QQMsg msg, Stream picOut)
     : base(context, listener)
 {
     this.cface  = cface;
     this.msg    = msg;
     this.picOut = picOut;
 }
Example #12
0
        public IQQActionFuture Login(QQActionListener listener)
        {
            var future = new ProcActionFuture(listener, true);

            // DoGetLoginSig(future); // 这里可以直接替换成 DoCheckVerify(future);
            DoCheckVerify(future);
            return(future);
        }
Example #13
0
 public WebLoginAction(IQQContext context, QQActionListener listener, 
     string username, string password, long uin, string verifyCode)
     : base(context, listener)
 {
     _username = username;
     _password = password;
     _uin = uin;
     _verifyCode = verifyCode;
 }
Example #14
0
 public WebLoginAction(IQQContext context, QQActionListener listener,
                       string username, string password, long uin, string verifyCode)
     : base(context, listener)
 {
     _username   = username;
     _password   = password;
     _uin        = uin;
     _verifyCode = verifyCode;
 }
 protected AbstractActionFuture(QQActionListener proxyListener)
 {
     _isCanceled   = false;
     _hasEvent     = true;
     EventQueue    = new BlockingCollection <QQActionEvent>();
     ProxyListener = proxyListener;
     Listener      = (sender, args) =>
     {
         ProxyListener?.Invoke(this, args);
         EventQueue.Add(args);
     };
     Cts = new CancellationTokenSource();
 }
Example #16
0
        /// <summary>
        /// 重新登录
        /// </summary>
        /// <param name="status"></param>
        /// <param name="listener"></param>
        /// <returns></returns>
        public IQQActionFuture Relogin(QQStatus status, QQActionListener listener)
        {
            if (Session.State == QQSessionState.Online)
            {
                //throw new Exception("client is aready online !!!");
                return(null);
            }
            Account.Status = status;
            Session.State  = QQSessionState.Logining;
            var procModule = GetModule <ProcModule>(QQModuleType.PROC);

            return(procModule.Relogin(status, listener));
        }
 protected AbstractActionFuture(QQActionListener proxyListener)
 {
     _isCanceled = false;
     _hasEvent = true;
     EventQueue = new BlockingCollection<QQActionEvent>();
     ProxyListener = proxyListener;
     Listener = (sender, args) =>
     {
         ProxyListener?.Invoke(this, args);
         EventQueue.Add(args);
     };
     Cts = new CancellationTokenSource();
 }
Example #18
0
        private void DoCheckQRCode(ProcActionFuture future)
        {
            if (future.IsCanceled)
            {
                return;
            }

            var login = Context.GetModule <LoginModule>(QQModuleType.LOGIN);
            QQActionListener handler = null;

            handler = (sender, Event) =>
            {
                if (Event.Type == QQActionEventType.EvtOK)
                {
                    var eventArgs = (CheckQRCodeArgs)Event.Target;
                    switch (eventArgs.Status)
                    {
                    case QRCodeStatus.QRCODE_OK:
                        Context.FireNotify(new QQNotifyEvent(QQNotifyEventType.QrcodeSuccess));
                        DoCheckLoginSig(eventArgs.Msg, future);
                        break;

                    case QRCodeStatus.QRCODE_VALID:
                        Thread.Sleep(3000);
                        login.CheckQRCode(handler);
                        break;

                    case QRCodeStatus.QRCODE_AUTH:
                        Context.FireNotify(new QQNotifyEvent(QQNotifyEventType.QrcodeAuth, eventArgs.Msg));
                        login.CheckQRCode(handler);
                        break;

                    case QRCodeStatus.QRCODE_INVALID:
                        Context.FireNotify(new QQNotifyEvent(QQNotifyEventType.QrcodeInvalid, eventArgs.Msg));
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }
                else if (Event.Type == QQActionEventType.EvtError)
                {
                    future.NotifyActionEvent(QQActionEventType.EvtError, Event.Target);
                }
            };
            login.CheckQRCode(handler);
        }
Example #19
0
        public IQQActionFuture Relogin(QQStatus status, QQActionListener listener)
        {
            Context.Account.Status = status;
            Context.Session.State  = QQSessionState.Logining;
            var login  = Context.GetModule <LoginModule>(QQModuleType.LOGIN);
            var future = login.ChannelLogin(status, (sender, Event) =>
            {
                if (Event.Type == QQActionEventType.EvtError)
                {
                    Context.Logger.LogInformation("iqq client ReloginChannel fail!!! use Login.");
                    Login(listener);
                }
                else
                {
                    listener(this, Event);
                }
            });

            return(future);
        }
Example #20
0
        public IQQActionFuture LoginWithQRCode(QQActionListener listener)
        {
            var future = new ProcActionFuture(listener, true);
            var login  = Context.GetModule <LoginModule>(QQModuleType.LOGIN);

            login.GetQRCode((sender, @event) =>
            {
                if (@event.Type == QQActionEventType.EvtOK)
                {
                    var verify = (Image)@event.Target;
                    Context.FireNotify(new QQNotifyEvent(QQNotifyEventType.QrcodeReady, verify));
                    DoCheckQRCode(future);
                    // future.NotifyActionEvent(QQActionEventType.EvtOK, @event.Target);
                }
                else if (@event.Type == QQActionEventType.EvtError)
                {
                    future.NotifyActionEvent(QQActionEventType.EvtError, @event.Target);
                }
            });
            return(future);
        }
Example #21
0
        /// <summary>
        /// 退出登录
        /// </summary>
        /// <param name="listener"></param>
        /// <returns></returns>
        public IQQActionFuture Logout(QQActionListener listener)
        {
            if (Session.State == QQSessionState.Offline)
            {
                // Context.Logger.LogWarning($"{Account.Username}: client is aready offline !!!");
                throw new Exception("client is aready offline !!!");
            }

            var procModule = GetModule <ProcModule>(QQModuleType.PROC);

            return(procModule.DoLogout((sender, Event) =>
            {
                // 无论退出登录失败还是成功,都需要释放资源
                if (Event.Type == QQActionEventType.EvtOK ||
                    Event.Type == QQActionEventType.EvtError)
                {
                    Session.State = QQSessionState.Offline;
                    Destroy();
                }
                listener?.Invoke(sender, Event);
            }));
        }
Example #22
0
        public IQQActionFuture SendMsg(QQMsg msg, QQActionListener listener)
        {
            var future = new ProcActionFuture(listener, true);

            if (msg.Type == QQMsgType.SESSION_MSG)
            {
                var stranger = (QQStranger)msg.To;
                if (string.IsNullOrEmpty(stranger.GroupSig))
                {
                    GetSessionMsgSig(stranger, (sender, Event) =>
                    {
                        if (Event.Type == QQActionEventType.EvtOK)
                        {
                            DoSendMsg(msg, future.Listener);
                        }
                        else if (Event.Type == QQActionEventType.EvtError)
                        {
                            future.NotifyActionEvent(Event.Type, Event.Target);
                        }
                    });
                }
                return future;
            }
            else if (msg.Type == QQMsgType.GROUP_MSG || msg.Type == QQMsgType.DISCUZ_MSG)
            {
                if (msg.Type == QQMsgType.GROUP_MSG)
                {
                    if (msg.Group.Gin == 0)
                    {
                        msg.Group = Context.Store.GetGroupByCode(msg.Group.Code);
                        return future;
                    }
                }
            }
            return DoSendMsg(msg, listener);
        }
Example #23
0
        public IQQActionFuture SendMsg(QQMsg msg, QQActionListener listener)
        {
            var future = new ProcActionFuture(listener, true);

            if (msg.Type == QQMsgType.SESSION_MSG)
            {
                var stranger = (QQStranger)msg.To;
                if (string.IsNullOrEmpty(stranger.GroupSig))
                {
                    GetSessionMsgSig(stranger, (sender, Event) =>
                    {
                        if (Event.Type == QQActionEventType.EvtOK)
                        {
                            DoSendMsg(msg, future.Listener);
                        }
                        else if (Event.Type == QQActionEventType.EvtError)
                        {
                            future.NotifyActionEvent(Event.Type, Event.Target);
                        }
                    });
                }
                return(future);
            }
            else if (msg.Type == QQMsgType.GROUP_MSG || msg.Type == QQMsgType.DISCUZ_MSG)
            {
                if (msg.Type == QQMsgType.GROUP_MSG)
                {
                    if (msg.Group.Gin == 0)
                    {
                        msg.Group = Context.Store.GetGroupByCode(msg.Group.Code);
                        return(future);
                    }
                }
            }
            return(DoSendMsg(msg, listener));
        }
 public GetStrangerInfoAction(IQQContext context, QQActionListener listener,
         QQUser user)
     : base(context, listener)
 {
     this.user = user;
 }
Example #25
0
        /// <summary>
        /// 获取登录二维码
        /// </summary>
        /// <param name="qqActionListener"></param>
        public IQQActionFuture LoginWithQRCode(QQActionListener qqActionListener = null)
        {
            var login = GetModule <ProcModule>(QQModuleType.PROC);

            return(login.LoginWithQRCode(qqActionListener));
        }
Example #26
0
        /// <summary>
        /// 搜索群列表
        /// </summary>
        /// <param name="resultList"></param>
        /// <param name="listener"></param>
        /// <returns></returns>
        public IQQActionFuture SearchGroupGetList(QQGroupSearchList resultList, QQActionListener listener)
        {
            var mod = GetModule <GroupModule>(QQModuleType.GROUP);

            return(mod.SearchGroup(resultList, listener));
        }
Example #27
0
        /// <summary>
        /// 刷新验证码
        /// </summary>
        /// <param name="verifyEvent"></param>
        /// <param name="listener"></param>
        /// <returns></returns>
        public IQQActionFuture FreshVerify(QQNotifyEvent verifyEvent, QQActionListener listener)
        {
            var mod = GetModule <LoginModule>(QQModuleType.LOGIN);

            return(mod.GetCaptcha(Account.Uin, listener));
        }
Example #28
0
        /// <summary>
        /// 临时消息信道,用于发送群U2U会话消息
        /// </summary>
        /// <param name="user"></param>
        /// <param name="listener"></param>
        /// <returns></returns>
        public IQQActionFuture GetSessionMsgSig(QQStranger user, QQActionListener listener)
        {
            var mod = GetModule <ChatModule>(QQModuleType.CHAT);

            return(mod.GetSessionMsgSig(user, listener));
        }
Example #29
0
 public IQQActionFuture SearchGroup(QQGroupSearchList resultList, QQActionListener listener = null)
 {
     return PushHttpAction(new SearchGroupInfoAction(Context, listener, resultList));
 }
Example #30
0
        /// <summary>
        /// 上传好友图片
        /// </summary>
        /// <param name="file"></param>
        /// <param name="listener"></param>
        /// <returns></returns>
        public IQQActionFuture UploadCustomPic(string file, QQActionListener listener)
        {
            var mod = GetModule <ChatModule>(QQModuleType.CHAT);

            return(mod.UploadCFace(file, listener));
        }
Example #31
0
        /// <summary>
        /// 获取群聊天图片
        /// </summary>
        /// <param name="cface"></param>
        /// <param name="msg"></param>
        /// <param name="picout"></param>
        /// <param name="listener"></param>
        /// <returns></returns>
        public IQQActionFuture GetGroupPic(CFaceItem cface, QQMsg msg, Stream picout, QQActionListener listener)
        {
            var mod = GetModule <ChatModule>(QQModuleType.CHAT);

            return(mod.GetGroupPic(cface, msg, picout, listener));
        }
Example #32
0
 public IQQActionFuture GetGroupList(QQActionListener listener = null)
 {
     return PushHttpAction(new GetGroupListAction(Context, listener));
 }
Example #33
0
 public IQQActionFuture UpdateGroupMessageFilter(QQActionListener listener = null)
 {
     return PushHttpAction(new UpdateGroupMessageFilterAction(Context, listener));
 }
 public GetGroupListAction(IQQContext context, QQActionListener listener)
     : base(context, listener)
 {
 }
Example #35
0
 public IQQActionFuture GetGroupGid(QQGroup group, QQActionListener listener = null)
 {
     return PushHttpAction(new GetGroupAccoutAction(Context, listener, group));
 }
 public GetOnlineFriendAction(IQQContext context, QQActionListener listener)
     : base(context, listener)
 {
 }
Example #37
0
        /// <summary>
        /// 获取讨论组列表
        /// </summary>
        /// <param name="listener"></param>
        /// <returns></returns>
        public IQQActionFuture GetDiscuzList(QQActionListener listener)
        {
            var mod = GetModule <DiscuzModule>(QQModuleType.DISCUZ);

            return(mod.GetDiscuzList(listener));
        }
Example #38
0
 public IQQActionFuture GetMemberStatus(QQGroup group, QQActionListener listener = null)
 {
     return PushHttpAction(new GetGroupMemberStatusAction(Context, listener, group));
 }
Example #39
0
 public IQQActionFuture GetStrangerInfo(QQUser user, QQActionListener listener = null)
 {
     return PushHttpAction(new GetStrangerInfoAction(Context, listener, user));
 }
Example #40
0
 public IQQActionFuture ChangeStatus(QQStatus status, QQActionListener listener = null)
 {
     return PushHttpAction(new ChangeStatusAction(Context, listener, status));
 }
Example #41
0
        /// <summary>
        /// 上传离线图片
        /// </summary>
        /// <param name="user"></param>
        /// <param name="file"></param>
        /// <param name="listener"></param>
        /// <returns></returns>
        public IQQActionFuture UploadOffPic(QQUser user, string file, QQActionListener listener)
        {
            var mod = GetModule <ChatModule>(QQModuleType.CHAT);

            return(mod.UploadOffPic(user, file, listener));
        }
Example #42
0
 public GetGroupFaceAction(IQQContext context, QQActionListener listener,
                           QQGroup group)
     : base(context, listener)
 {
     this._group = group;
 }
Example #43
0
        /// <summary>
        /// 发送正在输入通知
        /// </summary>
        /// <param name="user"></param>
        /// <param name="listener"></param>
        /// <returns></returns>
        public IQQActionFuture SendInputNotify(QQUser user, QQActionListener listener)
        {
            var mod = GetModule <ChatModule>(QQModuleType.CHAT);

            return(mod.SendInputNotify(user, listener));
        }
Example #44
0
 public IQQActionFuture GetUserLevel(QQUser user, QQActionListener listener = null)
 {
     return PushHttpAction(new GetUserLevelAction(Context, listener, user));
 }
Example #45
0
        /// <summary>
        /// 获取讨论组信息
        /// </summary>
        /// <param name="discuz"></param>
        /// <param name="listener"></param>
        /// <returns></returns>
        public IQQActionFuture GetDiscuzInfo(QQDiscuz discuz, QQActionListener listener)
        {
            var mod = GetModule <DiscuzModule>(QQModuleType.DISCUZ);

            return(mod.GetDiscuzInfo(discuz, listener));
        }
 public GetCaptchaImageAction(IQQContext context, QQActionListener listener, long uin)
     : base(context, listener)
 {
     _uin = uin;
 }
Example #47
0
        /// <summary>
        /// 获取群成员状态
        /// </summary>
        /// <param name="group"></param>
        /// <param name="listener"></param>
        /// <returns></returns>
        public IQQActionFuture GetGroupMemberStatus(QQGroup group, QQActionListener listener)
        {
            var mod = GetModule <GroupModule>(QQModuleType.GROUP);

            return(mod.GetMemberStatus(group, listener));
        }
Example #48
0
 public IQQActionFuture GetUserSign(QQUser user, QQActionListener listener = null)
 {
     return PushHttpAction(new GetFriendSignAction(Context, listener, user));
 }
Example #49
0
        /// <summary>
        /// 更新群消息筛选
        /// </summary>
        /// <param name="listener"></param>
        /// <returns></returns>
        public IQQActionFuture UpdateGroupMessageFilter(QQActionListener listener)
        {
            var mod = GetModule <GroupModule>(QQModuleType.GROUP);

            return(mod.UpdateGroupMessageFilter(listener));
        }
 public ChannelLoginAction(IQQContext context, QQActionListener listener, QQStatus status)
     : base(context, listener)
 {
     this._status = status;
 }
Example #51
0
        public void AcceptBuddyRequest(string qq, QQActionListener listener = null)
        {
            var mod = GetModule <BuddyModule>(QQModuleType.BUDDY);

            mod.AddBuddy(listener, qq);
        }
Example #52
0
 public IQQActionFuture GetDiscuzList(QQActionListener listener)
 {
     return PushHttpAction(new GetDiscuzListAction(this.Context, listener));
 }
 public GetFriendInfoAction(IQQContext context, QQActionListener listener, QQUser buddy)
     : base(context, listener)
 {
     _buddy = buddy;
 }
Example #54
0
 public IQQActionFuture GetDiscuzInfo(QQDiscuz discuz, QQActionListener listener)
 {
     return PushHttpAction(new GetDiscuzInfoAction(this.Context, listener, discuz));
 }
 public UploadCustomFaceAction(IQQContext context, QQActionListener listener, string file)
     : base(context, listener)
 {
     _file = file;
 }
Example #56
0
 public GetSelfInfoAction(IQQContext context, QQActionListener listener)
     : base(context, listener)
 {
 }
 public GetGroupInfoAction(IQQContext context, QQActionListener listener, QQGroup group)
     : base(context, listener)
 {
     this._group = group;
 }
Example #58
0
 public CheckEmailSig(string url, IQQContext context, QQActionListener listener)
     : base(context, listener)
 {
     this._url = url;
 }
Example #59
0
 public GetWPKeyAction(string sid, IQQContext context, QQActionListener listener)
     : base(context, listener)
 {
     _sid = sid;
 }
Example #60
0
 public GetVFWebqq(IQQContext context, QQActionListener listener)
     : base(context, listener)
 {
 }