Jump to content

Min-i-mal-ism (new Bcn Connection.)


av0ider

Recommended Posts

Hallo, hallo.

 

I've never really "released" anything, and I'm not really "releasing" anything now.

I'm posting some of my work because I thought it might be useful for some people.

It's a bare-bones socket connection for Buzzen chat, that does nothing more than strip out style tags.

It's aimed at the 'scripter' market - people who want a connection they can mod.

It has NO flood protections, CTCP support, Version information, themes, raws, gate loggers, or tools of any kind.

There is only one dialog. A passport dialog.

It's under 100 lines, sans comments. It's fast, lean, and doesn't hold you back from doing whatever the shit you want.

There's no other connection for Buzzen that fits in to this category, which is the only reason I'm posting this one.

There's another smaller version, that's under 30 lines, and 1k in size. Use that one if you dare.

 

Onwards and upwards.

 

_______________________________________________________________________________
;Min-i-mal-ism
;Barebones socket relay for BCN.
;~av0ider_
_______________________________________________________________________________

;--Events.

on *:start:go


on *:socklisten:n.i:{ sockaccept n.l | sockclose n.i | sockopen n.s 24.215.5.3 6667 }


on *:sockread:n.s:{
  while ($sock(n.s).rq) {

    var %r | sockread %r
    if ($sockbr = 0) { halt }

    tokenize 32 $regsubex(%r,/(\[style (ff:.+?;|(bg)?co:.+?;|[ubi];)*?\]|\[\/style\])/ig,$null)

    if ($2 = WHISPER) { l $1 PRIVMSG $4- }

    l $1-
  }
}


on *:sockread:n.l:{

  while ($sock(n.l).rq) {
    var %r | sockread %r | tokenize 32 %r

    if ($sockbr = 0) { halt }
    if ($1 = USER) { w n.s loginh %u %p }
    if ($1 = PRIVMSG) && ($left($2,1) != $chr(37)) { w n.s WHISPER $comchan($2,1) $2 $3- }
    if ($1 = JOIN) && ($numtok($2,44) > 1) { w n.s JOIN $numtok($1,44) }

    if ($sock(n.s)) { w n.s $1- }

  }
}

;_______________________________________________________________________________

;Aliases.

;-w for Wait/Write
alias w {
  if ($sock($1).status != active) { .timer -m 1 10 w $1- | halt }
  sockwrite -n $1- | halt
}

;-l for Local-sockwrite.
alias l { sockwrite -n n.l $1- | halt }

;-Go for going!
alias go {

  if ($sock(n.*)) { sockclose n.* }
  if ((!%p) || (!%u)) { 

    echo -d * Username and/or password not set. 

    .disconnect 

    pport

    halt

  }

  socklisten n.i
  .server localhost $sock(n.i).port

}
_______________________________________________________________________________

;One and only dialog.

alias pport { dialog -m tblpassport tblpassport }


dialog tblPassport {

  title "Passport Information [/pport]"
  option dbu toolbar

  size                    -1  -1  120  40
  text   "Address:",  1,   5   5   28   8, right
  text   "Password:", 2,   5  16   28   8, right
  edit   "",          3,  33   4   85  10
  edit   "",          4,  33  15   85  10, pass
  button "Okay",      5,   4  26  114  11, flat
}

on *:dialog:tblpassport:sclick:5: {

  if (%u != $did(3)) && ($did(3)) set %u $did(3)
  if (%p != $md5($did(4))) && ($did(4)) set %p $md5($did(4))

  go

  dialog -x $dname

}

;_______________________________________________________________________________
;EOF
;~av0ider_

 

 

Link to comment
Share on other sites

  • Replies 38
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...