/sources/chat.php

Description
Functions
chatter_active (line 695)

Find whether a member is active in chat (i.e. not away).

  • return: Whether the member is active
boolean chatter_active (MEMBER $member_id, [?AUTO_LINK $room_id = NULL])
  • MEMBER $member_id: Member ID
  • ?AUTO_LINK $room_id: Room ID (NULL: lobby)
chat_convert_html_entities (line 1511)

Takes a chat message, and converts some characters from HTML entities into proper characters.

  • return: Parsed chat message
string chat_convert_html_entities (string $string)
  • string $string: Chat message to be parsed
chat_get_all_rooms (line 1119)

Get an array of all the chatrooms.

  • return: An array of all the chatrooms
array chat_get_all_rooms ()
chat_get_room_content (line 1143)

Get a multidimensional array of the content of the specified chatroom. It automatically parses for comcode, chatcode, banned words, smilies, and uses complex logic to decide whether or not to show each message; based upon who the member is, the message content, and other such inputs.

If you set the $dereference flag, all the messages will be dereferenced for you, and if you set the $downloading flag, the array is returned in a format appropriate for things like downloading the chat logs. $start and $finish are used to cutoff the number of messages returned, based on their posting date and time, and the $uptoid variable is used to make the function only return the messages newer than the id specified.

  • return: An array of all the messages collected according to the search criteria
array chat_get_room_content (AUTO_LINK $room_id, array $_rooms, [?integer $cutoff = NULL], [boolean $dereference = false], [boolean $downloading = false], [?integer $start = NULL], [?integer $finish = NULL], [?integer $uptoid = NULL], [?ID_TEXT $zone = NULL], [?AUTO_LINK $entering_room = NULL], [boolean $return_my_messages = true], [boolean $return_system_messages = true])
  • AUTO_LINK $room_id: The room ID (-1 for IM)
  • array $_rooms: Rooms database rows that we'll need
  • ?integer $cutoff: The maximum number of messages to be returned (NULL: no maximum)
  • boolean $dereference: Whether to dereference the returned messages
  • boolean $downloading: Whether to return the messages in a downloadeable format (using the templates for log downloading)
  • ?integer $start: The datetime stamp to start gathering messages from (NULL: all)
  • ?integer $finish: The datetime stamp to stop gathering messages at (NULL: current time)
  • ?integer $uptoid: The lowest message ID to return (NULL: no special lowest number)
  • ?ID_TEXT $zone: The zone the chat module is in (NULL: find it)
  • ?AUTO_LINK $entering_room: The language ID for the "entering room" message (NULL: not entering the room)
  • boolean $return_my_messages: Return the current user's messages?
  • boolean $return_system_messages: Return system messages
chat_logs_script (line 282)

Pass out chat log files.

void chat_logs_script ()
chat_post_message (line 1033)

Enter a message into the database for the specified room, and with the specified parameters. The message is filtered for banned words, and is compressed into a tempcode storage format.

  • return: Whether the message was successfully posted or not
boolean chat_post_message (AUTO_LINK $room_id, LONG_TEXT $message, SHORT_TEXT $font_name, SHORT_TEXT $text_colour, [SHORT_INTEGER $wrap_pos = 60])
  • AUTO_LINK $room_id: The room ID for the message to be posted in
  • LONG_TEXT $message: The message body
  • SHORT_TEXT $font_name: The font name for the message
  • SHORT_TEXT $text_colour: The text colour for the message
  • SHORT_INTEGER $wrap_pos: The wrap position for the message
chat_room_prune (line 378)

Prune membership of chat room.

void chat_room_prune (AUTO_LINK $room_id, array $room_row)
  • AUTO_LINK $room_id: Room ID (or -1 if all rooms)
  • array $room_row: The room row
check_chatroom_access (line 1524)

Check whether a member has access to the chatroom.

  • return: Whether the current member has access to the chatroom
boolean check_chatroom_access (mixed $room, [boolean $ret = false], [?MEMBER $member_id = NULL])
  • mixed $room: The row of the chat room to check for access OR it's ID (AUTO_LINK)
  • boolean $ret: Whether to return false if there is no access (as opposed to bombing out)
  • ?MEMBER $member_id: The member to check as (NULL: current member)
enter_chat_lobby (line 902)

Enter the current member to the chat lobby / Mark them available.

