mIRC Home    About    Download    Register    News    Help

Print Thread
#74117 06/03/04 08:29 PM
Joined: Aug 2003
Posts: 18
Z
z0r Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Aug 2003
Posts: 18
I need to null terminate a string [don't ask why, just believe me], but mIRC keeps trimming my null.

#74118 06/03/04 08:34 PM
Joined: Oct 2003
Posts: 101
Vogon poet
Offline
Vogon poet
Joined: Oct 2003
Posts: 101
You can *try* using binary variables, but mIRC definitely doesn't like $chr(0). I needed it for Macromedia Flash socket support, but decided to do it in VB when I ran into the null thing (it was better suited to be a separate app anyway).

#74119 06/03/04 09:19 PM
Joined: Aug 2003
Posts: 18
Z
z0r Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Aug 2003
Posts: 18
Wow. That was fast. Thanks. Next problem: How do I use binary variables?

#74120 06/03/04 10:13 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
/help binary variables
laugh

#74121 06/03/04 10:52 PM
Joined: Aug 2003
Posts: 18
Z
z0r Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Aug 2003
Posts: 18
newp... didn't work =(

Looks like something needs to be changed. Some people need nullchar.

#74122 06/03/04 11:01 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Trust me, it works when you use it properly laugh
What exactly are you trying to do?

#74123 07/03/04 12:14 AM
Joined: Aug 2003
Posts: 18
Z
z0r Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Aug 2003
Posts: 18
Don't ask why the $null [or &null] is important. It just is. Stupid server that has its own flash clients. Just how it's built.
Code:
on 1:sockopen:sClient: {
  bset &null 1 0
  sockwrite sClient NICK %nick $+ $crlf $+ $bvar(&null,1).text
  sockwrite sClient USER %nick icq.com irc.icq.com : %nick $+ $crlf $+ $bvar(&null,1).text
  /*
  sockwrite sClient NICK %nick $+ $crlf $+ $null
  sockwrite sClient USER %nick icq.com irc.icq.com : %nick $+ $crlf $+ $null
  */
}
 


EDIT: Yes it's IrCQ, but on port 7012.

Last edited by z0r; 07/03/04 12:17 AM.
#74124 07/03/04 12:19 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
  • bset &null 1 0
    sockwrite -tn sClient NICK %nick
    sockwrite sClient &null
    sockwrite -tn sClient USER %nick icq.com irc.icq.com : $+ %nick
    sockwrite sClient &null
Try this.

#74125 07/03/04 12:58 AM
Joined: Aug 2003
Posts: 18
Z
z0r Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Aug 2003
Posts: 18
I don't think you understand me.
What you're doing, is sending a packet: NICK soupy\r\n
and another packet: \0 [null]
What I need to do, is send, in a SINGLE PACKET: NICK soupy\r\n\0
Like the topic says, a null terminated string.
I could load each character of ' NICK soupy\r\n\0 ' into a binary variable, but how much code would that use? I may as well just write my own client [not really]!

#74126 07/03/04 01:09 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
I see what you mean. This is the only way then,
  • bset -t &a 1 NICK %nick $+ $crlf
    bset &a $calc($bvar(&a,0) + 1) 0
    sockwrite sClient &a

    bset -t &b 1 $+(USER %nick . . :,%nick,$crlf)
    bset &b $calc($bvar(&b,0) + 1) 0
    sockwrite sClient &b
It would be nice if we could specify -1 as <N> to append to the end of the variable, but as for now it isn't, so I have to use $calc($bvar(&b,0) + 1) to determine the postion into which the NULL value will be added.

#74127 07/03/04 01:20 AM
Joined: Aug 2003
Posts: 18
Z
z0r Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Aug 2003
Posts: 18
This seems to work [thanks for your help smile]:
Code:
 
on 1:sockopen:sClient: {
  %nick = soupy
  ; Set the binary variable &amp;nick to the data that we need to send
  bset -t &amp;nick 1 NICK %nick $+ $crlf
  ; Append a nullchar
  bset &amp;nick $calc($len(NICK %nick $+ $crlf) + 1) 0
  ; Send it off
  sockwrite sClient &amp;nick
  bset -t &amp;user 1 USER %nick icq.com irc.icq.com : %nick $+ $crlf
  bset &amp;user $calc($len(USER %nick icq.com irc.icq.com : %nick $+ $crlf) + 1) 0
  sockwrite sClient &amp;user
  /*
  sockwrite sClient NICK %nick $+ $crlf $+ $null
  sockwrite sClient USER %nick icq.com irc.icq.com : %nick $+ $crlf $+ $null
  */
}
 

Once again, thankyou for helping.

#74128 07/03/04 01:21 AM
Joined: Aug 2003
Posts: 18
Z
z0r Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Aug 2003
Posts: 18
oops. You got in while I was disconnected. =\

Thanks anyway

#74129 07/03/04 01:29 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
You're welcome laugh
P.S. Keep in mind that $bvar(var,0) is shorter than $len(string) in this example.


Link Copied to Clipboard