An alternative to UBB.threads
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

43 lines
1.2 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using FLocal.Common.dataobjects;
namespace FLocal.IISHandler.handlers.request {
class SendPMHandler : AbstractNewMessageHandler {
protected override string templateName {
get {
return "result/PMSent.xslt";
}
}
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(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) };
}
}
}