Login splash screen token %users renders incorrectly

Bug #164664 reported by Cody A.W. Somerville
4
Affects Status Importance Assigned to Milestone
Sapidlib
Fix Committed
Low
DaelasKai

Bug Description

During the login process, several "splash" screens are showed to the user (ie. initial login, motd, new user), etc. The login object parses certain tokens in these screens (simply text files) to allow for dynamic splash screens. One of these tokens is %users which should list the logged in users. However, it does not do this correctly. If no one is logged in, it shows as ", and 0" and when there is people logged in, it is always "user1, user2, user3, and 0".

The code for this is located at lib/adm/objs/login.c at the bottom.

Revision history for this message
DaelasKai (aishiteru) wrote :

Do we really need to have this token in the startup pages?
Most players would type "who" right away anyway plus with
50 plus users on an active mud, it would clutter up the screen
with useless info. I think number of users would be sufficient.

Daelas

Revision history for this message
Cody A.W. Somerville (cody-somerville) wrote :

I think you misunderstand. In the text that is displayed during login, certain tokens are replaced by the login object to allow for the splash screens to be easier to maintain/dynamic. Yes, currently we do use the %users token in our default motd which I think I'll keep (and ensure all tags are used really to ensure they all work). However, it does not work correctly ATM (hence there is a bug to correct). Regardless if people will use this tag, it is still broken and is an easy fix. :]

Changed in sapidlib:
importance: Undecided → Low
status: New → Confirmed
DaelasKai (aishiteru)
Changed in sapidlib:
assignee: nobody → aishiteru
status: Confirmed → In Progress
Revision history for this message
Water (daethmystic) wrote :

The problem with the %users token seems to be that it recognizes the init player and counts it towards players online (when it should not.) Anyone that doesn't have a full body and is currently connected to the mud (filter out link-dead people too) should not be included on the list (hence why when there is noone on you get the awful " , and 0 "...which also needs to be fixed to "gooder engrish" if it only finds less than 2 players online.)

Revision history for this message
Cody A.W. Somerville (cody-somerville) wrote :

------------------------------------------------------------
revno: 23
committer: Cody A.W. Somerville <email address hidden>
branch nick: sapidlib.trunk
timestamp: Tue 2007-12-04 15:12:09 -0400
message:
    * Merged in branch ~sapidlib-dev/sapidlib/login-tokens
        * Rewrote token parsing in the login object
        * Closes bug #164664 (lp: #164664)
    ------------------------------------------------------------
    revno: 22.1.3
    committer: Cody A.W. Somerville <email address hidden>
    branch nick: login-tokens
    timestamp: Tue 2007-12-04 14:39:02 -0400
    message:
      Cleaned up code for merge
    ------------------------------------------------------------
    revno: 22.1.2
    committer: Joseph von Arx <email address hidden>
    branch nick: DaelasKai
    timestamp: Thu 2007-11-29 22:01:53 -0600
    message:
      Daelas modified login.c to use a dynamic parser for the login
      pages. The login file now checks every token file in
      /adm/obj/login-tokens and processes the tokens using each of those
      files as a reference.
    ------------------------------------------------------------
    revno: 22.1.1
    committer: Joseph von Arx <email address hidden>
    branch nick: devel
    timestamp: Thu 2007-11-29 17:49:56 -0600
    message:
      I revised how the parseTokens was working. Rather than parseTokens()
      at the beginning, I changed it to parseTokens() on each of the appropriate
      write()'s. Also added in a function instead of the (: :) since it was not
      taking into consideration if there was only one user.

Changed in sapidlib:
status: In Progress → Fix Committed
Revision history for this message
Richard Thomas Harrison (harrison-rt) wrote :

In my alpha branch, I overrode the users() efun not to return users without an environment.
Found in /adm/simul_efun/user.c

mixed array users()
{
    object array new_users = ({ });

    if(sizeof(efun::users()))
        foreach(mixed o_user in efun::users())
            if(objectp(o_user) && environment(o_user))
            {
                object array tmp = new_users - ({ o_user });
                new_users = tmp + ({ o_user });
            }

    return copy(new_users);
}

I also modified /adm/obj/login-tokens/user_count.c to be more sane on what it
parses %user_count to. This means that if you are the first on or there are no
other users on currently, then it will return "no", otherwise it will return the
number of users on (not including those logging in).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.