Knowledgebase
Knowledgebase: Integration & API
Link code parameters
Posted by Chris Duerr on 08 January 2012 09:37 PM

Advanced users and web developers may use code parameters to pass additional instructions to AddonChat chat clients.

For example, you may wish to instruct your chat room to automatically sign a user whose name is stored in a session cookie on your site. Or, you may simply wish to set up a secondary chat page with a different default room name. 

Code Parameters

The following code parameters may be passed to the chat client launch script (chat.js) by configuring the addonchat_param variable as shown in the example below the table.

Parameter Name Type Description
autologin Boolean Automatic login
username String Default user name
password String Default user password
subroom String Default room name
timestamp Boolean Enable/disable timestamp
audio Boolean Enable/disable audio
mycolor Color Default user color
myfont Font Default user font
url_exit_enable Boolean Enable exit URL
url_exit URL Specify exit URL
user_show_emoticons Boolean Enable/disable emoticons
user_show_enhanced Boolean Enable/disable markup
user_show_avatar Boolean Enable/disable avatars
user_ignore_im Boolean Ignore instant messages
username_prompt_readonly Boolean Make username prompt Read-Only
bgcolor Color Specify background color
password_prompt_readonly Boolean Make password prompt read-only
password_prompt_after_initial Boolean Show password prompt after failed login
login_prompt_after_autologin Boolean Prompt for username/password after failed auto-login
iconsize Integer Specify default icon size
(0:16x16, 1:24x24, 2:32x32)
subroom_single Boolean Only show current room in user list
(enterprise only)
panel_start  String

Can be one of 'password', 'register', 'verify' or 'loginPanel'. Option is used to change the default start-up panel (loginPanel).

 'password' : Retrieve lost password panel.

'register' : Register new user account panel.

'verify' : Verify new user account panel.

'loginPanel' : Sign-in panel.

Code parameters are added just before var addonchat in your link code, or they can be placed just after the addonchat JavaScript object.

Code parameters will override your control panel settings, and any user settings that may have been saved within browser cookies. Depending upon your control panel settings, some items can be changed by the user after they have logged in.

Some parameters are only available with Professional PLUS or Enterprise edition chat rooms. Additionally, some clients (e.g., the iPhone mobile client) may only use a subset of the full code parameter list.

The following parameter types are used in code parameters:
  • Boolean
    Boolean type entries (e.g., audio), should be specified as either true or false. Values of 1, "on", or "yes" may be used in place of true, and values of 0, "off", or "no" may be used in place of false.
  • String
    String values may contain any valid ASCII or UTF-8 character code sequence. String values must be placed within quotation marks.
  • Integer
    Positive or (if applicable) negative number. Integer values need not be placed within quotation marks.
  • Dimension
    Positive integer to indicate a dimension (height or width) in pixels, or a percentage ("1%" to "100%") value. Percentage dimensions values must be enclosed in quotation marks.
  • Color
    Color values should be in 6 digit RGB hexadecimal format; the same as used in the control panel. A leading hash (#) is required for the bgcolor and boxbgcolor parameters. Color values must be placed within quotation marks.
  • Font
    Font values should be of the form Name-Style-Size; where Name is any valid system font name; Style is one of PLAIN, BOLD, ITALIC or BOLD+ITALIC; and size is a positive integer no larger than 48. Font values must be placed within quotation marks.
  • URL
    URL values must be valid, fully qualified uniform resource locators. URL values typically contain world wide web site addresses. URL values must be placed within quotation marks.
Code Parameter Example #1
The following example will automatically log in a user with a user name of John using password 12345. The user's color will be set to black (#000000), and the user's display font will be set to a plain 13 pixel Verdana. A URL exit is enabled and set to launch www.addonchat.com.
  /* Code parameters are added just before (or after)
"var addonchat" in your link code */

var addonchat_param = {
username: "John",
password: "12345",
autologin: true,
mycolor: "#000000",
myfont: "Verdana-PLAIN-13",
url_exit_enable: true,
url_exit: "http://www.addonchat.com"
}
Code Parameter Example #2
To illustrate where the addonchat_param object may be placed, below is another example which contains a user's full link code. This example merely specifies that audio be disabled by default:
<script type="text/javascript">/*<![CDATA[*/
var addonchat = {
server:0, id:8847, width:"625",
height:"380", language:"en" }

/* Insert your custom code parameter(s) here: */

var addonchat_param = {
audio: false
}

/* ]]> */</script>
<script type="text/javascript"
src="http://client0.addonchat.com/chat.js"></script><noscript>
To enter this chat room, please enable JavaScript in your web
browser. This <a href="http://www.addonchat.com/">Chat
Software</a> requires Java: <a href="http://www.java.com/">Get
Java Now</a>
</noscript>

The subroom and subroom_single parameters can only be used with Enterprise edition accounts. When used in conjunction with the autologinusername, and password parameters, the subroom parameter can be used to automatically log a user in and place him/her in a specific room.

Direct Link Parameters

If you choose to make use of the the popup kink, simple link, or direct link (no website) options, you may also make use of code parameters by passing slightly modified URL-encoded code parameters as CGI GET parameters (examples provided).

The popup Link, simple Link and direct Link options all call a script called chat.php (or sc.php, or sc.pl in legacy codes which now all redirect to chat.php).

Parameter names passed to the direct link are the exact same as the standard code parameters except that they must all be prefixed with param_, with the exception of the additional optional parameters listed below:

Parameter Name Type Description
lang_code String ISO-639-1 Language Code
(e.g., "en", "en_uk", "de", etc..)
fs - Use full browser screen to display chat room
applet_height Dimension Chat Room Height (when applicable)
applet_width Dimension Chat Room Width (when applicable)
color_applet_foreground Color [Presently not used]
color_applet_background Color Page background color
text_applet_title String Page Title

If you are using the direct link (no website), we recommend that code parameters be kept to a minimum for clarity.

Direct Link Parameter Example #1
The following example sets the language to Dutch for the end-user, and displays the chat room such that it uses the entire browser window space. The code below that is not displayed in red will vary from account to account and should be disregarded.

http://client0.addonchat.com/chat.php?id=8847&lang_code=nl&fs
Direct Link Parameter Example #2
The following example parameter code will attempt to automatically log a user in with the name 'Lisa Lee'. In this example, we did not include your unique chat.php link:

&param_username=Lisa+Lee&param_autologin=true

When using direct links, be certain to observe the following rules:

  • Direct link code parameters should be prefixed with param_
    The only exception to this rule is when using one of the direct-link specific parameters listed above.
  • Direct link code parameter values are never be enclosed in quotation marks.
  • Direct link code parameters should be URL encoded.

Direct link code parameters may also be passed via the CGI POST method.

Applet Parameters

If you are using the legacy (pre v8.6) link code, or have opted to use the current link code for JavaScript-disabled browsers, the following parameters may be passed directly to the Java chat applet:

Parameter Name Type Description
autologin Boolean Automatic login
username String Default user name
password String Default user password
subroom String Default subroom
timestamp Boolean Enable/disable timestamp
audio Boolean Enable/disable audio
mycolor Color Default user color
myfont Font Default user font
url.exit.enable Boolean Enable exit URL
url.exit URL Specify exit URL
user.show.emoticons Boolean Enable/disable emoticons
user.show.enhanced Boolean Enable/disable markup
user.show.avatar Boolean Enable/disable avatars
user.ignore.im Boolean Ignore instant messages
username.prompt.readonly Boolean Make username prompt Read-Only
bgcolor Color Specify background color
boxbgcolor Color Specify Java Loading Background Color
password.prompt.readonly Boolean Make password prompt read-only
password.prompt.after.initial Boolean Show password prompt after failed login
login.prompt.after.autologin Boolean Prompt for username/password after failed auto-login
iconsize Integer Specify default icon size
(0:16x16, 1:24x24, 2:32x32)
subroom.single Boolean Only show current room in user list
(enterprise only)

Applet parameters should be placed just before the </applet> portion of the link code.

Note that applet parameters (with the exception of a few additional options) are identical to that of code parameters, with periods (.) replacing underscores (_) in all parameter names. Additionally, all parameter values must always be enclosed in quotation marks; including boolean types.

Applet parameter types are identical to code parameter types.

If you are using the JavaScript-disabled link code (which includes both the JavaScript link code and the Applet link code) you should ensure that your JavaScript code parameters are synchronized with your applet parameters.

Applet Parameter Example
The following applet parameter example will automatically log in a user with a user name of John using password 12345. The user's color will be set to black (#000000), and the user's display font will be set to a plain 13 pixel Verdana. A URL exit is enabled and set to launch www.addonchat.com.
   <param name="username" value="John">
<param name="password" value="12345">
<param name="autologin" value="true">
<param name="mycolor" value="#000000">
<param name="myfont" value="Verdana-PLAIN-13">
<param name="url.exit.enable" value="true">
<param name="url.exit" value="http://www.addonchat.com">
(9 vote(s))
This article was helpful
This article was not helpful

Comments (0)