public MarkEmailAction(bool status, List<QQEmail> markList, QQContext context, QQActionEventHandler listener) : base(context, listener) { this.status = status; this.markList = markList; }
public QQActionFuture Login(QQActionEventHandler listener) { var future = new ProcActionFuture(listener, true); // DoGetLoginSig(future); // 这里可以直接替换成 DoCheckVerify(future); DoCheckVerify(future); return future; }
public UploadOfflinePictureAction(QQContext context, QQActionEventHandler listener, QQUser user, string file) : base(context, listener) { this.user = user; this.file = file; }
/// <summary> /// 获取群聊天图片 /// </summary> /// <param name="cface"></param> /// <param name="msg"></param> /// <param name="picout"></param> /// <param name="listener"></param> /// <returns></returns> public QQActionFuture GetGroupPic(CFaceItem cface, QQMsg msg, Stream picout, QQActionEventHandler listener) { var mod = GetModule <ChatModule>(QQModuleType.CHAT); return(mod.GetGroupPic(cface, msg, picout, listener)); }
/// <summary> /// 获取离线图片 /// </summary> /// <param name="offpic"></param> /// <param name="msg"></param> /// <param name="picout"></param> /// <param name="listener"></param> /// <returns></returns> public QQActionFuture GetOffPic(OffPicItem offpic, QQMsg msg, Stream picout, QQActionEventHandler listener) { var mod = GetModule <ChatModule>(QQModuleType.CHAT); return(mod.GetOffPic(offpic, msg, picout, listener)); }
public MarkEmailAction(bool status, List <QQEmail> markList, QQContext context, QQActionEventHandler listener) : base(context, listener) { this.status = status; this.markList = markList; }
public QQActionFuture Login(QQActionEventHandler listener) { var future = new ProcActionFuture(listener, true); // DoGetLoginSig(future); // 这里可以直接替换成 DoCheckVerify(future); DoCheckVerify(future); return(future); }
public GetOffPicAction(QQContext context, QQActionEventHandler listener, OffPicItem offpic, QQMsg msg, Stream picOut) : base(context, listener) { this.offpic = offpic; this.msg = msg; this.picOut = picOut; }
/** * <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; }
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; }
/// <summary> /// 重新登录 /// </summary> /// <param name="status"></param> /// <param name="listener"></param> /// <returns></returns> public QQActionFuture Relogin(QQStatus status, QQActionEventHandler listener) { if (Session.State == QQSessionState.ONLINE) { throw new Exception("client is aready online !!!"); } Account.Status = status; Session.State = QQSessionState.LOGINING; var procModule = GetModule <ProcModule>(QQModuleType.PROC); return(procModule.Relogin(status, listener)); }
public QQActionFuture SendMsg(QQMsg msg, QQActionEventHandler listener) { if (msg.Type == QQMsgType.SESSION_MSG) { ProcActionFuture future = new ProcActionFuture(listener, true); QQStranger stranger = (QQStranger)msg.To; if (string.IsNullOrEmpty(stranger.GroupSig)) { GetSessionMsgSig(stranger, new QQActionEventHandler((sender, Event) => { if (Event.Type == QQActionEventType.EVT_OK) { if (!future.IsCanceled) { DoSendMsg(msg, future.Listener); } } else if (Event.Type == QQActionEventType.EVT_ERROR) { future.NotifyActionEvent(Event.Type, Event.Target); } })); } return(future); } else if (msg.Type == QQMsgType.GROUP_MSG || msg.Type == QQMsgType.DISCUZ_MSG) { if (string.IsNullOrEmpty(this.Context.Session.CfaceKey)) { ProcActionFuture future = new ProcActionFuture(listener, true); GetCFaceSig(new QQActionEventHandler((sender, Event) => { if (Event.Type == QQActionEventType.EVT_OK) { if (!future.IsCanceled) { DoSendMsg(msg, future.Listener); } } else if (Event.Type == QQActionEventType.EVT_ERROR) { future.NotifyActionEvent(Event.Type, Event.Target); } })); return(future); } } return(DoSendMsg(msg, listener)); }
public QQActionFuture SendMsg(QQMsg msg, QQActionEventHandler listener) { if (msg.Type == QQMsgType.SESSION_MSG) { ProcActionFuture future = new ProcActionFuture(listener, true); QQStranger stranger = (QQStranger)msg.To; if (string.IsNullOrEmpty(stranger.GroupSig)) { GetSessionMsgSig(stranger, new QQActionEventHandler((sender, Event) => { if (Event.Type == QQActionEventType.EVT_OK) { if (!future.IsCanceled) { DoSendMsg(msg, future.Listener); } } else if (Event.Type == QQActionEventType.EVT_ERROR) { future.NotifyActionEvent(Event.Type, Event.Target); } })); } return future; } else if (msg.Type == QQMsgType.GROUP_MSG || msg.Type == QQMsgType.DISCUZ_MSG) { if (string.IsNullOrEmpty(this.Context.Session.CfaceKey)) { ProcActionFuture future = new ProcActionFuture(listener, true); GetCFaceSig(new QQActionEventHandler((sender, Event) => { if (Event.Type == QQActionEventType.EVT_OK) { if (!future.IsCanceled) { DoSendMsg(msg, future.Listener); } } else if (Event.Type == QQActionEventType.EVT_ERROR) { future.NotifyActionEvent(Event.Type, Event.Target); } })); return future; } } return DoSendMsg(msg, listener); }
protected AbstractActionFuture(QQActionEventHandler proxyListener) { this._hasEvent = true; this._eventQueue = new BlockingCollection<QQActionEvent>(); this._proxyListener = proxyListener; Listener = (sender, args) => { if (this._proxyListener != null) { this._proxyListener(sender, args); } _eventQueue.Add(args); // 没问题 }; OnActionEvent += Listener; }
protected AbstractActionFuture(QQActionEventHandler proxyListener) { this._hasEvent = true; this._eventQueue = new BlockingCollection <QQActionEvent>(); this._proxyListener = proxyListener; Listener = (sender, args) => { if (this._proxyListener != null) { this._proxyListener(sender, args); } _eventQueue.Add(args); // 没问题 }; OnActionEvent += Listener; }
public QQActionFuture CheckQRCode(QQActionEventHandler listener) { var future = new ProcActionFuture(listener, true); var login = Context.GetModule <LoginModule>(QQModuleType.LOGIN); login.CheckQRCode((sender, Event) => { if (Event.Type == QQActionEventType.EVT_OK) { DoCheckLoginSig(Event.Target as string, future); } else if (Event.Type == QQActionEventType.EVT_ERROR) { future.NotifyActionEvent(QQActionEventType.EVT_ERROR, Event.Target); } }); return(future); }
public QQActionFuture Relogin(QQStatus status, QQActionEventHandler listener) { Context.Account.Status = status; Context.Session.State = QQSessionState.LOGINING; var login = Context.GetModule <LoginModule>(QQModuleType.LOGIN); MyLogger.Default.Info("iqq client Relogin..."); var future = login.ChannelLogin(status, (sender, Event) => { if (Event.Type == QQActionEventType.EVT_ERROR) { MyLogger.Default.Info("iqq client ReloginChannel fail!!! use Relogin."); Login(listener); } else { listener(this, Event); } }); return(future); }
/// <summary> /// 退出登录 /// </summary> /// <param name="listener"></param> /// <returns></returns> public QQActionFuture Logout(QQActionEventHandler listener) { if (Session.State == QQSessionState.OFFLINE) { // MyLogger.Default.Warn($"{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.EVT_OK || Event.Type == QQActionEventType.EVT_ERROR) { Session.State = QQSessionState.OFFLINE; Destroy(); } listener?.Invoke(sender, Event); })); }
public UploadCustomFaceAction(QQContext context, QQActionEventHandler listener, string file) : base(context, listener) { this.file = file; }
public GetGroupListAction(QQContext context, QQActionEventHandler listener) : base(context, listener) { }
public GetFriendAccoutAction(QQContext context, QQActionEventHandler listener, QQUser buddy) : base(context, listener) { this.buddy = buddy; }
protected AbstractHttpAction(QQContext context, QQActionEventHandler listener) { Context = context; Listener = listener; _retryTimes = 0; }
/// <summary> /// 检测登录二维码是否已经扫描 /// </summary> /// <param name="qqActionListener"></param> public void CheckQRCode(QQActionEventHandler qqActionListener) { ProcModule module = GetModule <ProcModule>(QQModuleType.PROC); module.CheckQRCode(qqActionListener); }
public void AcceptBuddyRequest(string qq, QQActionEventHandler listener = null) { var mod = GetModule <BuddyModule>(QQModuleType.BUDDY); mod.AddBuddy(listener, qq); }
public ChangeStatusAction(QQContext context, QQActionEventHandler listener, QQStatus status) : base(context, listener) { this._status = status; }
public QQActionFuture CheckLoginSig(string checkUrl, QQActionEventHandler listener) { return PushHttpAction(new CheckLoginSigAction(Context, listener, checkUrl)); }
public GetPT4Auth(QQContext context, QQActionEventHandler listener) : base(context, listener) { }
public WebLogoutAction(QQContext context, QQActionEventHandler listener) : base(context, listener) { }
private void AfterInitialize() { _eventHandler = (sender, Event) => { switch (Event.Type) { case QQActionEventType.EVT_CANCELED: case QQActionEventType.EVT_ERROR: ShowMessage(Event.ToString()); break; } }; _notifyHandler = (sender, Event) => { var client = sender as IQQClient; if (client == null) return; try { switch (Event.Type) { case QQNotifyEventType.BUDDY_INPUT: case QQNotifyEventType.BUDDY_STATUS_CHANGE: { break; } case QQNotifyEventType.CHAT_MSG: { var msg = Event.Target as QQMsg; switch (msg.Type) { case QQMsgType.SESSION_MSG: case QQMsgType.BUDDY_MSG: { if (msg.From.QQ == default(long)) { client.GetUserInfo(msg.From); } ShowMessage(string.Format("{0}:【{1}】消息:{2}", client.Account.QQ, msg.From.Nickname, msg.GetText())); if (chkAutoReply.Checked) { var msgReply = new QQMsg() { Type = QQMsgType.BUDDY_MSG, To = msg.From, From = client.Account, Date = DateTime.Now, }; TextItem text = null; if (chkUseRobot.Checked) { var replyEvent = client.GetRobotReply(msg, RobotType.Tuling).WaitFinalEvent(10000); if (replyEvent.Type == QQActionEventType.EVT_OK) { text = new TextItem(replyEvent.Target as string); } else { text = new TextItem("这是自动回复"); } } else { text = new TextItem("这是自动回复"); } Thread.Sleep(3000); client.SendMsg(msgReply); msgReply.ContentList.Add(text); ShowMessage(string.Format("{0}:自动回复给【{1}】:{2}", client.Account.QQ, msg.From.Nickname, text.ToText())); } break; } case QQMsgType.DISCUZ_MSG: { ShowMessage(string.Format("{0}:讨论组【{1}】来自【{2}】消息:{3}", client.Account.QQ, msg.Discuz, msg.From.Nickname, msg.GetText())); break; } case QQMsgType.GROUP_MSG: { ShowMessage(string.Format("{0}:群【{1}】来自【{2}】消息:{3}", client.Account.QQ, msg.Group, msg.From.Nickname, msg.GetText())); break; } } break; } case QQNotifyEventType.KICK_OFFLINE: ShowMessage(client.Account.QQ + ":被踢下线-" + (String)Event.Target); break; case QQNotifyEventType.CAPACHA_VERIFY: { var verify = (QQNotifyEventArgs.ImageVerify)Event.Target; this.Invoke(new MethodInvoker(() => { pbVerifyPic.Image = verify.Image; tbVerifyCode.Enabled = true; tbVerifyCode.Text = ""; tbVerifyCode.Focus(); })); ShowMessage(verify.Reason); ShowMessage(client.Account.Username + ":请输入验证码:"); _verifyCodeInputed.WaitOne(); client.SubmitVerify(tbVerifyCode.Text, Event); tbVerifyCode.Invoke(new MethodInvoker(() => { tbVerifyCode.Enabled = false; })); break; } case QQNotifyEventType.SHAKE_WINDOW: { var buddy = Event.Target as QQBuddy; if (buddy?.QQ == default(long)) { client.GetUserQQ(buddy, null); } ShowMessage(string.Format("{0}:【{1}】发来抖动屏幕", client.Account.QQ, buddy.ShowName)); if (chkAutoReply.Checked) { client.SendShake(buddy); } break; } case QQNotifyEventType.NET_ERROR: case QQNotifyEventType.UNKNOWN_ERROR: ShowMessage(client.Account.QQ + ":出错-" + Event.Target.ToString()); break; default: ShowMessage(client.Account.QQ + ":" + Event.Type + ", " + Event.Target); break; } UpdateQQInfo(client); } catch (QQException e) { ShowMessage(client.Account.QQ + ":" + e.StackTrace); } catch (Exception e) { ShowMessage(e.StackTrace); } }; var rightButtonCMS = new ContextMenuStrip(); var TSMIRemove = new ToolStripMenuItem() { Text = "移除" }; TSMIRemove.Click += (sender, e) => { var TSMI = sender as ToolStripMenuItem; var CMS = TSMI?.Owner as ContextMenuStrip; if (CMS != null) { var LV = CMS.SourceControl as ListView; if (LV == lvQQList) { RemoveSelectedQQFromList(); } } }; rightButtonCMS.Items.Add(TSMIRemove); lvQQList.ContextMenuStrip = rightButtonCMS; }
public DeleteEmailAction(List<QQEmail> markList, QQContext context, QQActionEventHandler listener) : base(context, listener) { this._markList = markList; }
public GetOnlineFriendAction(QQContext context, QQActionEventHandler listener) : base(context, listener) { }
/** * <p>Constructor for ProcActionFuture.</p> * * @param proxyListener a {@link iqq.im.IQQActionListener} object. * @param Cancelable a bool. */ public ProcActionFuture(QQActionEventHandler proxyListener, bool cancelable) : base(proxyListener) { IsCanceled = false; }
public GetGroupMemberStatusAction(QQContext context, QQActionEventHandler listener, QQGroup group) : base(context, listener) { this.group = group; }
public QQActionFuture GetLoginSig(QQActionEventHandler listener) { return PushHttpAction(new GetLoginSigAction(Context, listener)); }
/// <summary> /// 搜索群列表 /// </summary> /// <param name="resultList"></param> /// <param name="listener"></param> /// <returns></returns> public QQActionFuture SearchGroupGetList(QQGroupSearchList resultList, QQActionEventHandler listener) { var mod = GetModule <GroupModule>(QQModuleType.GROUP); return(mod.SearchGroup(resultList, listener)); }
public GetWPKeyAction(string sid, QQContext context, QQActionEventHandler listener) : base(context, listener) { this.sid = sid; }
/// <summary> /// 获取登录二维码 /// </summary> /// <param name="qqActionListener"></param> public void GetQRCode(QQActionEventHandler qqActionListener) { LoginModule login = GetModule <LoginModule>(QQModuleType.LOGIN); login.GetQRCode(qqActionListener); }
public QQActionFuture GetRecentList(QQActionEventHandler listener) { return PushHttpAction(new GetRecentListAction(this.Context, listener)); }
public QQActionFuture Logout(QQActionEventHandler listener) { return PushHttpAction(new WebLogoutAction(Context, listener)); }
public PollMsgAction(QQContext context, QQActionEventHandler listener) : base(context, listener) { }
public QQActionFuture GetOnlineBuddy(QQActionEventHandler listener) { return PushHttpAction(new GetOnlineFriendAction(this.Context, listener)); }
public QQActionFuture PollMsg(QQActionEventHandler listener) { return PushHttpAction(new PollMsgAction(Context, listener)); }
public QQActionFuture AddBuddy(QQActionEventHandler listener, string account) { return PushHttpAction(new AcceptBuddyAddAction(Context, listener, account)); }
/// <summary> /// 发送正在输入通知 /// </summary> /// <param name="user"></param> /// <param name="listener"></param> /// <returns></returns> public QQActionFuture SendInputNotify(QQUser user, QQActionEventHandler listener) { var mod = GetModule <ChatModule>(QQModuleType.CHAT); return(mod.SendInputNotify(user, listener)); }
public QQActionFuture GetCategoryList(QQActionEventHandler listener) { return PushHttpAction(new GetBuddyListAction(this.Context, listener)); }
/// <summary> /// 获取讨论组信息 /// </summary> /// <param name="discuz"></param> /// <param name="listener"></param> /// <returns></returns> public QQActionFuture GetDiscuzInfo(QQDiscuz discuz, QQActionEventHandler listener) { var mod = GetModule <DiscuzModule>(QQModuleType.DISCUZ); return(mod.GetDiscuzInfo(discuz, listener)); }
/// <summary> /// 临时消息信道,用于发送群U2U会话消息 /// </summary> /// <param name="user"></param> /// <param name="listener"></param> /// <returns></returns> public QQActionFuture GetSessionMsgSig(QQStranger user, QQActionEventHandler listener) { var mod = GetModule <ChatModule>(QQModuleType.CHAT); return(mod.GetSessionMsgSig(user, listener)); }
/// <summary> /// 获取群成员状态 /// </summary> /// <param name="group"></param> /// <param name="listener"></param> /// <returns></returns> public QQActionFuture GetGroupMemberStatus(QQGroup group, QQActionEventHandler listener) { var mod = GetModule <GroupModule>(QQModuleType.GROUP); return(mod.GetMemberStatus(group, listener)); }
public CheckLoginSigAction(QQContext context, QQActionEventHandler listener, string checkSigUrl) : base(context, listener) { this._checkSigUrl = checkSigUrl; }
/// <summary> /// 刷新验证码 /// </summary> /// <param name="verifyEvent"></param> /// <param name="listener"></param> /// <returns></returns> public QQActionFuture FreshVerify(QQNotifyEvent verifyEvent, QQActionEventHandler listener) { var mod = GetModule <LoginModule>(QQModuleType.LOGIN); return(mod.GetCaptcha(Account.Uin, listener)); }
public PollEmailAction(string sid, long t, QQContext context, QQActionEventHandler listener) : base(context, listener) { this.sid = sid; this.t = t; }
/// <summary> /// 更新群消息筛选 /// </summary> /// <param name="listener"></param> /// <returns></returns> public QQActionFuture UpdateGroupMessageFilter(QQActionEventHandler listener) { var mod = GetModule <GroupModule>(QQModuleType.GROUP); return(mod.UpdateGroupMessageFilter(listener)); }
public GetSessionMsgSigAction(QQContext context, QQActionEventHandler listener, QQStranger user) : base(context, listener) { this.user = user; }