void ProcessMessage(MessageData obj)
{
if (obj.MessageType == LogMessageType.Party && !Settings.Default.LogPartyMessages)
{
return;
}
if (Settings.Default.NotifyMinimizedOnly && IsPoeActive())
{
if (!IdleManager.IsUserIdle)
{
// If the user isn't idle, replay the message if they do go idle.
IdleManager.AddIdleAction(() => ProcessMessage(obj));
return;
}
// Otherwise, they are idle, so process the message anyways.
}
string StampedMessage = "[" + obj.Date.ToShortTimeString() + "]" + (obj.Sender == null ? "" : (" " + LogMonitor.ChatSymbolForMessageType(obj.MessageType) + obj.Sender)) + ": " + obj.Message;
string Title = "Path of Exile " + obj.MessageType;
Invoke(new Action(() => AppendMessage(StampedMessage)));
if (Settings.Default.TrayNotifications)
{
Invoke(new Action(() => {
NotificationIcon.Visible = true;
NotificationIcon.ShowBalloonTip(5000, Title, (obj.Sender == null ? "" : (obj.Sender + ": ")) + obj.Message, ToolTipIcon.Info);
}));
}
if (Settings.Default.EnableSound)
{
try {
this.SoundPlayer.Play();
} catch (Exception ex) {
AppendMessage("<Error playing sound. This usually occurs due to the Content folder being missing.\r\n Additional Info: " + ex.Message + ">");
}
}
if (Settings.Default.EnableSmtpNotifications)
{
// Feels wasteful to always reload, but really it should only take a millisecond or less.
var SmtpSettings = SmtpDetails.LoadFromSettings();
var SmtpAct = CheckedAction("SMTP", () => SendSmtpNotification(SmtpSettings, StampedMessage));
if (!SmtpSettings.NotifyOnlyIfIdle)
{
SmtpAct();
}
else
{
IdleManager.AddIdleAction(SmtpAct);
}
}
if (Settings.Default.EnablePushbullet)
{
var PbSettings = PushBulletDetails.LoadFromSettings();
var PbAct = CheckedAction("PushBullet", () => {
var Client = new PushBulletClient(PbSettings);
Client.SendPush(Title, StampedMessage);
});
if (!PbSettings.NotifyOnlyIfIdle)
{
PbAct();
}
else
{
IdleManager.AddIdleAction(PbAct);
}
}
}