Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.i18n.php |
— | — | @@ -22,6 +22,8 @@ |
23 | 23 | 'onlinestatusbar-used' => 'Display your online status on your user pages', |
24 | 24 | // Message in config asking what status they want to use |
25 | 25 | 'onlinestatusbar-status' => 'What is the default status you wish to use:', |
| 26 | + // Message in config about away time |
| 27 | + 'onlinestatusbar-away' => 'Treat as away automaticaly after $1 minutes', |
26 | 28 | // Message in config asking if user wants to purge the user page |
27 | 29 | 'onlinestatusbar-purge' => 'Purge user page everytime when you login or logout', |
28 | 30 | // Section for config |
— | — | @@ -51,6 +53,7 @@ |
52 | 54 | 'onlinestatusbar-purge' => 'Option to purge user page everytime they login so that magic word is updated', |
53 | 55 | 'prefs-onlinestatus' => 'Section for config, located in preferences - misc', |
54 | 56 | 'onlinestatusbar-hide' => 'Ask user if they want to hide status bar this is useful when they are using custom template but need to check if they are online', |
| 57 | + 'onlinestatusbar-away' => 'Time in minutes how long to wait until user is flagged as away', |
55 | 58 | 'onlinestatusbar-status-online' => 'Status for users who mark themselves as active', |
56 | 59 | 'onlinestatusbar-status-busy' => 'Status for users who mark themselves as busy', |
57 | 60 | 'onlinestatusbar-status-away' => 'Status for users who mark themselves as away', |
Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.status.php |
— | — | @@ -98,6 +98,10 @@ |
99 | 99 | if ( $result < wfTimestamp( TS_MW, $w_time ) ) { |
100 | 100 | $status = 'write'; |
101 | 101 | } |
| 102 | + } else if ( $user->getOption( 'OnlineStatusBar_away', true ) == true ) { |
| 103 | + if ( $result < wfTimestamp( TS_MW, OnlineStatusBar::getTimeoutDate( false, true ) ) ) { |
| 104 | + $status = 'away'; |
| 105 | + } |
102 | 106 | } |
103 | 107 | } else { |
104 | 108 | $status = $wgOnlineStatusBarDefaultOnline; |
Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.body.php |
— | — | @@ -131,9 +131,13 @@ |
132 | 132 | /** |
133 | 133 | * @return timestamp |
134 | 134 | */ |
135 | | - public static function getTimeoutDate( $delayed = false ) { |
136 | | - global $wgOnlineStatusBar_WriteTime, $wgOnlineStatusBar_LogoutTime; |
| 135 | + public static function getTimeoutDate( $delayed = false, $away = false ) { |
| 136 | + global $wgOnlineStatusBar_AwayTime, $wgOnlineStatusBar_WriteTime, $wgOnlineStatusBar_LogoutTime; |
137 | 137 | |
| 138 | + if ($away) { |
| 139 | + return wfTimestamp( TS_UNIX ) - $wgOnlineStatusBar_AwayTime; |
| 140 | + } |
| 141 | + |
138 | 142 | if ($delayed) { |
139 | 143 | return wfTimestamp( TS_UNIX ) - $wgOnlineStatusBar_WriteTime; |
140 | 144 | } |
Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.php |
— | — | @@ -109,6 +109,8 @@ |
110 | 110 | $wgOnlineStatusBarDefaultEnabled = false; |
111 | 111 | // how long to wait until user is considered as offline |
112 | 112 | $wgOnlineStatusBar_LogoutTime = 3600; |
| 113 | +// time to wait until we consider user away |
| 114 | +$wgOnlineStatusBar_AwayTime = 20 * 60; // 20 minutes |
113 | 115 | |
114 | 116 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'OnlineStatusBarHooks::ckSchema'; |
115 | 117 | $wgHooks['UserLogoutComplete'][] = 'OnlineStatusBarHooks::logout'; |
Index: trunk/extensions/OnlineStatusBar/OnlineStatusBarHooks.php |
— | — | @@ -101,9 +101,10 @@ |
102 | 102 | * @return bool |
103 | 103 | */ |
104 | 104 | public static function preferencesHook( User $user, array &$preferences ) { |
105 | | - global $wgOnlineStatusBarDefaultOnline, $wgOnlineStatusBarDefaultEnabled, $wgOnlineStatusBarModes; |
| 105 | + global $wgOnlineStatusBarDefaultOnline, $wgOnlineStatusBarDefaultEnabled, $wgOnlineStatusBar_AwayTime, $wgOnlineStatusBarModes; |
106 | 106 | $preferences['OnlineStatusBar_active'] = array( 'type' => 'toggle', 'label-message' => 'onlinestatusbar-used', 'section' => 'misc/onlinestatus' ); |
107 | 107 | $preferences['OnlineStatusBar_hide'] = array( 'type' => 'toggle', 'label-message' => 'onlinestatusbar-hide', 'section' => 'misc/onlinestatus' ); |
| 108 | + $preferences['OnlineStatusBar_away'] = array( 'type' => 'toggle', 'label-message' => 'onlinestatusbar-away', 'section' => 'misc/onlinestatus' ); |
108 | 109 | $preferences['OnlineStatusBar_autoupdate'] = array( 'type' => 'toggle', 'label-message' => 'onlinestatusbar-purge', 'section' => 'misc/onlinestatus' ); |
109 | 110 | $preferences['OnlineStatusBar_status'] = array( 'type' => 'radio', 'label-message' => 'onlinestatusbar-status', 'section' => 'misc/onlinestatus', |
110 | 111 | 'options' => array( |
— | — | @@ -125,6 +126,7 @@ |
126 | 127 | // set defaults |
127 | 128 | $defaultOptions['OnlineStatusBar_autoupdate'] = false; |
128 | 129 | $defaultOptions['OnlineStatusBar_status'] = $wgOnlineStatusBarDefaultOnline; |
| 130 | + $defaultOptions['OnlineStatusBar_away'] = true; |
129 | 131 | $defaultOptions['OnlineStatusBar_active'] = $wgOnlineStatusBarDefaultEnabled; |
130 | 132 | $defaultOptions['OnlineStatusBar_hide'] = false; |
131 | 133 | // quit |