Skip to content
General IRCd

Pipe (|) Processing

A TG007 community discussion started by Pablo.

Discussion 16 posts
Page 1 of 1
Open
Topic #14302 · 16 published posts · 5,140 views

I have encountered a bug in my connection/script I need advice on...

 

For my channel protections (topic lock) I store the topic and modes for a channel to a hash on:JOIN. Well if a topic has a | or pipe in it, it makes the delimiters execute as commands.

 

For example:

 

  hadd cProt MODES $+ # $chan(#).mode
  .timer 1 1 hadd cProt TOPIC $+ # $chan(#).topic

 

Not sure why I use a timer on topic lol, but probably for a reason. Anyways, when a topic is "Blah | Help | Crap | Etc," mirc executes BLAH, HELP, CRAP, ETC.

 

How do i remove this without stripping out the pipes?

Stupidity is a metric of success.

are you using the latest version of mIRC.

I am not having that issue. If I understand what you are asking correctly. Let me know how this relates to what you are trying to do.

 

[07:07.a] err0r has changed the topic to: This is a test

[07:07.a] xerr0rx has changed the topic to: blah | another test | blah | hey

 

on ^*:topic:# { if ($hget(cprot,Topic $+ $chan) != $1-) { prop $chan TOPIC : $v1 } }

alias gettopic {
  hadd -m cProt TOPIC $+ $active $chan($active).topic | echo -a $hget(cprot,Topic $+ $active)
}

 

Where is your problem occurring. on the hadd or the check

Edited Apr 23, 2010 12:47 PM by err0r

Get information about ircWx here

I have encountered a bug in my connection/script I need advice on...

 

For my channel protections (topic lock) I store the topic and modes for a channel to a hash on:JOIN. Well if a topic has a | or pipe in it, it makes the delimiters execute as commands.

 

For example:

 

  hadd cProt MODES $+ # $chan(#).mode
  .timer 1 1 hadd cProt TOPIC $+ # $chan(#).topic

 

Not sure why I use a timer on topic lol, but probably for a reason. Anyways, when a topic is "Blah | Help | Crap | Etc," mirc executes BLAH, HELP, CRAP, ETC.

 

How do i remove this without stripping out the pipes?

 

Try not using a timer.

i understand why you might do that in the onjoin .. but you are better off using the raw return to get the info when you join.

 

like raw 332 for topic and raw 324 for modes. It's a much better method for doing it than using on join:

 

if you just desire to use on join then you can do a timer on the alias instead of the actual event. Put the hadd in the alias and just timer to trigger the alias. Personally I would go with the raws though.

 

sorry i didn't notice this was in the general ircd area.. prop wouldn't work on it.

 

but why not just use chanserv to lock the modes/topic ????

Edited Apr 23, 2010 5:03 PM by err0r

Get information about ircWx here

Just make sure you don't evaluate the topic. /help $eval

might also try waiting til you are op'ed instead of trying to do it on $me join

 

on !*:topic:# { if ($hget(cprot,Topic $+ $chan) != $1-) { topic $chan $v1 } }
on *:op:#: { if ($opnick == $me) && ($hget(cprot,Topic $+ $chan) != $chan(#).topic) { topic $chan $v1 } }

 

 

lots of different ways you could do it. Personally i would just use chanserv's lock features.

Edited Apr 23, 2010 5:18 PM by err0r

Get information about ircWx here

Well you guys are awesome. I did both things.

 

I moved the hadd to raw and got rid of the timer. The timer was the culprit in handling the pipes. But regardless it is fixed and more efficient.

 

raw 324:*:{ hadd cProt MODES $+ $2 $3- }
raw 332:*:{ hadd cProt TOPIC $+ $2 $3- }

 

There are just soo many ways of doing the same thing, sometimes you need to think out of the box. And this was really for Buzzen, just didn't realize there was another forum.

Stupidity is a metric of success.

glad you got it working pablo

Get information about ircWx here

FYI you could have just done this:

 

.timer 1 1 hadd cProt TOPIC $+ # $!chan( # ).topic

Timers evaluate everything twice (once at the time of the execution of the /timer command, and once again at the time the actual timer fires)... so you need to make sure anything you pass to it is escaped.

 

You can see what I'm talking about by typing these two lines of code in your status window:

 

//echo -a $!me

* this echoes the literal text "$me"

 

//.timer 1 1 echo -a $!me

* this echoes your nickname.

timer still evaluates pipes ( | ).. I was not talking about !. The same example you posted unfortunately still evaluates the | symbol.

 

//.timer 1 1 echo -a hahha | hahha

/vs/

 

//echo -a hahha | hahha

returns the same result (error): "hahha - invalid command"

Stupidity is a metric of success.

timer still evaluates pipes ( | ).. I was not talking about !. The same example you posted unfortunately still evaluates the | symbol.

 

//.timer 1 1 echo -a hahha | hahha

/vs/

 

//echo -a hahha | hahha

returns the same result (error): "hahha - invalid command"

 

Use the $chr value for the pipe. I don't remember it off hand. Find it like this.

 

//echo -a . $asc(|)

timer still evaluates pipes ( | ).. I was not talking about !. The same example you posted unfortunately still evaluates the | symbol.

 

//.timer 1 1 echo -a hahha | hahha

/vs/

 

//echo -a hahha | hahha

returns the same result (error): "hahha - invalid command"

 

You must be doing something wrong, because it works fine for me:

 

//topic # test $chr(124) test | timer 1 1 echo -a $!chan( # ).topic

Output:

 

* Timer 1 activated

(13:23:54) * hixxy changes topic to 'test | test'

test | test

* Timer 1 halted

 

The example you posted is not the same as what I gave you.. for your example to work of echoing a pipe as plain text you would need to do this:

 

//timer 1 1 echo -a hahha $!chr(124) hahha

Or:

 

//timer 1 1 echo -a hahha $!(|,) hahha

Use the $chr value for the pipe. I don't remember it off hand. Find it like this.

 

//echo -a . $asc(|)

 

Same problem as I demonstrated in my earlier post, you would need to use $!chr(124)

//timer 1 1 echo -a hahha $!(|,) hahha
with $(|) no comma is necessary since the evaluation of '|' simply does nothing.

The only reason for $! in a timer is to evaluate when the timer starts, not when it goes off. $chr(124) will always be evaluated as | regardless.

with $(|) no comma is necessary since the evaluation of '|' simply does nothing.

 

You're right, $!(|) works fine :)

 

The only reason for $! in a timer is to evaluate when the timer starts, not when it goes off. $chr(124) will always be evaluated as | regardless.

 

Try this mate:

 

//timer 1 1 echo -a a $chr(124) b

As you will see it throws a "b unknown command" error.

 

The way to get around this is by using $!chr(124)

 

//timer 1 1 echo -a a $chr(124) b evaluates $chr(124) to plaintext "|" when the /timer command is first executed, then plaintext "|" is evaluated to special meaning "|" at the time that the timer fires.

 

Using my version,

 

//timer 1 1 echo -a a $!chr(124) b evaluates $!chr(124) to "$chr(124)" when the /timer command is first executed, then $chr(124) is evaluated to plaintext "|" at the time that the timer fires.

Yeah that makes sense. It evaluates the $chr(124) so that when it goes to send the echo it sees it as a pipe. Thanks.