[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Infobot server 'jump' patch



Here is a patch I did so you can make your infobot 'jump' to another
IRC server through a private message, and you assign the server through
the message.  This also only allows the owner(s) of the bot to use this
function.  Usage is '/msg infobot <password> jump irc.server.  Here is
the first part in src/User.pl, add the +'s and the lines without the +'s
should already be there.  Here it is:
                  sleep 2;
                    status("Dying by $who\'s request");
                    exit(0);
                }
+ if ($message =~ /^\s*jump\s+(.*)\s*$/) {
+                    if (!exists $verified{$VerifWho}) {
+                        &status("unverified <$who> $message");
+                        &msg($who, $unverified_message);
+                        return 'NOREPLY';
+                    }
+                    &rawout("QUIT :Reconnection requested by $who");
+                    status("Connecting to $1 by $who\'s request");
+                    &irc($1);
+                }
              if ($message =~ /^reload$/i) {
                    if (!exists $verified{$VerifWho}) {
                        &status("unverified <$who> $message");

Next, you will have to add something to src/Irc.pl (Note: This is in
'sub irc { }').  IF you are using the random server patch I made, use
the next few lines, if you never added my random server patch look
further down.  People using the random server patch:
    while ($connected) {
        @serv = split(/, /,$param{server});
        $servr = "$serv[int(rand(@serv))]";
+        $servr = "$_[0]" if (@_);
        srvConnect($servr, $param{port});

People NOT using the patch must do this to src/Irc.pl:
   while ($connected) {
+  $servr = $param{server};
+  $servr = "$_[0]" if (@_);
-      srvConnect($param{server}, $param{port});
+      srvConnect($servr, $param{port});
(few lines down)
-     rawout("USER $param{ircuser} $param{ident} $param{server}
:$param{realname}");
+     rawout("USER $param{ircuser} $param{ident} $servr
:$param{realname}");
(about one hundred lines UP, not down)
sub serverNotice {
    ($type, $msg) = @_;
    if ($type=~/AUTH/) {
-        &status("!$param{server}! $msg");
+        &status("!$servr! $msg");
    } else {
        $msg =~ s/\*\*\* Notice -- //;
-        &status("-!$param{server}!- $msg");
+        &status("-!$servr!- $msg");
    }
}
    --------------- that's it ----------------
Hope this can be useful to some people.  Over and out.

            Infobot - Smarter than the average Eggdrop

- Sam (CommPort5)