diff options
Diffstat (limited to 'modules/jabber.module')
-rw-r--r-- | modules/jabber.module | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/modules/jabber.module b/modules/jabber.module index c16f1f419..d9417176f 100644 --- a/modules/jabber.module +++ b/modules/jabber.module @@ -12,7 +12,7 @@ function jabber_info($field = 0) { } } -function startElement($parser, $name, $attributes) { +function jabber_start($parser, $name, $attributes) { global $jabber; if ($attributes["ID"]) { @@ -24,10 +24,10 @@ function startElement($parser, $name, $attributes) { } } -function endElement($parser, $name) { +function jabber_end($parser, $name) { } -function characterData($parser, $data) { +function jabber_data($parser, $data) { global $jabber; $jabber["data"] = $data; @@ -77,8 +77,8 @@ function jabber_auth($username, $password, $server) { if ($session) { $xml_parser = xml_parser_create(); - xml_set_element_handler($xml_parser, "startElement", "endElement"); - xml_set_character_data_handler($xml_parser, "characterData"); + xml_set_element_handler($xml_parser, "jabber_start", "jabber_end"); + xml_set_character_data_handler($xml_parser, "jabber_data"); /* ** Switch the given socket descriptor '$session' to non-blocking mode: @@ -153,7 +153,24 @@ function jabber_auth_help() { <p>You may login to %s using a <b>Jabber ID</b>. The format of a Jabber ID is the same as an email address: <b>name</b><i>@server</i> An example of valid Jabber ID is <b>mwlily</b><i>@jabber.com</i>.</p> <p>Jabber is an <a href=\"http://www.opensource.org\">open source</a> instant messaging system designed to give the power of choice and freedom back to the users of instant messaging. By creating an extensible and powerful server and protocol, Jabber has succeeded in this goal. Not only does Jabber allow its users to use (and create) clients for numerous platforms, but it allows people to communicate to whomever they want in the way which is most convenient for them.</p>"; - return sprintf(t($output), $site); + return strtr(t($output), array("%s" => "<i>$site</i>")); +} + +function jabber_user($type, $edit, $user) { + $module = "jabber"; + $name = module_invoke($module, "info", "name"); + switch ($type) { + case "view_private": + $result = user_get_authname($user, $module); + $output .= form_item("$name ID", $result); + return $output; + case "edit_form": + $result = user_get_authname($user, $module); + $output .= form_textfield("$name ID", "authname_" . $module, $result, 30, 55, strtr(t("You may login to %s using a valid %id."), array("%s" => variable_get("site_name", "this web site"), "%id" => "<a href=\"module.php?mod=user&op=help#$module\">$name ID</a>"), "")); + return $output; + case "edit_validate": + return user_validate_authmap($user, $edit["authname_$module"], $module); + } } ?>
\ No newline at end of file |