collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18363
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: IRC chat relay  (Read 9417 times)

0 Members and 1 Guest are viewing this topic.

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: IRC chat relay
« Reply #45 on: February 11, 2007, 02:00:42 am »
Hrm. Should be possible. I'll have a look :)
BeBot Founder and Fixer Kingpin

Offline Wolfbiter

  • Contributor
  • *******
  • Posts: 149
  • Karma: +0/-0
    • KAZE
Re: IRC chat relay
« Reply #46 on: February 11, 2007, 04:39:31 am »
Ah.. thought you wanted clicky links at irc, not via irc.
Just change so it's "bla bla bla" (http:......) output, then it's easy to parse. But then there's the possible lowid/high id problem...
Too many toons.

Offline Nytridr

  • BeBot Expert
  • ****
  • Posts: 262
  • Karma: +0/-0
    • Rising Sun
Re: IRC chat relay
« Reply #47 on: February 11, 2007, 06:34:01 pm »
Ah.. thought you wanted clicky links at irc, not via irc.
Just change so it's "bla bla bla" (http:......) output, then it's easy to parse. But then there's the possible lowid/high id problem...

well with this and talking with Khalem I got this to work.. it dont look good on the IRC channel its self but we could care less with that.. but here it is..
this will allow all scripts and all linked items to be processed .. just basically took out the formating for it going to IRC..

Code: [Select]
/*
This gets called on a msg in the group
*/
function gmsg($name, $group, $msg)
{
$msg = str_replace(">", ">", $msg);
$msg = str_replace("&lt;", "<", $msg);
if (($this -> irc != null) && ($this -> chat <= 1))
{
if (((strtolower($name) == strtolower($this -> bot -> botname)) && !empty($this -> relayguildname) &&
(preg_match("/^<font color=(.{6,7})>\[".$this -> relayguildname."\] (.*):(.*)$/", $msg))) ||
(strtolower($name) != strtolower($this -> bot -> botname)))
{
if ($this -> itemref == 0)
$rep = "http://auno.org/ao/db.php?id=\\1&ql=\\3";
else
$rep = "http://aomainframe.net/showitem.asp?LowID=\\1&HiID=\\2&QL=\\3";

//$msg = preg_replace("/<a href=\"itemref:\/\/([0-9]*)\/([0-9]*)\/([0-9]*)\">(.*)<\/a>/iU", "\\4 (".$rep.")", $msg);

//$msg = preg_replace("/<a href=\"(.+)\">/isU", "[link]", $msg);
//$msg = preg_replace("/<\/a>/iU", "[/link]", $msg);
//$msg = preg_replace("/<font(.+)>/iU", "", $msg);
//$msg = preg_replace("/<\/font>/iU", "", $msg);

$this -> irc -> message(SMARTIRC_TYPE_CHANNEL, $this -> chan, $this -> ircprefix . ' ' . $name . ': ' . $msg);
}
}
}



/*
This gets called on a msg in the privgroup without a command
*/
function privgroup($name, $msg)
{
$msg = str_replace("&gt;", ">", $msg);
$msg = str_replace("&lt;", "<", $msg);
if (($this -> irc != null) && ($this -> chat >= 1))
{
if (strtolower($name) != strtolower($this -> bot -> botname))
{
if ($this -> itemref == 0)
$rep = "http://auno.org/ao/db.php?id=\\1&ql=\\3";
else
$rep = "http://aomainframe.net/showitem.asp?LowID=\\1&HiID=\\2&QL=\\3";

//$msg = preg_replace("/<a href=\"itemref:\/\/([0-9]*)\/([0-9]*)\/([0-9]*)\">(.*)<\/a>/iU", "\\4 (".$rep.")", $msg);

//$msg = preg_replace("/<a href=\"(.+)\">/isU", "[link]", $msg);
//$msg = preg_replace("/<\/a>/iU", "[/link]", $msg);
//$msg = preg_replace("/<font(.+)>/iU", "", $msg);
//$msg = preg_replace("/<\/font>/iU", "", $msg);

$this -> irc -> message(SMARTIRC_TYPE_CHANNEL, $this -> chan, '[PGROUP] ' . $name . ': ' . $msg);
}
}
}



Code: [Select]
/*
* Gets called for an inc IRC message
*/
function irc_recieve(&$irc, &$data)
{
if ((strtolower($data -> message) != strtolower(str_replace("\\", "", $this -> bot -> commpre.'online'))) &&
(strtolower($data -> message) != strtolower(str_replace("\\", "", $this -> bot -> commpre.'is'))))
$msg = str_replace("", "", $data -> message);
$msg = str_replace("", "", $msg);

if ($this -> chat <= 1)
$this -> bot -> send_gc($this -> guildprefix . " <font color=#808000>" . $data -> nick . "</font>: " . $msg);
if ($this -> chat >= 1)
$this -> bot -> send_pgroup($this -> guildprefix . " <font color=#808000>" . $data -> nick . "</font>: " . $msg);


if (isset($this -> bot -> commands["gmsg"][$this -> bot -> guildname]["guildrelay"]))
{
$this -> bot -> commands["gmsg"][$this -> bot -> guildname]["guildrelay"] -> gmsg($this -> guildprefix .
" " . $data -> nick, "", $msg);
}
}

Not sure how correct this all is.. but it seems to work for now.. and I am deploying it accross all our bots and will be testing for any bugs in it..but with this this way.. it does NOT look good on IRC, but only 3 people actually have access to the IRC server since it is password protected and such.. so it isnt really a big deal..

Nytridr
Co-Prez of Rising Sun RK1 (1st & only org I will ever belong to)

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: IRC chat relay
« Reply #48 on: February 11, 2007, 08:07:40 pm »
If your not using the IRC relay for much other than actual relaying between bots, there is nothing wrong with doing this :)
BeBot Founder and Fixer Kingpin

 

* Recent Posts
[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm]


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

* Who's Online
  • Dot Guests: 766
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal