mIRC Homepage
Posted By: NiCk2 Sockets - 08/06/03 10:09 PM
Hi ! I'd like to start understanding sockets. I was wondering if you had a little script easy to understand in order to help me.
I would like to be able to connect a kind of clone to my server in order to detect spam ! Having to open a new server window takes up to much space and one gets mixed up between the remotes.
Thank you in advance for any help you may give me smile
Posted By: naki Re: Sockets - 09/06/03 02:21 AM
/help sockets

Also if you dont already know this... mIRC translates all the RAW messages that an IRC Server feeds to you so you cant use things like on text and such. When dealing with sockets or a socket bot you would have to get an understanding of what RAW messages a irc server sends you and what they do. You will also need to understand how to connect to a IRC server and staying connected. Like the replying to a ping. To get a better understanding of how an IRC Server works I suggest you go here RFC 1459 to learn about the IRC Protocol.
Posted By: Seigre Re: Sockets - 09/06/03 02:28 AM
Hey naki.. do you have any help for a scripter who's looking to use sockets to get info from a website (eg. cnn, weather, etc) or something? I'm not a newbie, but I am to the idea of sockets grin
Posted By: Jerk Re: Sockets - 09/06/03 08:32 AM
Seigre: http://helpdesk.zaz.net/documents/socks.php
or you can do a search of the forums. Search all forums, search for "$sockname GET", and select ALL for a date range.
Posted By: NiCk2 Re: Sockets - 09/06/03 10:42 AM
I have been looking through the links you have given to me and I have encountered some little problems lol.
After having opened a socket to a server, I wanted to know what are the differents infos to send in order to get connected.
I have tried /sockwrite -n NameOfSocket PASS something then /sockwrite -n NameOfSocket NICK something and /sockwrite -n NameOfSocket USER something...
In my remote I have the exemple in mIRC help :

Code:
 
on *:sockread:*:{
  if ($sockerr > 0) return
  :nextread
  sockread %temp
  if ($sockbr == 0) return
  if (%temp == $null) %temp = -
  echo 4 -ta %temp
  goto nextread
}
 

Then I get ping timeout, another problem lol !
If someone would be kind enough to give me the right commands in order to be able to get connected, I would realy appreciate it, thanks in advance wink
Posted By: Jerk Re: Sockets - 09/06/03 11:12 AM
In order to connect to most servers you must send (password is only required if you need one):

PASS password
NICK YourNick
USER username hostname servername :realname
- hostname and servername aren't really important. You can just use * for those.

That should get you connected. If you want to see what mIRC does when it connects do the following.
Open up a new server window by typing /server -n
In that new status window type /debug -pt @debug
Connect to a server.

I highly suggest you read RFC 1459
Posted By: KingTomato Re: Sockets - 09/06/03 06:02 PM
Well, ever since I saw the post I figured I would try my hand at a secondary connection with sockets. So far, so good. I have the connection open, and have assigned all the major events to signals. This way you can have the nice mirc functionality with a socket connections. i.e.

:KingTomato!MyName@my.mask.com PRIVMSG #king-tomato :Hey everyone

That would trigger a ktclone_text signal. From there, I set %name, %taget (not chan because it could be a query also), and the address of the user. As you can see, the nick that is really sent from the server includes address 5. I made it so that the variable %address contains that whole string, and %nick is up to the ! in the address. In this case, you'd have:

%nick = KingTomato
%address = KingTomato!MyName@my.mask.com

Then from there, use $mask(%adress, <number>) to get your address.

Again, all the main functions like PRIVMSG, INVITE, JOIN, KICK, MODE, PART, QUIT, etc are all atached to events. I'm not quite done yet, as I am making a nice dialog to go with it, but here is the sneak preview:



I'll let you know when it's done laugh
© mIRC Discussion Forums