void enter_chat_lobby ()
filter_invites_for_blocking (line 356)

Filter an invite list to make sure people who are blocking don't get drawn in and hence their blocking unmasked.

  • return: Filtered comma-separated people list
string filter_invites_for_blocking (string $people)
  • string $people: Comma-separated people list
get_chatroom_id (line 1016)

Get the id of the specified chatroom, from its room name.

  • return: The ID of the chatroom (NULL: no such chat room)
?AUTO_LINK get_chatroom_id (SHORT_TEXT $room_name, [boolean $must_not_be_im = false])
  • SHORT_TEXT $room_name: The name of the chatroom
  • boolean $must_not_be_im: Make sure the room is not an IM room. If it is an IM room, pretend it does not exist.
get_chatroom_name (line 1000)

Get the textual name of the specified chatroom, from its room id.

  • return: The room name (NULL: not found)
?SHORT_TEXT get_chatroom_name (AUTO_LINK $room_id, [boolean $allow_null = false])
  • AUTO_LINK $room_id: The room ID
  • boolean $allow_null: Allow the chatroom to not be found (i.e. don't die if it can't be)
get_chatters_in_room (line 931)

Get the people who have posted a message in the specified room within the last x minutes (defaults to five). Note that this function performs no pruning- the chat lobby will do that. It does do an activity time-range select though.

  • return: A map of members in the room. User ID=>Username
array get_chatters_in_room (?AUTO_LINK $room_id)
  • ?AUTO_LINK $room_id: The room ID (NULL: lobby)
get_chatters_in_room_tpl (line 957)

Get some template code showing the number of chatters in a room.

  • return: The Tempcode
tempcode get_chatters_in_room_tpl (array $users)
  • array $users: A mapping (user=>username) of the chatters in the room
get_chat_sound_tpl (line 1707)

Get a template that will set up the chat sound effects as for what this member needs.

  • return: Template to set up chat sound effects.
tempcode get_chat_sound_tpl ()
get_effect_set (line 1618)

Get the list of all available chat sound effects.

  • return: All available sound effects (mapping between base code, and actual code).
map get_effect_set ([boolean $only_overridable = false])
  • boolean $only_overridable: Map to NULL if it is not overridable.
get_effect_settings (line 1642)

Get a list of template mappings for the current member, between sound effect IDs and the URLs to the mp3 fiels.

  • return: The template mappings.
