Yahoo Room Socket List Grabber w/Dialog

By evil-critter on Dec 14, 2009

This snippet, Gets an updated list of yahoo chat rooms. It adds a popup to the status to open a dialog. Once the dialog opens, a socket to yahoo rooms list is opened (insider.msg.yahoo.com) and retrieves the category list right away, and lists the categories into the dialog left window (after some /filtering and writing files). Double clicking inside the left window on a category will open another socket to fetch a rooms list under that category. Double clicking in the right window will only make the selected line echo to the status window.
When the dialog closes it removes the files it created and left over variables it made.
couple things,
sometimes if the rooms list is long it lags a bit, just wait it will load.
if the rooms list has no rooms there is a '/filter' error.
(seems to only happen under the baseball category shrug)
Tested only by me so far.
That's it! Use it to make a yahoo chat addon or whatever you want.

i fixed that remove file error ( i hope), i could have made just another alias to handle removing files as i need them. I'm trying to make this simple to understand especailly for ppl brand new to mirc (aka yahoo ppl). i used some unsual methods so ppl can get an idea of how they work.

;==Get List Of Yahoo! Rooms==
;==Load or paste this script into a new remote section of mIRC.
;==if you have the Y!Roomlist.mrc file and want to load it make sure its in your mirc directory 
;==check using -> //echo -a $mircdir $exists(Y!Roomlist.mrc)
;==if you get a $true response to load the file type--> /load -rs Y!Roomlist.txt
;==Once it's loaded,In The Status window there will be a popup to open the room list dialog.
;==Alternatively you can just paste the script into any blank remotes section, save as and name it anything you want.
;==The popup in the status should appear when you right click in the window, if it doesnt type--> /dialog -m yahrooms yahroom to open the dialog.
alias -l get.rooms { sockopen $1 209.191.120.30 80 }
alias -l y.rooms return $+(GET /ycontent/?chatroom_,%the.cat,$chr(32),HTTP/1.0,$crlf,Host: insider.msg.yahoo.com,$crlf,Accept-Language: en,$crlf,Accept: */*,$crlf,User-Agent: Mozilla/4.0 (compatible; mIRC6.35),$crlf,Cache-Control: no-cache,$crlf,Connection: close,$crlf,$crlf)
alias -l y.cats return $+(GET /ycontent/?chatcat,$chr(32),HTTP/1.0,$crlf,Host: insider.msg.yahoo.com,$crlf,Accept-Language: en,$crlf,Accept: */*,$crlf,User-Agent: Mozilla/4.0 (compatible; mIRC6.35),$crlf,Cache-Control: no-cache,$crlf,Connection: close,$crlf,$crlf)
on *:sockclose:*yhrm.*: { 
  if ($sockname == yhrm.cats) { filter -ffc tmpcatlst.txt tmpcatlst.txt *id=* | cln.cat }
  if ($sockname == yhrm.rooms) { cln.room }
}
on *:sockopen:*yhrm*: {
  if ($sockname == yhrm.rooms) { sockwrite $sockname $y.rooms }
  if ($sockname == yhrm.cats) { sockwrite $sockname $y.cats }
}
on *:sockread:*yhrm*: {
  if ($sockerr > 0) return 
  sockread -f $sock(ysl).rq &ysl 
  var %len $bvar(&ysl,0).text 
  breplace &ysl 60 32 62 32 47 32 
  if ($sockname == yhrm.rooms) { 
    var %tmproomlst = $gettok($bvar(&ysl,1,%len).text,$numtok($bvar(&ysl,1,%len).text,13),13) 
    write tmproomlst.txt $replace(%tmproomlst,',')    
  }
  if ($sockname == yhrm.cats) { 
    var %tmpcatlst = $gettok($bvar(&ysl,1,%len).text,$numtok($bvar(&ysl,1,%len).text,13),13) 
    if ($bfind(&ysl,1,category id=").text) { write tmpcatlst.txt $replace(%tmpcatlst,&,&,',') }  
  }
}
;=================================================
dialog YahRooms {
  title "YahooRooms"
  size -1 -1 644 247
  option pixels notheme
  list 1, 9 31 233 220
  list 2, 250 31 384 220
  text "MAIN CATEGORIES (doubleclick)", 3, 9 6 226 22, center
  text "ROOMS (Lobbies)", 4, 242 6 226 20, center
  text "", 5, 475 6 159 17, center
}
on *:dialog:YahRooms:init:0: { 
  if ($exists(tmpcatlst.txt)) { .remove tmpcatlst.txt }
  if ($exists(tmproomlst.txt)) { .remove tmproomlst.txt }
  get.rooms yhrm.cats 
}
on *:dialog:YahRooms:dclick:1: { did -o yahrooms 5 1 LOADING ROOMS | set %the.cat $gettok($did(yahrooms,1).seltext,1,32) |  .remove tmproomlst.txt | $get.rooms(yhrm.rooms) }
on *:dialog:YahRooms:dclick:2: { echo -s $did(yahrooms,2).seltext }
alias -l cln.cat {
  var %cln.cat 1
  while (%cln.cat <= $lines(tmpcatlst.txt)) {
    did -i yahrooms 1 %cln.cat $remove($read(tmpcatlst.txt,%cln.cat),,category id=,name=,") 
    inc %cln.cat
  }
}
on *:dialog:YahRooms:close:0: {
  if ($exists(tmpcatlst.txt)) { .remove tmpcatlst.txt }
  if ($exists(tmproomlst.txt)) { .remove tmproomlst.txt }
  if ($exists(cleanroom.txt)) { .remove cleanroom.txt }
  unset %yrm_id
  unset %yrm_name
  unset %yrm_topic
  echo -s 12Cleaned up room list!
}
alias -l cln.room {
  did -r yahrooms 2
  .remove cleanroom.txt
  var %clean.rm 1
  while (%clean.rm <= $lines(tmproomlst.txt)) {
    var %lst.ln = $read(tmproomlst.txt,%clean.rm)
    if (id= isin %lst.ln) { set %yrm_name $gettok($read(tmproomlst.txt,%clean.rm),6,34) | set %yrm_id $gettok($read(tmproomlst.txt,%clean.rm),4,34) | set %yrm_topic $gettok($read(tmproomlst.txt,%clean.rm),8,34) }
    if (lobby count= isin %lst.ln) { 
      write cleanroom.txt $+(%yrm_name,$chr(58),$gettok(%lst.ln,2,34),$chr(58),%yrm_id Members:,$gettok(%lst.ln,4,34),$chr(32),Voice:,$gettok(%lst.ln,6,34),$chr(32),WebCam:,$gettok(%lst.ln,8,34)) 
    }
    inc %clean.rm
  }
  filter -fo cleanroom.txt yahrooms 2
  did -o yahrooms 5 1 DONE LOADING $did(yahrooms,2).lines ROOMS.
}
menu STATUS { 
  Yahoo! Rooms List:/dialog -m yahrooms yahrooms 
}

Comments

Sign in to comment.
montague   -  Mar 04, 2011
  • /sockwrite: 'yhrm.cats' not connected (line 20, Yahoo Room List.txt)

code line: if ($sockname == yhrm.cats) { sockwrite $sockname $y.cats }

while in the dialog, the box is empty.. it doesn't shows any room

damn..!

 Respond  
Aucun50   -  Dec 14, 2009

You might want to try "write -c file.txt" because you just end up making the file over and over, or you could use -d.

 Respond  
blitzz   -  Dec 14, 2009

This is very2 cool but it suddenly damaged when i try to click one of the MAIN CATEGORIES.

  • /remove: unable to remove 'C:\Documents and Settings\PC-1\Application Data\mIRC\tmpcatlst.txt' (line 46, script21.ini)
  • /remove: unable to remove 'C:\Documents and Settings\PC-1\Application Data\mIRC\tmproomlst.txt' (line 60, script21.ini)
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.