LPMuds.net
February 09, 2010, 12:20:09 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: This is the forum page. For the main LPMuds page, visit http://lpmuds.net
 
   Home   SITE FAQ INTERMUD DOWNLOADS LINKS Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Remote who formatting for DIKU mudlib types.  (Read 507 times)
Tricky
BFF
***
Offline Offline

Posts: 168


I like what I code and I code what I like!


View Profile
« on: August 21, 2008, 05:59:19 PM »

DIKU derivatives return remote who information in a way that breaks formatting for DS libs. This bit of code will deal with them.

Find the function eventReceiveWhoReply in /daemon/services/who.c and replace it with this...

Code:
void eventReceiveWhoReply(mixed *packet) {
    mapping mudlist;
    string list, *who, tmp;
    object ob;

    if( file_name(previous_object()) != INTERMUD_D ) return;
    if( !packet[5] || !(ob = find_player(convert_name(eventLookupUser(packet[5])))) ) return;
    list = "%^MAGENTA%^Remote who information from " + packet[2] + ":%^RESET%^\n";
    mudlist = INTERMUD_D->GetMudList();
    foreach(who in packet[6]){
        mixed wtf;
        if(intp(who[1])) wtf = to_int(who[1]);

        /* Emerald MUD */
        if( who[1] == "never" )
            list += implode(explode(who[2], "\n")[1..<1], "\n") + "%^RESET%^\n";
        /* AFK I3 Driver who-reply */
        else if( wtf < 0 )
            list += who[0] + " " + who[2] + "%^RESET%^\n";
        else if( wtf == 9999 )
            list += who[0] + " " + who[2] + "%^RESET%^\n\n";
        else if( wtf == 2 * 9999 )
            list += "\n" + who[0] + " " + who[2] + "%^RESET%^\n";
        else if( wtf == 3 * 9999 )
            list += "\n" + who[0] + " " + who[2] + "%^RESET%^\n\n";
        /* Check for names with a <SPC> in them. Generally means it is a header in who[2]. */
        else if( strsrch(who[0], " ") != -1
          && ( strsrch(lower_case(mudlist[packet[2]][5]), "circle") != -1
           ||  strsrch(lower_case(mudlist[packet[2]][7]), "afkmud") != -1 ) )
            list += "* %^BOLD%^" + who[2] + "%^RESET%^\n";
        /* Regular I3 who-reply */
        else{
            if(wtf < 6) tmp = "not";
            else tmp = time_elapsed(wtf);
            list +=  who[0] + " (" + tmp + " idle): " + who[2] +"\n";
        }
    }
    ob->eventPrint(list);
    tn("eventReceiveWhoReply: "+identify(packet),"blue");
}

Then just reload the lib with a warmboot (warn your users of course :) ).

Tricky
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!