protected override XElement[] Do(WebContext context) { Account receiver; if (context.httprequest.Form.AllKeys.Contains("receiverId")) { receiver = Account.LoadById(int.Parse(context.httprequest.Form["receiverId"])); } else if (context.httprequest.Form.AllKeys.Contains("receiverName")) { receiver = Account.LoadByUser(User.LoadByName(context.httprequest.Form["receiverName"])); } else { throw new ApplicationException("receiverId/receiverName not passed"); } if (Config.instance.IsMigrationEnabled && receiver.needsMigration) { throw new ApplicationException("User is not migrated"); } PMMessage newMessage = PMConversation.SendPMMessage( context.account, receiver, this.getTitle(context), this.getBody(context) ); newMessage.conversation.markAsRead(context.session.account, newMessage, newMessage); return(new XElement[] { newMessage.exportToXml(context) }); }
public async override Task <Message> HandleMessage(Message msg) { PMMessage pm = msg as PMMessage; if (pm is null) { return(null); } MessageContext context = new MessageContext(msg, this); string sfConversationID = Smart.Format(ConversationID, context); string sfArchiveURL = Smart.Format(ArchiveURL, sfConversationID); try { var thing = await Client.GetThingByFullnameAsync(sfConversationID); await Agent.Post(sfArchiveURL, null); } catch (Exception ex) { logger.Error(ex, $"{ex.GetType().Name} thrown when archiving conversation: {ex.Message}"); } return(msg); }
/** * Packet: 0x53 * Length: 2 bytes * * Sends a PopupMessage with a predetermined message */ public static void SendPopupMessage(this NetState ns, PMMessage msg) { if (ns != null && ns.GetSendBuffer(out var buffer)) { buffer[0] = 0x53; // Packet ID buffer[1] = (byte)msg; ns.Send(ref buffer, 2); } }
override protected IEnumerable <XElement> getSpecificNewMessageData(WebContext context) { PMMessage message = this.url.pm; string quoted = UBBParser.StripQuotes(message.bodyUBB).Trim(); return(new XElement[] { message.exportToXml(context), new XElement("quoted", quoted), }); }
public PopupMessage( PMMessage msg ) : base(0x53, 2) { m_Stream.Write( (byte)msg ); }
public PopupMessage(PMMessage msg) : base(0x53, 2) { Stream.Write((byte)msg); }
// Methods public PopupMessage(PMMessage msg) : base(83, 2) { this.m_Stream.Write(((byte)msg)); }
public Reply(string pmId, string remainder) : base(remainder) { this.pm = PMMessage.LoadById(int.Parse(pmId)); }