var data, svr, name, channel, pass, server, topic, op, opchan, choice, msg, towho, whois, ctcp, whoctcp, serversion, remember : string
var modechan, modes, invitewho, invitechan, kickwho, kickchan, me, deop, deopchan, kickreas, dns, userhost, away, quitreason, target, message : string
var ns, port : int
var stremin, stremout : int
%initialize some variables
name := "default"
server := "default"
%set the screen, background color and text color
View.Set ("graphics:600,400, nobuttonbar")
Text.ColorBack (16)
Text.Color (0)
drawfill (1, 1, black, black)
%i dont feel like commenting this whole program right now
open : stremin, "nick.ini", get
loop
exit when eof (stremin)
get : stremin, name
end loop
close : stremin
if name = "default" then
put "Nickname: " ..
get name
open : stremout, "nick.ini", put
put : stremout, name
close : stremout
end if
open : stremin, "server.ini", get
loop
exit when eof (stremin)
get : stremin, server
end loop
close : stremin
if server = "default" then
put "Server: (d for default [efnet]) : " ..
get server
if server = "d" or server = "D" then
server := "irc.efnet.org"
put "Remember this for next time [y/n] " ..
get remember
if remember = "y" or remember = "Y" then
open : stremout, "server.ini", put
put : stremout, server
close : stremout
end if
end if
end if
put "Channel: #" ..
get channel
cls
function returnword (s : string, separator : char, n : int) : string
var wi := 0
var s2 := ""
for i : 1 .. length (s)
if wi >= n then
if s (i) = separator then
result s2
end if
s2 += s (i)
end if
if s (i) = separator then
wi += 1
end if
end for
if s2 not= "" then
result s2
else
result "Couldn't find that many words!"
end if
end returnword
function returnwords (s : string, separator : char, n : int) : string
var wi := 0
var s2 := ""
for i : 1 .. length (s)
if wi >= n then
s2 += s (i)
end if
if s (i) = separator then
wi += 1
end if
end for
if s2 not= "" then
result s2
else
result "Couldn't find that many words!"
end if
end returnwords
proc parse (data : string)
if returnword (data, " ", 0) = "PING" then
put : ns, "PONG ", returnword (data, " ", 1)
elsif returnword (data, " ", 1) = "376" then %376
put : ns, "JOIN ", "#", channel
elsif returnword (data, " ", 1) = "475" then
put "Enter Channel Password: " ..
get pass
put : ns, "JOIN ", "#", channel, " ", pass
elsif returnword (data, " ", 1) = "473" then
put "Cannot Join Channel (Invite Only)"
elsif returnword (data, " ", 1) = "PRIVMSG" then
put "<", returnword (data, "!", 0) (2 .. *), "> ",
returnwords (data, " ", 3) (2 .. *)
else
put data %set this with a ".." if i want it to all be on the same gay fuckin line which is gay
end if
end parse
ns := Net.OpenConnection (server, 6667)
put : ns, "USER ", name, " echeese echeese :echeese"
put : ns, "NICK ", name
loop
if Net.CharAvailable (ns) then
get : ns, data : *
parse (data)
end if
if hasch then
get data : *
if data = "/join" or data = "/JOIN" then
put "Channel: #" ..
get channel
put : ns, "JOIN ", "#", channel
if returnword (data, " ", 0) = "475" then
put "Enter Channel Password: " ..
get pass
put : ns, "JOIN ", "#", channel, " ", pass
end if
elsif data = "/leave" then
put : ns, "PART ", "#", channel
elsif data = "/server" then
put "Server: " ..
get server : *
Net.CloseConnection (ns)
ns := Net.OpenConnection (server, 6667)
put : ns, "USER ", name, " echeese echeese :echeese"
put : ns, "NICK ", name
elsif data = "/nick" or data = "/NAMES" then
put "Nick: " ..
get name
put : ns, "NICK ", name
elsif data = "/names" or data = "/NAMES" then
put : ns, "NAMES ", "#", channel
elsif data = "/topic" or data = "/TOPIC" then
put "Topic: " ..
get topic : *
put : ns, "TOPIC ", "#", channel, " :", topic
elsif data = "/msg" or data = "/MSG" then
put "Message: " ..
get msg : *
put "To: " ..
get towho
put : ns, "privmsg ", towho, " :", msg
elsif data = "/whois" or data = "/WHOIS" then
put "Who: " ..
get whois
put : ns, "WHOIS ", whois
elsif data = "/ctcp" or data = "/CTCP" then
put "PING|VERSION|TIME| : " ..
get ctcp
if ctcp = "PING" or ctcp = "ping" then
put "Who: " ..
get whoctcp
put : ns, "PING ", whoctcp
elsif ctcp = "version" or ctcp = "VERSION" then
put : ns, "VERSION "
elsif ctcp = "TIME" or ctcp = "time" then
put : ns, "TIME "
else
put "That choice is invalid."
end if
elsif data = "/mode" or data = "/MODE" then
loop
put "Choose Modes(h for list): " ..
get modes : *
if modes = "h" or modes = "H" then
put "b (mask) - Ban mask from channel."
put "i - Invite only channel."
put "k (key) - Channel key (password) needed to join."
put "l (number) - Limit users in channel."
put "m - Moderated."
put "n - No external messages."
put "o (nick) - Ops a user."
put "p - Private channel."
put "s - Secret. the channel will not be listed at all."
put "t - Only ops set topic."
put "v (nick) - Voice."
end if
exit when modes > "h" or modes < "H"
end loop
put : ns, "MODE ", "#", channel, " ", modes
elsif data = "/invite" or data = "/INVITE" then
put "Invite Who: " ..
get invitewho
put : ns, "INVITE ", invitewho, "#", channel
elsif data = "/kick" or data = "/KICK" then
put "Kick Who: " ..
get kickwho
put "Reason(n for none): " ..
get kickreas : *
if kickreas = "n" or kickreas = "N" then
kickreas := ""
end if
put : ns, "KICK ", "#", channel, " ", kickwho, " ", kickreas
elsif data = "/away" or data = "/AWAY" then
put "Reason: " ..
get away : *
put : ns, "AWAY ", away
elsif data = "/quit" or data = "/QUIT" then
put "Reason: " ..
get quitreason : *
put : ns, "QUIT ", quitreason
elsif data = "/notice" or data = "/NOTICE" then
put "Target: " ..
get target
put "Message: " ..
get message
put : ns, "NOTICE ", target, " ", message
elsif data = "/userhost" or data = "/USERHOST" then
put "Who: " ..
get userhost
put : ns, "USERHOST ", userhost
elsif data = "/help" or data = "/HELP" then
put "1.) Command List"
put "2.) About MacIRC"
get choice
if choice = "1" then
put "blah blah command list"
elsif choice = "2" then
color (yellow)
put "Created by a guy on a forum, modified"
put "and added to by the one and only "
put "Macaboo, msg me on IRC. My nick will "
put "Either be macaboo or _MACABOO. "
end if
elsif data = "/op" or data = "/OP" then
put "Who: " ..
get op
put : ns, "MODE ", "#", channel, " +o ", op
elsif data = "/deop" or data = "/DEOP" then
put "Who: " ..
get deop
put : ns, "MODE ", "#", channel, " -o ", deop
elsif data = "/disconnect" or data = "/disconnect" then
Net.CloseConnection (ns)
else
put : ns, "privmsg ", "#", channel, " :", data
end if
end if
end loop
|