--- pjirc.module 2007-03-23 14:42:30.000000000 -0700 +++ pjircnew.module 2007-05-26 23:53:43.000000000 -0700 @@ -1,165 +1,166 @@ -This module will display an IRC chatroom to users with the correct permissions.

-

To enable its use, a user needs the \"access pjirc\" permission.

-

You can set the server, room and guest name from the pjirc settings page.

-

To enable its use, a user needs the \"access irc\" permission.

", - array("%permissions" => url("admin/user/permission"), "%settings" => url("admin/settings/pjirc"), "%pjirc" => url("pjirc"))); - break; - case 'admin/modules#description': - $output = t("Allows you to have an IRC page using PJIRC."); - break; - } - return $output; -} - -/** - * Implementation of hook_perm(). - */ -function pjirc_perm() -{ - return array ("access irc"); -} - -/** - * Implementation of hook_settings(). - */ -function pjirc_admin() { - - $form['pjirc_nav_link'] = array( - '#type' => 'textfield', - '#title' => t('Navigation link text'), - '#default_value' => variable_get('pjirc_nav_link','chatroom'), - '#size' => 80, - '#maxlength' => 300, - '#description' => t('The text that will be shown in the navigation link'), - ); - - $form['pjirc_nick'] = array( - '#type' => 'textfield', - '#title' => t('Guest Nick Name'), - '#default_value' => variable_get('pjirc_nick','Guest'), - '#size' => 20, - '#maxlength' => 255, - '#description' => t('The username assigned to guests who have not logged into Drupal'), - ); - - $form['pjirc_server'] = array( - '#type' => 'textfield', - '#title' => t('IRC Server'), - '#default_value' => variable_get('pjirc_server','irc.freenode.net'), - '#size' => 20, - '#maxlength' => 255, - '#description' => t('The IP address or hostname of the IRC server you are connecting to.'), - ); - - $form['pjirc_room'] = array( - '#type' => 'textfield', - '#title' => t('IRC Room'), - '#default_value' => variable_get('pjirc_room', ''), - '#size' => 20, - '#maxlength' => 255, - '#description' => t('The IRC room you want to join initially. Should start with a # (eg: #myroom).'), - ); - - return system_settings_form($form); - -} - -/** - * Implementation of hook_menu(). - */ -function pjirc_menu($may_cache) { - global $user; - $items = array(); - if ($may_cache) { - - $items[] = array( - 'path' => 'admin/settings/pjirc', - 'title' => t("PJIRC Settings"), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('pjirc_admin'), - 'access' => user_access('access administration pages'), - 'type' => MENU_NORMAL_ITEM, - 'weight' => 0); - - $items[] = array( - 'path' => 'pjirc', - 'title' => t(variable_get("pjirc_nav_link", "chatroom")), - 'callback' => 'pjirc_page', - 'access' => user_access('access irc'), - 'weight' => 0); - } - return $items; -} - -/** - * Menu callback; displays a Drupal page PJIRC chatroom. - */ -function pjirc_page() { - $pjirc_nick = $user->uid ? $user->name : variable_get('pjirc_nick','Guest'); - $pjirc_server = variable_get('pjirc_server',''); - $pjirc_room = variable_get('pjirc_room',''); - $output = "
\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; - $output .= "

If the applet does not display then click here to download a Java client.\n"; - $output .= "

You can also connect using any IRC client (such as MIRC) using the following:
\n"; - $output .= "HOST: ".$pjirc_server."\n"; - $output .= "CHANNEL: ".$pjirc_room."\n"; - $output .= "
\n"; - - print theme('page', $output); -} - -?> +This module will display an IRC chatroom to users with the correct permissions.

+

To enable its use, a user needs the \"access pjirc\" permission.

+

You can set the server, room and guest name from the pjirc settings page.

+

To enable its use, a user needs the \"access irc\" permission.

", + array("%permissions" => url("admin/user/permission"), "%settings" => url("admin/settings/pjirc"), "%pjirc" => url("pjirc"))); + break; + case 'admin/modules#description': + $output = t("Allows you to have an IRC page using PJIRC."); + break; + } + return $output; +} + +/** + * Implementation of hook_perm(). + */ +function pjirc_perm() +{ + return array ("access irc"); +} + +/** + * Implementation of hook_settings(). + */ +function pjirc_admin() { + + $form['pjirc_nav_link'] = array( + '#type' => 'textfield', + '#title' => t('Navigation link text'), + '#default_value' => variable_get('pjirc_nav_link','chatroom'), + '#size' => 80, + '#maxlength' => 300, + '#description' => t('The text that will be shown in the navigation link'), + ); + + $form['pjirc_nick'] = array( + '#type' => 'textfield', + '#title' => t('Guest Nick Name'), + '#default_value' => variable_get('pjirc_nick','Guest'), + '#size' => 20, + '#maxlength' => 255, + '#description' => t('The username assigned to guests who have not logged into Drupal'), + ); + + $form['pjirc_server'] = array( + '#type' => 'textfield', + '#title' => t('IRC Server'), + '#default_value' => variable_get('pjirc_server','irc.freenode.net'), + '#size' => 20, + '#maxlength' => 255, + '#description' => t('The IP address or hostname of the IRC server you are connecting to.'), + ); + + $form['pjirc_room'] = array( + '#type' => 'textfield', + '#title' => t('IRC Room'), + '#default_value' => variable_get('pjirc_room', ''), + '#size' => 20, + '#maxlength' => 255, + '#description' => t('The IRC room you want to join initially. Should start with a # (eg: #myroom).'), + ); + + return system_settings_form($form); + +} + +/** + * Implementation of hook_menu(). + */ +function pjirc_menu($may_cache) { + global $user; + $items = array(); + if ($may_cache) { + + $items[] = array( + 'path' => 'admin/settings/pjirc', + 'title' => t("PJIRC Settings"), + 'callback' => 'drupal_get_form', + 'callback arguments' => array('pjirc_admin'), + 'access' => user_access('access administration pages'), + 'type' => MENU_NORMAL_ITEM, + 'weight' => 0); + + $items[] = array( + 'path' => 'pjirc', + 'title' => t(variable_get("pjirc_nav_link", "chatroom")), + 'callback' => 'pjirc_page', + 'access' => user_access('access irc'), + 'weight' => 0); + } + return $items; +} + +/** + * Menu callback; displays a Drupal page PJIRC chatroom. + */ +function pjirc_page() { + $pjirc_nick = $user->uid ? $user->name : variable_get('pjirc_nick','Guest'); + $pjirc_server = variable_get('pjirc_server',''); + $pjirc_room = variable_get('pjirc_room',''); + $pjirc_mod_path = drupal_get_path('module', 'pjirc'); + $output = "
\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + $output .= "

If the applet does not display then click here to download a Java client.\n"; + $output .= "

You can also connect using any IRC client (such as MIRC) using the following:
\n"; + $output .= "HOST: ".$pjirc_server."\n"; + $output .= "CHANNEL: ".$pjirc_room."\n"; + $output .= "
\n"; + + print theme('page', $output); +} + +?>