[Gambas-user] IRC, telnet etc

pezz perrymou at ...370...
Sun Feb 29 14:15:04 CET 2004


Well, as time allows I'll be working on the IRC client. I did write a 
full-featured client in VB a few years ago. Presently I'm trying to remember 
the routine for converting long IP addresses to dotted, for initialising DCC 
transfers.

My coding is untidy. Presently I'm using a listbox as a "buffer" for incoming 
data like this:

PUBLIC SUB MySock_Read()

  DIM S AS String
  IF MySock.Status=Net.Connected THEN
      READ #MySock,S,Lof(MySock)
      getline(S)
 END IF
END

PRIVATE SUB getline(S AS String)
intc AS Integer
stra AS String
strr AS String

S = strr & S
FOR intc = 1 TO Len(S)
'look for spaces or carriage returns in a line of received text:
IF Mid(S, intc, 1) = Chr(13) OR Mid(S, intc, 1) = Chr(10) THEN
stra = Mid(S, 1, intc)
'IF the data IS one complete line, add to the listbox/buffer:
ListBox1.Add (stra)
S = Mid(S, intc + 1)
intc = 1
END IF
NEXT
strr = S
 
END

A parse routine under a timer then deals with text from the listbox, line by 
line, removing the item from the textbox once it's been parsed. If anyone 
knows a neater way of doing this, I'd appreciate the help (not being the most 
advanced Gambas coder)!

Next problem is adding channel users to a listbox. On the face of it, this 
should be easy, as the server sends a "353", then a space, then your nick 
when it spits out the userlist on JOIN channel:

:Elsene.Be.Eu.undernet.org 353 pezz = #london :Ortega53_ Kinisha66 costas23 
Green-eye SweetBaBE tina- armo29 rechin raaajs ghost23 FiLiPiNa_ FILOLOG 
VENUS30 cuteguy- Alex_BSB Liezel Nikki^ DJ_GEORGE Redbull^^ NeonDemon Magda}{ 
fresheyes anusah53 cricrom petru3 arabgirl gypsy_22 maviyesil [Danutz] 
njapalona mittu peAch_ X_Tray` costin1 Dream4U DAVID^_^ Mccools HandsomeM 
carbunitz hello` maxx` liz oceanos L_ucy x-tazy Zephaniah Legolas{} +Jazz^ 
GLEE27 zafer Dan_Brazi Neha-Noor rty laura_26

Then of course, once in the channel, users joining or leaving have to be 
added/removed from the list.

I've made a start, but there's a lot of unwanted stuff ending up in the 
listbox as well as users.

All part of the learning curve.

pezz





More information about the User mailing list