Feature Mafia should post the days daily update in some kind of pop-up

Today the update was very important because of the phishing scam. Many people log in exclusively with mafia and therefore don't see the login page.
I think it's a good idea to pop up that information in a mafia popup box, and set a flag so it doesn't do it repeatedly.
 

Veracity

Developer
Staff member
Are you saying that the "many people" who "log in exclusively with mafia" do not use the Relay Browser? It is true, I have no idea what the "login page" looks like, but announcements and trivial updates show up in the right pane before you start up chat.

I would hate this kind of popup and would want to disable it - which would defeat the whole point of showing me announcements before I go to the Relay Browser.
 

matt.chugg

Moderator
Are you saying that the "many people" who "log in exclusively with mafia" do not use the Relay Browser? It is true, I have no idea what the "login page" looks like, but announcements and trivial updates show up in the right pane before you start up chat.

I would hate this kind of popup and would want to disable it - which would defeat the whole point of showing me announcements before I go to the Relay Browser.

I usually look at the right pane when I fire up the relay browser, but I have missed things from time to time, I'm prepared to blame my own lack of attention.

As a compromise, what if mafia hit the right pane on login, parse the main messages, and show them in the cli in magenta (or other color). The date of the last one, (unless they happen to have unique ids!) could be stored in a user preference so it only shows new entries...
 

stannius

Member
KoL updates are posted not just on the login page, but also the side bar, twitter, facebook, coldfront, there is an RSS feed available, and on the wiki.
 
How about this for an idea. On the kolmafia login box, you put the notices under the name and password boxes in a nice squared off box. That way there is no extra popup and you get critical info before you log in.
 

fronobulax

Developer
Staff member
I would not expend the effort to implement this precisely because there are so many other sources for the same information. If it does get done, how about including the number of logged in players in a display as well?
 

Veracity

Developer
Staff member
Well, in response to that, I'd like to point out that we print the number of users logged in onto the gCLI when you log in. We parse it out of KoL's login page, which we do see. On that page, I see the following table:

PHP:
<table  width=350  cellspacing=0 cellpadding=0><tr><td style="color: white;" align=center bgcolor=blue><b>Announcements:</b></td></tr><tr><td style="padding: 5px; border: 1px solid blue;"><center><table><tr><td><font size=2>There are currently <b>818</b> players logged in.<p>Looking for KoL players in your area?  Check out the <a target=_blank href="http://forums.kingdomofloathing.com/vb/forumdisplay.php?f=50">community forum</a>!<p><b>September 26</b><br>We're being targeted by some kind of phishing scam -- DO NOT click any download links from e-mails that look like they're from us.<p><b>September 19</b><br>Oh, I almost forgot -- happy Talk Like a Pirate Day!<p><b>August 31</b><br>September's absurd Item-of-the-Month, the Tome of Clip Art, is now available in Mr. Store.<p><center><a href="static.php?id=oldannouncements">old announcements</a> / <a href="static.php?id=trivial">trivial updates</a></center></font></td></tr></table>
...which is, precisely, the Announcements that the OP wants to see. So, no extra server hit needed.
 

matt.chugg

Moderator
Code:
Index: src/net/sourceforge/kolmafia/request/LoginRequest.java
===================================================================
--- src/net/sourceforge/kolmafia/request/LoginRequest.java	(revision 9844)
+++ src/net/sourceforge/kolmafia/request/LoginRequest.java	(working copy)
@@ -62,7 +62,9 @@
 		Pattern.compile( "There are currently <b>(.*?)</b> players logged in." );
 	private static final Pattern GRIMBO_PATTERN =
 		Pattern.compile( "(Elves Defeated:)</b></td><td class=small>([0-9,]+)</td></tr><tr><td class=small><b>(Elves Cured:)</b></td><td class=small>([0-9,]+)</td></tr><tr><td colspan=2 height=2 bgcolor=black></td></tr><tr><td class=small><b>(Penguins Defeated:)    </b></td><td class=small>([0-9,]+)</td></tr><tr><td class=small><b>(Penguins Bribed:)</b></td><td class=small>([0-9,]+)" );
-
+	private static final Pattern ANNOUNCEMENTS_PATTERN =
+		Pattern.compile( "p><b>(.*?)</b><br>(.*?)<" );
+	
 	private static boolean ignoreLoadBalancer = false;
 	private static LoginRequest lastRequest = null;
 	private static long lastLoginAttempt = 0;
@@ -166,6 +168,13 @@
 			KoLmafia.updateDisplay( LoginRequest.playersOnline + " players online." );
 		}
 
+		Matcher announcementsMatcher = LoginRequest.ANNOUNCEMENTS_PATTERN.matcher( this.responseText );
+		while ( announcementsMatcher.find() ) {
+			String d = announcementsMatcher.group( 1 );
+			String m = announcementsMatcher.group( 2 );
+			KoLmafia.updateDisplay( d + ": " + m );
+		}
+		
 		/*
 		playersMatcher = LoginRequest.GRIMBO_PATTERN.matcher( this.responseText );
 		if ( playersMatcher.find() )

the regex is intenionally matching half tags, since the html on page opens p tags, but never closes them so it has to match on the begining of the next opening one as a closing one, oo-er

Patch adds date: message to the cli for the messags shown on page, tptb keep these pretty tidy, 2 or 3 on page so just show them all. I agree with Veracity that a popup wouldn't be the best option, and think the cli is a good comprimise.
 
Last edited:

fronobulax

Developer
Staff member
You're right on the #users being printed in the gCLI and I'm pretty sure you've told me before. The reason I keep forgetting it is there is that my login script triggers a lot of gCLI output and by the time things stop scrolling, the number has scrolled out of the scrollback buffer. Workarounds exist, but they are somewhat dependent on timing and I figured if someone was actually going to reproduce the front page in an "in your face" kind of way, including the number of users would have made the display mildly useful for me. I suppose now I should investigate how the scrollback buffer size is set...
 
Top