{"action":"created","comment":{"url":"https://api.github.com/repos/inspircd/inspircd-extras/pulls/comments/24439390","id":24439390,"diff_hunk":"@@ -0,0 +1,151 @@\n+/*\n+ * InspIRCd -- Internet Relay Chat Daemon\n+ *\n+ *   Copyright (C) 2014 Miguel Peláez <miguel2706@outlook.com>\n+ *   Copyright (C) 2014-2015 Hira.io Team <staff@hira.io>\n+ *\n+ * This file is part of InspIRCd.  InspIRCd is free software: you can\n+ * redistribute it and/or modify it under the terms of the GNU General Public\n+ * License as published by the Free Software Foundation, version 2.\n+ *\n+ * This program is distributed in the hope that it will be useful, but WITHOUT\n+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\n+ * details.\n+ *\n+ * You should have received a copy of the GNU General Public License\n+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n+ */\n+\n+\n+/* $ModAuthor: Hira.io Team */\n+/* $ModDesc: Module to make an operator immune for a specified time, it's like a uline */\n+/* $ModDepends: core 2.0 */\n+\n+#include \"inspircd.h\"\n+int Timeout = 0;\n+struct AutoRemoveMode : public Timer\n+{\n+ public:\n+        std::string userid;\n+        AutoRemoveMode(long interval)\n+                : Timer(interval, ServerInstance->Time(), false)\n+        {\n+        }\n+        void Tick(time_t TIME)\n+        {\n+\t\tUser* user = ServerInstance->FindUUID(userid);\n+\t\tif(!user)\n+\t\t\treturn;\n+\t\tuser->WriteServ(\"NOTICE \"+user->nick+\" :*** Removing your user mode +t to prevent abuses.\");\n+\t\tstd::vector<std::string> modes;\n+\t\tmodes.push_back(user->nick);\n+\t\tmodes.push_back(\"-t\");\n+\t\tServerInstance->SendGlobalMode(modes, ServerInstance->FakeClient);\n+        }\n+};\n+/** User mode +t - Immune from kicks\n+ */\n+class ImmuneMode : public SimpleUserModeHandler\n+{\n+ public:\n+\tImmuneMode(Module* Creator) : SimpleUserModeHandler(Creator, \"immune\", 't')\n+\t{\n+\t\toper = true;\n+\t}\n+\tModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)\n+        {\n+\t\tif(!adding)\n+\t\t\treturn MODEACTION_ALLOW;\n+\t\tif(!IS_LOCAL(dest))\n+\t\t\treturn MODEACTION_ALLOW;\n+\t\tif((!Timeout)||(Timeout == 0))\n+\t\t{\n+\t\t\tdest->WriteServ(\"NOTICE \"+dest->nick+\" :*** This mode will be in place indefinitely, remember to take it off to itself to prevent abuse of power or setting the automatic removal.\");\n+\t\t\treturn MODEACTION_ALLOW;\n+\t\t}\n+                AutoRemoveMode *timer = new AutoRemoveMode(Timeout);\n+                timer->userid = dest->uuid;\n+                ServerInstance->Timers->AddTimer(timer);\n+                return MODEACTION_ALLOW;\n+        }\n+};\n+class ModuleImmune : public Module\n+{\n+ public:\n+\n+\tImmuneMode im;\n+\t\n+\n+\tModuleImmune()\n+\t\t: im(this)\n+\t{\n+\t}\n+\t\n+\tvoid init()\n+\t{\n+\t\tOnRehash(NULL);\n+\t\tServerInstance->Modules->AddService(im);\n+\t\tImplementation eventlist[] = { I_OnUserPreKick, I_OnCheckChannelBan, I_OnCheckInvite, I_OnCheckKey, I_OnCheckLimit, I_OnRehash };\n+\t\tServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));\t\t\n+\t}\n+\n+\t\n+\tModResult OnUserPreKick(User *source, Membership *memb, const std::string& reason)\n+\t{\n+\t\tif (!IS_LOCAL(memb->user))\n+                        return MOD_RES_PASSTHRU;\n+\t\tif (memb->user->IsModeSet('t'))\n+\t\t\treturn MOD_RES_DENY;\n+\t\telse\n+\t\t\treturn MOD_RES_PASSTHRU;\n+\t}\n+\tModResult OnCheckChannelBan(User * user, Channel * chan)\n+\t{\n+\t\tif (!IS_LOCAL(user))\n+                        return MOD_RES_PASSTHRU;\n+\t\tif (user->IsModeSet('t'))\n+\t\t\treturn MOD_RES_ALLOW;\n+\t\telse\n+\t\t\treturn MOD_RES_PASSTHRU;\n+\t}\n+\tModResult OnCheckInvite(User * user, Channel * chan)\n+\t{\n+\t\tif (!IS_LOCAL(user))\n+                        return MOD_RES_PASSTHRU;\n+\t\tif (user->IsModeSet('t'))\n+\t\t\treturn MOD_RES_ALLOW;\n+\t\telse\n+\t\t\treturn MOD_RES_PASSTHRU;\n+\t}\n+\tModResult OnCheckKey(User * user, Channel * chan, const std::string & keygiven)\n+\t{\n+\t\tif (!IS_LOCAL(user))\n+                        return MOD_RES_PASSTHRU;\n+\t\tif (user->IsModeSet('t'))\n+\t\t\treturn MOD_RES_ALLOW;\n+\t\telse\n+\t\t\treturn MOD_RES_PASSTHRU;\n+\t}\n+\tModResult OnCheckLimit(User * user, Channel * chan)\n+\t{\n+\t\tif (!IS_LOCAL(user))\n+                        return MOD_RES_PASSTHRU;\n+\t\tif (user->IsModeSet('t'))\n+\t\t\treturn MOD_RES_ALLOW;\n+\t\telse\n+\t\t\treturn MOD_RES_PASSTHRU;\n+\t}\n+\tVersion GetVersion()\n+\t{\n+\t\treturn Version(\"Provides the umode +t, that prevents the user is kicked from any channel. Can only be set by a network operator.\", VF_VENDOR);","path":"2.0/m_immunemode.cpp","position":141,"original_position":141,"commit_id":"d309150fc34789c904a5853eeb33cc03c843ed2f","original_commit_id":"d309150fc34789c904a5853eeb33cc03c843ed2f","user":{"login":"ShutterQuick","id":2367571,"avatar_url":"https://avatars.githubusercontent.com/u/2367571?v=3","gravatar_id":"","url":"https://api.github.com/users/ShutterQuick","html_url":"https://github.com/ShutterQuick","followers_url":"https://api.github.com/users/ShutterQuick/followers","following_url":"https://api.github.com/users/ShutterQuick/following{/other_user}","gists_url":"https://api.github.com/users/ShutterQuick/gists{/gist_id}","starred_url":"https://api.github.com/users/ShutterQuick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ShutterQuick/subscriptions","organizations_url":"https://api.github.com/users/ShutterQuick/orgs","repos_url":"https://api.github.com/users/ShutterQuick/repos","events_url":"https://api.github.com/users/ShutterQuick/events{/privacy}","received_events_url":"https://api.github.com/users/ShutterQuick/received_events","type":"User","site_admin":false},"body":"> VF_VENDOR\r\n\r\nNot VF_VENDOR.\r\nVF_COMMON on the other hand maybe?","created_at":"2015-02-10T18:58:45Z","updated_at":"2015-02-10T18:58:45Z","html_url":"https://github.com/inspircd/inspircd-extras/pull/61#discussion_r24439390","pull_request_url":"https://api.github.com/repos/inspircd/inspircd-extras/pulls/61","_links":{"self":{"href":"https://api.github.com/repos/inspircd/inspircd-extras/pulls/comments/24439390"},"html":{"href":"https://github.com/inspircd/inspircd-extras/pull/61#discussion_r24439390"},"pull_request":{"href":"https://api.github.com/repos/inspircd/inspircd-extras/pulls/61"}}},"pull_request":{"url":"https://api.github.com/repos/inspircd/inspircd-extras/pulls/61","id":29033005,"html_url":"https://github.com/inspircd/inspircd-extras/pull/61","diff_url":"https://github.com/inspircd/inspircd-extras/pull/61.diff","patch_url":"https://github.com/inspircd/inspircd-extras/pull/61.patch","issue_url":"https://api.github.com/repos/inspircd/inspircd-extras/issues/61","number":61,"state":"open","locked":false,"title":"GetBans and immunemode","user":{"login":"Miguel2706","id":4616452,"avatar_url":"https://avatars.githubusercontent.com/u/4616452?v=3","gravatar_id":"","url":"https://api.github.com/users/Miguel2706","html_url":"https://github.com/Miguel2706","followers_url":"https://api.github.com/users/Miguel2706/followers","following_url":"https://api.github.com/users/Miguel2706/following{/other_user}","gists_url":"https://api.github.com/users/Miguel2706/gists{/gist_id}","starred_url":"https://api.github.com/users/Miguel2706/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Miguel2706/subscriptions","organizations_url":"https://api.github.com/users/Miguel2706/orgs","repos_url":"https://api.github.com/users/Miguel2706/repos","events_url":"https://api.github.com/users/Miguel2706/events{/privacy}","received_events_url":"https://api.github.com/users/Miguel2706/received_events","type":"User","site_admin":false},"body":"Hi, We have created two modules, already implemented in our IRC network, which I think can be useful for many people, Thanks!","created_at":"2015-02-10T18:44:05Z","updated_at":"2015-02-10T18:58:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"427137d8844fdf49c9a5cdd1e7e88d4d786c7279","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/inspircd/inspircd-extras/pulls/61/commits","review_comments_url":"https://api.github.com/repos/inspircd/inspircd-extras/pulls/61/comments","review_comment_url":"https://api.github.com/repos/inspircd/inspircd-extras/pulls/comments/{number}","comments_url":"https://api.github.com/repos/inspircd/inspircd-extras/issues/61/comments","statuses_url":"https://api.github.com/repos/inspircd/inspircd-extras/statuses/d309150fc34789c904a5853eeb33cc03c843ed2f","head":{"label":"hira-io:master","ref":"master","sha":"d309150fc34789c904a5853eeb33cc03c843ed2f","user":{"login":"hira-io","id":10945406,"avatar_url":"https://avatars.githubusercontent.com/u/10945406?v=3","gravatar_id":"","url":"https://api.github.com/users/hira-io","html_url":"https://github.com/hira-io","followers_url":"https://api.github.com/users/hira-io/followers","following_url":"https://api.github.com/users/hira-io/following{/other_user}","gists_url":"https://api.github.com/users/hira-io/gists{/gist_id}","starred_url":"https://api.github.com/users/hira-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hira-io/subscriptions","organizations_url":"https://api.github.com/users/hira-io/orgs","repos_url":"https://api.github.com/users/hira-io/repos","events_url":"https://api.github.com/users/hira-io/events{/privacy}","received_events_url":"https://api.github.com/users/hira-io/received_events","type":"Organization","site_admin":false},"repo":{"id":30605923,"name":"inspircd-extras","full_name":"hira-io/inspircd-extras","owner":{"login":"hira-io","id":10945406,"avatar_url":"https://avatars.githubusercontent.com/u/10945406?v=3","gravatar_id":"","url":"https://api.github.com/users/hira-io","html_url":"https://github.com/hira-io","followers_url":"https://api.github.com/users/hira-io/followers","following_url":"https://api.github.com/users/hira-io/following{/other_user}","gists_url":"https://api.github.com/users/hira-io/gists{/gist_id}","starred_url":"https://api.github.com/users/hira-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hira-io/subscriptions","organizations_url":"https://api.github.com/users/hira-io/orgs","repos_url":"https://api.github.com/users/hira-io/repos","events_url":"https://api.github.com/users/hira-io/events{/privacy}","received_events_url":"https://api.github.com/users/hira-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hira-io/inspircd-extras","description":"Extra modules for InspIRCd.","fork":true,"url":"https://api.github.com/repos/hira-io/inspircd-extras","forks_url":"https://api.github.com/repos/hira-io/inspircd-extras/forks","keys_url":"https://api.github.com/repos/hira-io/inspircd-extras/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hira-io/inspircd-extras/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hira-io/inspircd-extras/teams","hooks_url":"https://api.github.com/repos/hira-io/inspircd-extras/hooks","issue_events_url":"https://api.github.com/repos/hira-io/inspircd-extras/issues/events{/number}","events_url":"https://api.github.com/repos/hira-io/inspircd-extras/events","assignees_url":"https://api.github.com/repos/hira-io/inspircd-extras/assignees{/user}","branches_url":"https://api.github.com/repos/hira-io/inspircd-extras/branches{/branch}","tags_url":"https://api.github.com/repos/hira-io/inspircd-extras/tags","blobs_url":"https://api.github.com/repos/hira-io/inspircd-extras/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hira-io/inspircd-extras/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hira-io/inspircd-extras/git/refs{/sha}","trees_url":"https://api.github.com/repos/hira-io/inspircd-extras/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hira-io/inspircd-extras/statuses/{sha}","languages_url":"https://api.github.com/repos/hira-io/inspircd-extras/languages","stargazers_url":"https://api.github.com/repos/hira-io/inspircd-extras/stargazers","contributors_url":"https://api.github.com/repos/hira-io/inspircd-extras/contributors","subscribers_url":"https://api.github.com/repos/hira-io/inspircd-extras/subscribers","subscription_url":"https://api.github.com/repos/hira-io/inspircd-extras/subscription","commits_url":"https://api.github.com/repos/hira-io/inspircd-extras/commits{/sha}","git_commits_url":"https://api.github.com/repos/hira-io/inspircd-extras/git/commits{/sha}","comments_url":"https://api.github.com/repos/hira-io/inspircd-extras/comments{/number}","issue_comment_url":"https://api.github.com/repos/hira-io/inspircd-extras/issues/comments/{number}","contents_url":"https://api.github.com/repos/hira-io/inspircd-extras/contents/{+path}","compare_url":"https://api.github.com/repos/hira-io/inspircd-extras/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hira-io/inspircd-extras/merges","archive_url":"https://api.github.com/repos/hira-io/inspircd-extras/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hira-io/inspircd-extras/downloads","issues_url":"https://api.github.com/repos/hira-io/inspircd-extras/issues{/number}","pulls_url":"https://api.github.com/repos/hira-io/inspircd-extras/pulls{/number}","milestones_url":"https://api.github.com/repos/hira-io/inspircd-extras/milestones{/number}","notifications_url":"https://api.github.com/repos/hira-io/inspircd-extras/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hira-io/inspircd-extras/labels{/name}","releases_url":"https://api.github.com/repos/hira-io/inspircd-extras/releases{/id}","created_at":"2015-02-10T18:00:17Z","updated_at":"2015-02-10T18:23:41Z","pushed_at":"2015-02-10T18:23:41Z","git_url":"git://github.com/hira-io/inspircd-extras.git","ssh_url":"git@github.com:hira-io/inspircd-extras.git","clone_url":"https://github.com/hira-io/inspircd-extras.git","svn_url":"https://github.com/hira-io/inspircd-extras","homepage":"http://inspircd.github.com","size":382,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"inspircd:master","ref":"master","sha":"52e1b626ff264a8a7252af88b1d53cc57359aa2e","user":{"login":"inspircd","id":1560750,"avatar_url":"https://avatars.githubusercontent.com/u/1560750?v=3","gravatar_id":"","url":"https://api.github.com/users/inspircd","html_url":"https://github.com/inspircd","followers_url":"https://api.github.com/users/inspircd/followers","following_url":"https://api.github.com/users/inspircd/following{/other_user}","gists_url":"https://api.github.com/users/inspircd/gists{/gist_id}","starred_url":"https://api.github.com/users/inspircd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inspircd/subscriptions","organizations_url":"https://api.github.com/users/inspircd/orgs","repos_url":"https://api.github.com/users/inspircd/repos","events_url":"https://api.github.com/users/inspircd/events{/privacy}","received_events_url":"https://api.github.com/users/inspircd/received_events","type":"Organization","site_admin":false},"repo":{"id":3786321,"name":"inspircd-extras","full_name":"inspircd/inspircd-extras","owner":{"login":"inspircd","id":1560750,"avatar_url":"https://avatars.githubusercontent.com/u/1560750?v=3","gravatar_id":"","url":"https://api.github.com/users/inspircd","html_url":"https://github.com/inspircd","followers_url":"https://api.github.com/users/inspircd/followers","following_url":"https://api.github.com/users/inspircd/following{/other_user}","gists_url":"https://api.github.com/users/inspircd/gists{/gist_id}","starred_url":"https://api.github.com/users/inspircd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inspircd/subscriptions","organizations_url":"https://api.github.com/users/inspircd/orgs","repos_url":"https://api.github.com/users/inspircd/repos","events_url":"https://api.github.com/users/inspircd/events{/privacy}","received_events_url":"https://api.github.com/users/inspircd/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/inspircd/inspircd-extras","description":"Extra modules for InspIRCd.","fork":false,"url":"https://api.github.com/repos/inspircd/inspircd-extras","forks_url":"https://api.github.com/repos/inspircd/inspircd-extras/forks","keys_url":"https://api.github.com/repos/inspircd/inspircd-extras/keys{/key_id}","collaborators_url":"https://api.github.com/repos/inspircd/inspircd-extras/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/inspircd/inspircd-extras/teams","hooks_url":"https://api.github.com/repos/inspircd/inspircd-extras/hooks","issue_events_url":"https://api.github.com/repos/inspircd/inspircd-extras/issues/events{/number}","events_url":"https://api.github.com/repos/inspircd/inspircd-extras/events","assignees_url":"https://api.github.com/repos/inspircd/inspircd-extras/assignees{/user}","branches_url":"https://api.github.com/repos/inspircd/inspircd-extras/branches{/branch}","tags_url":"https://api.github.com/repos/inspircd/inspircd-extras/tags","blobs_url":"https://api.github.com/repos/inspircd/inspircd-extras/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/inspircd/inspircd-extras/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/inspircd/inspircd-extras/git/refs{/sha}","trees_url":"https://api.github.com/repos/inspircd/inspircd-extras/git/trees{/sha}","statuses_url":"https://api.github.com/repos/inspircd/inspircd-extras/statuses/{sha}","languages_url":"https://api.github.com/repos/inspircd/inspircd-extras/languages","stargazers_url":"https://api.github.com/repos/inspircd/inspircd-extras/stargazers","contributors_url":"https://api.github.com/repos/inspircd/inspircd-extras/contributors","subscribers_url":"https://api.github.com/repos/inspircd/inspircd-extras/subscribers","subscription_url":"https://api.github.com/repos/inspircd/inspircd-extras/subscription","commits_url":"https://api.github.com/repos/inspircd/inspircd-extras/commits{/sha}","git_commits_url":"https://api.github.com/repos/inspircd/inspircd-extras/git/commits{/sha}","comments_url":"https://api.github.com/repos/inspircd/inspircd-extras/comments{/number}","issue_comment_url":"https://api.github.com/repos/inspircd/inspircd-extras/issues/comments/{number}","contents_url":"https://api.github.com/repos/inspircd/inspircd-extras/contents/{+path}","compare_url":"https://api.github.com/repos/inspircd/inspircd-extras/compare/{base}...{head}","merges_url":"https://api.github.com/repos/inspircd/inspircd-extras/merges","archive_url":"https://api.github.com/repos/inspircd/inspircd-extras/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/inspircd/inspircd-extras/downloads","issues_url":"https://api.github.com/repos/inspircd/inspircd-extras/issues{/number}","pulls_url":"https://api.github.com/repos/inspircd/inspircd-extras/pulls{/number}","milestones_url":"https://api.github.com/repos/inspircd/inspircd-extras/milestones{/number}","notifications_url":"https://api.github.com/repos/inspircd/inspircd-extras/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/inspircd/inspircd-extras/labels{/name}","releases_url":"https://api.github.com/repos/inspircd/inspircd-extras/releases{/id}","created_at":"2012-03-21T12:38:31Z","updated_at":"2015-02-04T22:29:19Z","pushed_at":"2014-12-18T21:53:46Z","git_url":"git://github.com/inspircd/inspircd-extras.git","ssh_url":"git@github.com:inspircd/inspircd-extras.git","clone_url":"https://github.com/inspircd/inspircd-extras.git","svn_url":"https://github.com/inspircd/inspircd-extras","homepage":"http://inspircd.github.com","size":1038,"stargazers_count":29,"watchers_count":29,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":32,"mirror_url":null,"open_issues_count":12,"forks":32,"open_issues":12,"watchers":29,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/inspircd/inspircd-extras/pulls/61"},"html":{"href":"https://github.com/inspircd/inspircd-extras/pull/61"},"issue":{"href":"https://api.github.com/repos/inspircd/inspircd-extras/issues/61"},"comments":{"href":"https://api.github.com/repos/inspircd/inspircd-extras/issues/61/comments"},"review_comments":{"href":"https://api.github.com/repos/inspircd/inspircd-extras/pulls/61/comments"},"review_comment":{"href":"https://api.github.com/repos/inspircd/inspircd-extras/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/inspircd/inspircd-extras/pulls/61/commits"},"statuses":{"href":"https://api.github.com/repos/inspircd/inspircd-extras/statuses/d309150fc34789c904a5853eeb33cc03c843ed2f"}}}}