From cfbb79220f197b290a59f716a1ecc7a3ba496617 Mon Sep 17 00:00:00 2001 From: Joseph Moniz Date: Wed, 29 Sep 2010 10:40:47 -0700 Subject: [PATCH] simplified the logic in the privmsg hooks --- config.ini | 6 ++-- lector.php | 56 ++++++++++++++--------------- modules.php | 3 +- modules/privmsg/change_position.php | 44 +++++++++++------------ modules/privmsg/end_lecture.php | 39 ++++++++++---------- modules/privmsg/initiate.php | 51 +++++++++++++------------- modules/privmsg/lecture_mode.php | 46 +++++++++++------------- modules/privmsg/next_slide.php | 44 +++++++++++------------ modules/privmsg/previous_slide.php | 44 +++++++++++------------ modules/privmsg/question_mode.php | 44 +++++++++++------------ modules/privmsg/rehash.php | 37 +++++++++---------- modules/privmsg/reload_intro.php | 51 ++++++++++++-------------- modules/privmsg/reload_lecture.php | 41 ++++++++++----------- modules/privmsg/selected_slide.php | 44 +++++++++++------------ recording.log | 30 ++++++++++++++++ 15 files changed, 287 insertions(+), 293 deletions(-) diff --git a/config.ini b/config.ini index 7ae9daa..a8abad6 100644 --- a/config.ini +++ b/config.ini @@ -1,5 +1,5 @@ [nickserv] -nick = "DevLector" +nick = "DevLector2" registered = TRUE password = "d|g!74ldrp3pper2012" @@ -7,8 +7,8 @@ password = "d|g!74ldrp3pper2012" Bren2010[level] = 2 Bren2010[hostmask] = "Bren2010!Bren2010@bren2010.com" -;Thetan[level] = 1 -;Thetan[hostmask] = "Thetan`Family!Thetan@HTS-EEB48195.dsl.mindspring.com" +Thetan[level] = 2 +Thetan[hostmask] = "Thetan!Thetan@HTS-EEB48195.dsl.mindspring.com" [lecture] lector = "Romnous" diff --git a/lector.php b/lector.php index db73a24..7c8d814 100644 --- a/lector.php +++ b/lector.php @@ -38,7 +38,7 @@ /******************* CODE ********************/ error_reporting(0); -if ($daemon == TRUE) { +if ($daemon) { if(pcntl_fork()) die(); // This turns the bot into a daemon. } @@ -56,7 +56,7 @@ $mode = "q"; $initiated = FALSE; -if ($record == TRUE) { +if ($record) { $startTime = time(); $lectureHandle = fopen("recording.log", "w"); } @@ -67,31 +67,31 @@ cmd_send("JOIN " . $channel); // Join default channel. -while (1) { - while ($data = fgets($socket)) { - $pingCheck = substr($data, 0, strlen("PING :")); - - if ($pingCheck == "PING :") { - $pong = substr($data, strlen("PING :")); - cmd_send("PONG :" . $pong); - } else { - $message = new ircMsg($data); - - $command = strtolower($message->getCommand()); - - $modules->hook($command, $message); - - - $text = smartResponse($message); - - if ($output == TRUE) { - echo $text['text']; - } - - if ($record == TRUE && $initiated == TRUE && $text['record'] == TRUE && $text['text'] != "") { - fwrite($lectureHandle, format(time() - $startTime) . " " . $text['text']); - } - } - } +while (!feof($socket)) { + $data = fgets($socket); + $pingCheck = substr($data, 0, strlen("PING :")); + + if ($pingCheck == "PING :") { + $pong = substr($data, strlen("PING :")); + cmd_send("PONG :" . $pong); + } else { + $message = new ircMsg($data); + + $command = strtolower($message->getCommand()); + + $modules->hook($command, $message); + + $text = smartResponse($message); + + if ($output) echo $text['text']; + + + if ($record && $initiated && $text['record'] && $text['text'] != "") { + fwrite($lectureHandle, format(time() - $startTime) . " " . $text['text']); + } + } } +echo 'wAT! + +'; ?> diff --git a/modules.php b/modules.php index 1f10e9f..7505424 100644 --- a/modules.php +++ b/modules.php @@ -69,8 +69,9 @@ public function hook($hook, $message) { if (!$this->modules[$hook]) return; - foreach ($this->modules[$hook] as $module) + foreach ($this->modules[$hook] as $name => $module) { + echo "{$name}\n"; if (!$module['enabled']) continue; $module['module']($message); } diff --git a/modules/privmsg/change_position.php b/modules/privmsg/change_position.php index 958c2a8..a86c767 100644 --- a/modules/privmsg/change_position.php +++ b/modules/privmsg/change_position.php @@ -1,35 +1,33 @@ return function($message) { global $accessArray; + global $initiated; global $nick; - $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); - - $search = searchAccess($hostmask, $accessArray); - $parameters = $message->getParameters(); $where = $parameters[0]; - $command = substr(trim($parameters[1]), 0, 1);; - if ($search !== FALSE && $where == $nick && $command == "c") { - global $initiated; - - if ($initiated == TRUE) { - global $channel; - global $position; - global $lecture; + if ($where != $nick) return; + + $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); + if (!searchAccess($hostmask, $accessArray)) return; + + if ($parameters[1][0] != 'c') return; + + if (!$initiated) + return say("Please initiate a lecture to show slides."); + + global $channel; + global $position; + global $lecture; - $realPos = trim(substr($parameters[1], 1)); + $realPos = trim(substr($parameters[1], 1)); - if (!empty($lecture[$realPos])) { - $position = $realPos; - say("Changed slide position to " . $realPos . "."); - } else { - say("The requested slide could not be found."); - } - } else { - say("Please initiate a lecture to show slides."); - } + if (!empty($lecture[$realPos])) { + $position = $realPos; + say("Changed slide position to " . $realPos . "."); + } else { + say("The requested slide could not be found."); } -} +}; ?> diff --git a/modules/privmsg/end_lecture.php b/modules/privmsg/end_lecture.php index c527e13..a3264b2 100644 --- a/modules/privmsg/end_lecture.php +++ b/modules/privmsg/end_lecture.php @@ -6,30 +6,27 @@ $parameters = $message->getParameters(); $where = $parameters[0]; - - $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); - $search = searchAccess($hostmask, $accessArray); + if ($where != $nick) return; + + $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); + if (!searchAccess($hostmask, $accessArray)) return; - $text = trim($parameters[1]); - - if ($where == $nick && $search !== FALSE && $text == "e") { + if ($parameters[1][0] != 'e') return; + + if (!$initiated) + return say("No lecture has been initiated."); - if ($initiated == TRUE) { - global $mode; - global $channel; - global $intro; - global $rules; + global $mode; + global $channel; + global $intro; + global $rules; - $initiated = FALSE; - $mode = "q"; + $initiated = FALSE; + $mode = "q"; - cmd_send("MODE " . $channel . " -m"); - talk($channel, "The lecture has come to an end. I hope you enjoyed it and learned something new!"); - say("The lecture has been ended."); - } else { - say("No lecture has been initiated."); - } - } -} + cmd_send("MODE " . $channel . " -m"); + talk($channel, "The lecture has come to an end. I hope you enjoyed it and learned something new!"); + say("The lecture has been ended."); +}; ?> diff --git a/modules/privmsg/initiate.php b/modules/privmsg/initiate.php index 7dd0e0a..8e2598d 100644 --- a/modules/privmsg/initiate.php +++ b/modules/privmsg/initiate.php @@ -6,34 +6,31 @@ $parameters = $message->getParameters(); $where = $parameters[0]; - - $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); - - $search = searchAccess($hostmask, $accessArray); + + if ($where != $nick) return; + + $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); + if (!searchAccess($hostmask, $accessArray)) return; - $text = trim($parameters[1]); - - if ($where == $nick && $search !== FALSE && $text == "i") { - - if ($initiated == FALSE) { - global $mode; - global $position; - global $channel; - global $intro; - global $rules; - global $startTime; + if ($parameters[1][0] != 'i') return; + + if ($initiated) + return say("The lecture has already been initiated."); + + global $mode; + global $position; + global $channel; + global $intro; + global $rules; + global $startTime; - $initiated = TRUE; - $mode = "l"; - $position = 0; - $startTime = time(); + $initiated = TRUE; + $mode = "l"; + $position = 0; + $startTime = time(); - cmd_send("MODE " . $channel . " +m"); - talk($channel, $intro . "\n" . $rules); - say("The lecture has been initiated."); - } else { - say("The lecture has already been initiated."); - } - } -} + cmd_send("MODE " . $channel . " +m"); + talk($channel, $intro . "\n" . $rules); + say("The lecture has been initiated."); +}; ?> diff --git a/modules/privmsg/lecture_mode.php b/modules/privmsg/lecture_mode.php index 5c35a61..a33f12f 100644 --- a/modules/privmsg/lecture_mode.php +++ b/modules/privmsg/lecture_mode.php @@ -6,33 +6,29 @@ $parameters = $message->getParameters(); $where = $parameters[0]; - - $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); + + if ($where != $nick) return; + + $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); + if (!searchAccess($hostmask, $accessArray)) return; - $search = searchAccess($hostmask, $accessArray); + if ($parameters[1][0] != 'l') return; + + if (!$initiated) + return say("Please initiate a lecture to use this command."); - $text = trim($parameters[1]); - - if ($where == $nick && $search !== FALSE && $text == "l") { - - if ($initiated == TRUE) { - global $mode; + + global $mode; - if ($mode == "q") { - global $channel; - global $lector; - - $mode = "l"; + if ($mode == "q") { + global $channel; + global $lector; + + $mode = "l"; - cmd_send("MODE " . $channel . " +m"); - talk($channel, "The lecture is now resuming, so please end any off topic discussions and redirect your attention back to " . $lector . "."); - say("The lecture is now in lecture mode."); - } else { - say("The lecture is already in lecture mode."); - } - } else { - say("Please initiate a lecture to use this command."); - } - } -} + cmd_send("MODE " . $channel . " +m"); + talk($channel, "The lecture is now resuming, so please end any off topic discussions and redirect your attention back to " . $lector . "."); + say("The lecture is now in lecture mode."); + } +}; ?> diff --git a/modules/privmsg/next_slide.php b/modules/privmsg/next_slide.php index 14ab977..394851b 100644 --- a/modules/privmsg/next_slide.php +++ b/modules/privmsg/next_slide.php @@ -1,34 +1,32 @@ return function($message) { global $accessArray; + global $initiated; global $nick; - $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); - - $search = searchAccess($hostmask, $accessArray); - $parameters = $message->getParameters(); $where = $parameters[0]; - $text = trim($parameters[1]); + + if ($where != $nick) return; + + $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); + if (!searchAccess($hostmask, $accessArray)) return; + + if ($parameters[1][0] != 'n') return; + + if (!$initiated) + return say("Please initiate a lecture to show slides."); - if ($search !== FALSE && $where == $nick && $text == "n") { - global $initiated; - - if ($initiated == TRUE) { - global $channel; - global $position; - global $lecture; + global $channel; + global $position; + global $lecture; - if (!empty($lecture[$position])) { - talk($channel, $lecture[$position]); - say("Played slide " . $position . "."); - $position++; - } else { - say("Out of slides."); - } - } else { - say("Please initiate a lecture to show slides."); - } + if (!empty($lecture[$position])) { + talk($channel, $lecture[$position]); + say("Played slide " . $position . "."); + $position++; + } else { + say("Out of slides."); } -} +}; ?> diff --git a/modules/privmsg/previous_slide.php b/modules/privmsg/previous_slide.php index 9bd7fc8..b9fea30 100644 --- a/modules/privmsg/previous_slide.php +++ b/modules/privmsg/previous_slide.php @@ -1,35 +1,33 @@ return function($message) { global $accessArray; + global $initiated; global $nick; - $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); - - $search = searchAccess($hostmask, $accessArray); - $parameters = $message->getParameters(); $where = $parameters[0]; - $text = trim($parameters[1]); + + if ($where != $nick) return; + + $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); + if (!searchAccess($hostmask, $accessArray)) return; + + if ($parameters[1][0] != 'p') return; + + if (!$initiated) + return say("Please initiate a lecture to show slides."); - if ($search !== FALSE && $where == $nick && $text == "p") { - global $initiated; - - if ($initiated == TRUE) { - global $channel; - global $position; - global $lecture; + global $channel; + global $position; + global $lecture; - $realPos = $position - 2; + $realPos = $position - 2; - if (!empty($lecture[$realPos])) { - talk($channel, $lecture[$realPos]); - say("Played slide " . $realPos . "."); - } else { - say("There is no previous slide."); - } - } else { - say("Please initiate a lecture to show slides."); - } + if (!empty($lecture[$realPos])) { + talk($channel, $lecture[$realPos]); + say("Played slide " . $realPos . "."); + } else { + say("There is no previous slide."); } -} +}; ?> diff --git a/modules/privmsg/question_mode.php b/modules/privmsg/question_mode.php index 9572f95..3427f64 100644 --- a/modules/privmsg/question_mode.php +++ b/modules/privmsg/question_mode.php @@ -6,32 +6,28 @@ $parameters = $message->getParameters(); $where = $parameters[0]; - - $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); - - $search = searchAccess($hostmask, $accessArray); + + if ($where != $nick) return; + + $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); + if (!searchAccess($hostmask, $accessArray)) return; - $text = trim($parameters[1]); + if ($parameters[1][0] != 'l') return; + + if (!$initiated) + return say("Please initiate a lecture to use this command."); - if ($where == $nick && $search !== FALSE && $text == "q") { - - if ($initiated == TRUE) { - global $mode; - - if ($mode == "l") { - global $channel; - - $mode = "q"; + + if ($mode == "l") { + global $channel; + + $mode = "q"; - cmd_send("MODE " . $channel . " -m"); - talk($channel, "The channel has now been opened for any questions you wish to ask the lecturer. I know you have questions, so don't be afraid to ask on Ventrillo or IRC.\nYou can also consider this intermission if the lecturer is taking a break or if you're too cool for questions."); - say("The lecture is now in question mode."); - } else { - say("The lecture is already in question mode."); - } - } else { - say("Please initiate a lecture to use this command."); - } + cmd_send("MODE " . $channel . " -m"); + talk($channel, "The channel has now been opened for any questions you wish to ask the lecturer. I know you have questions, so don't be afraid to ask on Ventrillo or IRC.\nYou can also consider this intermission if the lecturer is taking a break or if you're too cool for questions."); + say("The lecture is now in question mode."); + } else { + say("The lecture is already in question mode."); } -} +}; ?> diff --git a/modules/privmsg/rehash.php b/modules/privmsg/rehash.php index b972681..dfb420c 100644 --- a/modules/privmsg/rehash.php +++ b/modules/privmsg/rehash.php @@ -1,29 +1,24 @@ return function ($message) { + ;global $accessArray; + global $initiated; global $nick; $parameters = $message->getParameters(); - $where = $parameters[0]; - unset($parameters[0]); - $msg = trim(implode(" ", $parameters)); + + if ($where != $nick) return; + + $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); + if (!searchAccess($hostmask, $accessArray)) return; + + if ($level = $accessArray[$search]['level'] != 2) return; - if ($where == $nick && $msg == "rehash") { - global $accessArray; - - $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); - - $search = searchAccess($hostmask, $accessArray); - - if ($search !== FALSE) { - $level = $accessArray[$search]['level']; - - if ($level == '2') { // <-- Requires operator class - global $modules; - $modules->reload(); - say("All modules have been rehashed."); - } - } - } -} + list($msg) = explode(" ", $parameters[1]); + if ($msg != 'rehash') return; + + global $modules; + $modules->reload(); + say("All modules have been rehashed."); +}; ?> diff --git a/modules/privmsg/reload_intro.php b/modules/privmsg/reload_intro.php index b069590..d650c3a 100644 --- a/modules/privmsg/reload_intro.php +++ b/modules/privmsg/reload_intro.php @@ -1,39 +1,34 @@ return function ($message) { + global $accessArray; + global $initiated; global $nick; $parameters = $message->getParameters(); - $where = $parameters[0]; - unset($parameters[0]); - $msg = trim(implode(" ", $parameters)); + + if ($where != $nick) return; + + $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); + if (!searchAccess($hostmask, $accessArray)) return; + + if ($level = $accessArray[$search]['level'] != 2) return; - if ($where == $nick && $msg == "reload_intro") { - global $accessArray; - - $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); - - $search = searchAccess($hostmask, $accessArray); - - if ($search !== FALSE) { - $level = $accessArray[$search]['level']; - - if ($level == '2') { // <-- Requires operator class - $config = parse_ini_file("config.ini", true); + list($msg) = explode(" ", $parameters[1]); + if ($msg != 'reload_intro') return; + + $config = parse_ini_file("config.ini", true); - global $intro; - global $postIntro; - global $rules; - global $iniVar; - global $iniVal; + global $intro; + global $postIntro; + global $rules; + global $iniVar; + global $iniVal; - $intro = str_replace($iniVar, $iniVal, $config['lecture']['intro']); - $postIntro = str_replace($iniVar, $iniVal, $config['lecture']['postIntro']); - $rules = str_replace($iniVar, $iniVal, $config['lecture']['rules']); + $intro = str_replace($iniVar, $iniVal, $config['lecture']['intro']); + $postIntro = str_replace($iniVar, $iniVal, $config['lecture']['postIntro']); + $rules = str_replace($iniVar, $iniVal, $config['lecture']['rules']); - say("The intro, post intro, and rules have been reloaded from the ini."); - } - } - } -} + say("The intro, post intro, and rules have been reloaded from the ini."); +}; ?> diff --git a/modules/privmsg/reload_lecture.php b/modules/privmsg/reload_lecture.php index c2087e6..5941885 100644 --- a/modules/privmsg/reload_lecture.php +++ b/modules/privmsg/reload_lecture.php @@ -1,33 +1,28 @@ return function ($message) { + global $accessArray; + global $initiated; global $nick; $parameters = $message->getParameters(); - $where = $parameters[0]; - unset($parameters[0]); - $msg = trim(implode(" ", $parameters)); + + if ($where != $nick) return; + + $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); + if (!searchAccess($hostmask, $accessArray)) return; + + if ($level = $accessArray[$search]['level'] != 2) return; + + list($msg) = explode(" ", $parameters[1]); + if ($msg != 'reload_lecture') return; - if ($where == $nick && $msg == "reload_lecture") { - global $accessArray; - - $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); - - $search = searchAccess($hostmask, $accessArray); - - if ($search !== FALSE) { - $level = $accessArray[$search]['level']; - - if ($level == '2') { // <-- Requires operator class - global $lecture; - global $position; + global $lecture; + global $position; - $lecture = explode("\n\n", trim(file_get_contents("lecture.txt"))); - $position = 0; + $lecture = explode("\n\n", trim(file_get_contents("lecture.txt"))); + $position = 0; - say("The lecture has been reloaded and slide position set to 0."); - } - } - } -} + say("The lecture has been reloaded and slide position set to 0."); +}; ?> diff --git a/modules/privmsg/selected_slide.php b/modules/privmsg/selected_slide.php index 59da743..e1b12d1 100644 --- a/modules/privmsg/selected_slide.php +++ b/modules/privmsg/selected_slide.php @@ -1,35 +1,33 @@ return function($message) { global $accessArray; + global $initiated; global $nick; - $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); - - $search = searchAccess($hostmask, $accessArray); - $parameters = $message->getParameters(); $where = $parameters[0]; - $command = substr(trim($parameters[1]), 0, 1);; + + if ($where != $nick) return; + + $hostmask = $message->getNick() . "!" . $message->getName() . "@" . $message->getHost(); + if (!searchAccess($hostmask, $accessArray)) return; + + if ($parameters[1][0] != 's') return; + + if (!$initiated) + return say("Please initiate a lecture to use this command."); - if ($search !== FALSE && $where == $nick && $command == "s") { - global $initiated; - - if ($initiated == TRUE) { - global $channel; - global $position; - global $lecture; + global $channel; + global $position; + global $lecture; - $realPos = trim(substr($parameters[1], 1)); + $realPos = trim(substr($parameters[1], 1)); - if (!empty($lecture[$realPos])) { - talk($channel, $lecture[$realPos]); - say("Played slide " . $realPos . " on request."); - } else { - say("The requested slide could not be found."); - } - } else { - say("Please initiate a lecture to show slides."); - } + if (!empty($lecture[$realPos])) { + talk($channel, $lecture[$realPos]); + say("Played slide " . $realPos . " on request."); + } else { + say("The requested slide could not be found."); } -} +}; ?> diff --git a/recording.log b/recording.log index e69de29..3595d33 100644 --- a/recording.log +++ b/recording.log @@ -0,0 +1,30 @@ +[00:00:00] The lecture is about to begin, so the channel will be muted until the speaker periodically unmutes it for questions. Our speaker today is Romnous, and I hope you enjoy the lecture! +[00:00:00] Any flooding, trolling, flaming, or interuption will result in a verbal warning. If it continues, you will be kick banned from the channel. If you feel a ban should be repealed, contact Monica. +[00:00:07] The lecture has come to an end. I hope you enjoyed it and learned something new! +[00:00:00] The lecture is about to begin, so the channel will be muted until the speaker periodically unmutes it for questions. Our speaker today is Romnous, and I hope you enjoy the lecture! +[00:00:00] Any flooding, trolling, flaming, or interuption will result in a verbal warning. If it continues, you will be kick banned from the channel. If you feel a ban should be repealed, contact Monica. +[00:00:01] Definition 1: lim x->c f(x) = L means that when x is close to but different from c, then f(x) is near L. +[00:00:01] Definition 2: lim x->c+ f(x) = L means that when x is close to but on the right of c (the positive/right side), then f(x) is near L. +[00:00:01] Definition 3: lim x->c- f(x) = L means that when x is close to but on the left of c (the negative/left side), then f(x) is near L. +[00:00:01] +[00:00:01] Theorem: lim x->c f(x) = L <-> lim x->c- f(x) = L and lim x->c+ f(x) = L. (Why?) +[00:00:01] +[00:00:01] Definition Epsilon-Delta: Given epsilon > 0, there exists delta > 0 such that |f(x) - L| < epsilon, provided that |x - c| < delta +[00:00:01] +[00:00:01] Limit theorems (let n be an element of the positive integers, k be a constant, and f and g be functions which have limits at c, then;) +[00:00:01] +[00:00:01] lim x->c k = k +[00:00:01] lim x->c x = c +[00:00:01] +[00:00:01] lim x->c kf(x) = k * lim x->c f(x) +[00:00:01] lim x->c [f(x) + or - g(x)] = lim x->c f(x) + or - lim x->c g(x) +[00:00:01] +[00:00:01] lim x->c [f(x) * g(x)] = lim x->c f(x) * lim x->c g(x) +[00:00:01] lim x->c [f(x) / g(x)] = lim x->c f(x) / lim x->c g(x), as long as lim x->c g(x) != 0 +[00:00:01] lim x->c [f(x)]^n = [lim x->c f(x)]^n +[00:00:01] +[00:00:01] Definition 4: Let f(x) be defined on an open interval containing c. We say that f(x) is continuous at c if lim x->c f(x) = f(c) +[00:00:01] Definition 4 (cont): Conditions: 1) lim x->c f(x) exists, 2) f(c) exists, 3) lim x->c f(x) = f(c) +[00:00:01] +[00:00:01] Theorem: A polynomial function is continuous at every real number c. A rational function is continuous at every real number c in its domain. +[00:01:00] The lecture has come to an end. I hope you enjoyed it and learned something new!