+$topicset = false;
+if (isset($_POST))
+{
+ if (isset($_POST['update_topic']) && isset($_POST['set_topic']))
+ {
+ if (isset($channelObj))
+ {
+ if (isset($channelObj->topic)) // if the set topic is different
+ {
+ if (strcmp($channelObj->topic,$_POST['set_topic']))
+ {
+ $user = (function_exists('unreal_get_current_user') && $u = unreal_get_current_user()) ? $u->username : NULL;
+ $topicset = $rpc->channel()->set_topic($channelObj->name, $_POST['set_topic'], $user);
+ $channelObj->topic = $_POST['set_topic'];
+ }
+ }
+ else
+ {
+ $user = (function_exists('unreal_get_current_user') && $u = unreal_get_current_user()) ? $u->username : NULL;
+ $topicset = $rpc->channel()->set_topic($channelObj->name, $_POST['set_topic'], $user);
+ $channelObj->topic = $_POST['set_topic'];
+ }
+ }
+ }
+ if ($topicset)
+ Message::Success("The topic for $channelObj->name has been updated to be: \"$channelObj->topic\"");
+}
+