/// <summary> /// Initializes a new TypingNotificationEventArgs /// </summary> /// <param name="screenname">The screen name of the user who sent the typing notification</param> /// <param name="notification">The type of typing notification received</param> public TypingNotificationEventArgs(string screenname, TypingNotification notification) { this.screenname = screenname; this.notification = notification; }
/// <summary> /// Sends a typing notification /// </summary> /// <param name="screenName">The screenname to receive the typing notification</param> /// <param name="tn">A <see cref="TypingNotification"/> enumeration specifying what /// notification to send</param> /// <exception cref="NotLoggedInException">Thrown when the <see cref="Session"/> is not logged in</exception> public void SendTypingNotification(string screenName, TypingNotification tn) { if (!parent.LoggedIn) { throw new NotLoggedInException(); } DirectIMConnection conn = parent.Connections.GetDirectIMByScreenname(screenName); if (conn != null) { if (conn.Connected) { // TODO: send DIM typing notifications } } // Construct SNAC(04,14) SNACHeader sh = new SNACHeader(); sh.FamilyServiceID = SNAC_ICBM_FAMILY; sh.FamilySubtypeID = ICBM_TYPING_NOTIFICATION; ByteStream stream = new ByteStream(); stream.WriteByteArray(new byte[] {0, 0, 0, 0, 0, 0, 0, 0}); stream.WriteUshort(0x0001); stream.WriteByte((byte) Encoding.ASCII.GetByteCount(screenName)); stream.WriteString(screenName, Encoding.ASCII); stream.WriteUshort((ushort) tn); SNACFunctions.BuildFLAP(Marshal.BuildDataPacket(parent, sh, stream)); }