array get_effect_settings ([boolean $full_urls = false], [?MEMBER $for_member = NULL], [boolean $all_members = false])
  • boolean $full_urls: Whether to use full URLs in the mappings.
  • ?MEMBER $for_member: Get settings overridden for this specific member (NULL: global settings).
  • boolean $all_members: Get global settings and settings overridden for all members (if this is true we'd expect $for_member to be NULL).
handle_chatroom_pruning (line 1593)

Prune timed-out private chatrooms.

  • return: Whether the room was pruned
boolean handle_chatroom_pruning (array $row)
  • array $row: The row of the chat room to possibly prune
init__chat (line 24)

Standard code module initialisation function.

void init__chat ()
is_chat_moderator (line 716)

Find whether a member is a moderator of a chat room.

  • return: Whether the member is a moderator of the chat room
boolean is_chat_moderator (MEMBER $member_id, AUTO_LINK $room_id, ?MEMBER $room_owner)
  • MEMBER $member_id: Member ID
  • AUTO_LINK $room_id: Room ID
  • ?MEMBER $room_owner: Room owner (NULL: none)
member_befriended (line 198)

Find if a member is befriended by the current member.

  • return: Whether the member is befriended
boolean member_befriended (MEMBER $member_id)
  • MEMBER $member_id: The member being checked
messages_script (line 43)

High-level messages script handling

void messages_script ()
parse_allow_list_input (line 1484)

Takes a comma-separated list of usernames, split it up, convert all the usernames to IDs, and put it all back together again.

  • return: A comma-separated list of member IDs
string parse_allow_list_input (string $_allow)
  • string $_allow: A comma-separated list of usernames
shoutbox_script (line 219)

Outputs the shoutbox iframe.

  • return: Output (NULL: outputted it already)
?object shoutbox_script ([boolean $ret = false], [?AUTO_LINK $room_id = NULL], [?integer $num_messages = NULL])
  • boolean $ret: Whether to get the output instead of outputting it directly
  • ?AUTO_LINK $room_id: Chat room ID (NULL: read from environment)
  • ?integer $num_messages: The maximum number of messages to show (NULL: read from environment)
_chat_messages_script_ajax (line 448)

Output messages (in XML format) from up to five minutes ago (give somebody who's just joined the chatroom some chat backlog), or the messages posted since the last check.

void _chat_messages_script_ajax (AUTO_LINK $room_id, [boolean $backlog = false], [?AUTO_LINK $message_id = NULL], [?AUTO_LINK $event_id = NULL], [string $events_output = ''])
  • AUTO_LINK $room_id: Room ID (or -1 to mean 'all' as used for IM global process, -2 to mean none)
  • boolean $backlog: Output the backlog?
  • ?AUTO_LINK $message_id: Latest received message ID (NULL: we're not getting latest messages)
  • ?AUTO_LINK $event_id: Latest event ID (NULL: we're not getting events, but we do request a null event so we can use that as a future reference point)
  • string $events_output: Events output to append
_chat_post_message_ajax (line 730)

Handle an AJAX message posting request.

void _chat_post_message_ajax (AUTO_LINK $room_id, string $message, string $font, string $colour, BINARY $first_message)
  • AUTO_LINK $room_id: Room ID
  • string $message: The message
  • string $font: Font name
  • string $colour: Font colour
  • BINARY $first_message: Whether this is the first message sent out to this room, since some change
_deal_with_chatcode_invite (line 1374)

Parse invitation chat code tag.

  • return: A pair: whether the message was deleted, and the new text of the message
array _deal_with_chatcode_invite (string $pm_user, string $pm_message, SHORT_TEXT $username, string $text, ID_TEXT $zone)
  • string $pm_user: Comma-separated list of members to invite
  • string $pm_message: The room name
  • SHORT_TEXT $username: The username of who made this chatcode
  • string $text: The text we are using
  • ID_TEXT $zone: The zone the chat module is in
_deal_with_chatcode_newroom (line 1417)

Parse room creation chat code tag.

  • return: A pair: whether the message was deleted, and the new text of the message
array _deal_with_chatcode_newroom (string $pm_user, string $pm_message, SHORT_TEXT $username, string $text, ?integer $cutoff)
  • string $pm_user: The room name
  • string $pm_message: Comma-separated list of members to allow in
  • SHORT_TEXT $username: The username of who made this chatcode
  • string $text: The text we are using
  • ?integer $cutoff: The maximum number of messages to be returned (NULL: no maximum)
_deal_with_chatcode_private (line 1312)

Parse private message chat code tag.

  • return: A pair: whether the message was deleted, and the new text of the message
array _deal_with_chatcode_private (string $pm_user, string $pm_message, SHORT_TEXT $username, string $text, AUTO_LINK $room_id, BINARY $system_message)
  • string $pm_user: The member a private message should be sent to
  • string $pm_message: The private message
  • SHORT_TEXT $username: The username of who made this chatcode
  • string $text: The text we are using
  • AUTO_LINK $room_id: The room ID the message is in
  • BINARY $system_message: Whether this is within a system message
_deal_with_chatcode_tags (line 1288)

Parse chat code tags (called multiple times, for each tag).

  • return: A pair: whether the message was deleted, and the new text of the message
array _deal_with_chatcode_tags (string $text, string $tag, string $pm_user, string $pm_message, SHORT_TEXT $username, ?integer $cutoff, ID_TEXT $zone, AUTO_LINK $room_id, BINARY $system_message)
  • string $text: The text we are using
  • string $tag: The tag name we are parsing
  • string $pm_user: 1st param
  • string $pm_message: 2nd param
  • SHORT_TEXT $username: The username of who made this chatcode
  • ?integer $cutoff: The maximum number of messages to be returned (NULL: no maximum)
  • ID_TEXT $zone: The zone that our chat module is in
  • AUTO_LINK $room_id: The room ID the message is in
  • BINARY $system_message: Whether this is within a system message
_remove_empty_messages (line 1468)

Remove any messages from the list of messages that aren't mentioned in the list of message IDs.

  • return: A new list of messages
array _remove_empty_messages (array $messages, array $message_ids)
  • array $messages: Original list of messages
  • array $message_ids: List of message IDs to keep

Documentation generated on Sun, 02 Jan 2011 23:10:41 +0000 by phpDocumentor 1.4.3