In file useracc.h:

int usr_uidxref

(char* userid, int online)

User ID completion.

Documentation

User ID completion.

Completes A partially specified user ID, offering a menu of similar user IDs if the given ID was ambiguous. This function has two side effects:

Partial user IDs of less than three characters will not even be considered. Most systems have huge numbers of users with the same first couple of letters.

If the partial user ID is found to be online, it is canonicalised and the function returns immediately. The user's shared segment is also attached.

Otherwise, the user ID is completed by building a list of all user IDs starting with the supplied user ID. If the list has only one member, the function returns it (and attaches the user's shared segment, if online).

If more than one user IDs match the partial, provided ID, the user is presented with a menu of the matching user IDs. At this point, the user can either select one of those user IDs by number, or enter an altogether new (possibly partial) user ID and the function will begin all over again. At any rate, if the user selects a user ID, the name is returned and the other user's shared segment is attached, if that user is online. Complicated, eh?

Oh, by the way, this function ends command concatenation if it is forced to present a menu. This makes sense, because the user wasn't expecting this, and it's probably best to not make any potentially dangerous assumptions about the operation being performed.

This completion function should be used wherever the system asks for (or expects) a user ID. The get_userid() high-level input function uses it. Even normally non-interactive parts of the system use it, like the page global command (/p). I thoroughly recommend duplicating this behaviour for any other strings that can be numerous, long and/or complicated.

Parameters:
- userid A partially specified user ID. After successful completion of this function, the canonical form of the full user ID will overwrite this argument.
online - If non-zero, the function will only consider users currently on-line for completion, ignoring all other users.
Returns:
Zero if the user pressed X at the user ID selection menu. If this occurs, you should cancel whatever operation is in progress. If all went well and a user ID was located, a value of one is returned.

Alphabetic index



This page was generated with the help of DOC++.