Buddy List

By mountaindew on Sep 21, 2007

This is a buddy list i made for mirc, because I figured that the notifier wasn't good enough. Also, I haven't seen anyone else make one, so i decided to. Basically, just type /bl to open up the buddy list, or right click, and click buddy list. All the help you need is in the "help" tab. The online nicks go in the online section, and the offline nicks go in the offline section. Double click an online nick to msg it, or click the nick and click the "user info" button and it directs you to the "user info" tab to see a whois of that nick, and you are able to join his/her channels, or even set if you want to kick/ban/aop/aov them when they join any of your channels. I really hope you like this, it's my first "real" dialog. (the only other one was a little 8ball one cuz i was bored :P) Enjoy.

menu * {
  Buddy List: bl
}
alias bl {
  if ($server) {
    .notify on
    if (!$dialog(buddylist)) dialog -m buddylist buddylist
    if ($dialog(buddylist)) { dialog -x buddylist buddylist | dialog -m buddylist buddylist }
    if ($readini(buddylist.ini,reload,time) == off) did -c buddylist 58
    if ($readini(buddylist.ini,reload,time) == 30) did -c buddylist 38
    if ($readini(buddylist.ini,reload,time) == 60) did -c buddylist 52
    if ($readini(buddylist.ini,reload,time) == 300) did -c buddylist 53
    if ($readini(buddylist.ini,reload,time) == 600) did -c buddylist 54
    if ($readini(buddylist.ini,reload,time) == 900) did -c buddylist 55
    if ($readini(buddylist.ini,connect,status) == on) did -c buddylist 6
    if ($readini(buddylist.ini,reload,time) isnum 60- && $readini(buddylist.ini,reload,time) != 30 && $readini(buddylist.ini,reload,time) != 60 && $readini(buddylist.ini,reload,time) != 300 && $readini(buddylist.ini,reload,time) != 600 && $readini(buddylist.ini,reload,time) != 900) {
      did -c buddylist 65
      did -vra buddylist 65 $calc($readini(buddylist.ini,reload,time) / 60) Minutes
    }
    writeini buddylist.ini connect status off
    var %not = 1
    while (%not <= $notify(0)) {
      if ($notify(%not).ison) did -a buddylist 8 $notify(%not)
      if (!$notify(%not).ison) did -a buddylist 9 $notify(%not)
      inc %not
    }
  }
  else {
    if (!$dialog(server)) dialog -m server server
    if ($dialog(server)) haltdef
  }
}
dialog buddylist {
  title "Buddy List"
  size -1 -1 216 217
  option dbu
  tab "Buddy List", 12, 1 2 211 212
  box "Online", 1, 10 42 55 125, tab 12
  list 8, 13 50 49 114, tab 12 sort size vsbar
  button "Remove Buddy", 5, 16 170 40 12, disable tab 12
  button "Remove Buddy", 11, 147 170 40 12, disable tab 12
  list 9, 143 50 49 114, tab 12 sort size vsbar
  box "Offline", 2, 140 42 55 125, tab 12
  button "Add Buddy", 4, 79 69 40 12, tab 12
  text "Buddy List", 3, 86 27 25 8, tab 12 center
  button "Clear List", 62, 79 132 40 12, tab 12
  button "User Info", 29, 79 102 40 12, disable tab 12
  tab "Settings", 13
  check "Show Buddy List On Connect", 6, 13 55 83 10, tab 13
  text "Buddy List Settings", 32, 70 27 53 8, tab 13
  box "Connect", 14, 11 47 88 21, tab 13
  box "Reload", 15, 11 68 68 122, tab 13
  radio "30 Seconds", 38, 19 89 50 10, tab 13
  radio "1 Minute", 52, 19 104 50 10, tab 13
  radio "5 Minutes", 53, 19 119 50 10, tab 13
  radio "10 Minutes", 54, 19 134 50 10, tab 13
  radio "15 Minutes", 55, 19 149 50 10, tab 13
  radio "Other", 56, 19 179 50 10, tab 13
  box "Settings", 57, 4 37 130 156, tab 13
  radio "Never", 58, 19 74 50 10, tab 13
  radio "Radio Button", 65, 19 164 50 10, hide tab 13
  tab "User Info", 26
  box "User@Host", 18, 66 89 143 23, tab 26
  list 20, 68 97 139 12, tab 26 size
  box "Away Message", 21, 70 114 139 21, tab 26
  box "Channels", 23, 6 40 59 135, tab 26
  list 25, 7 48 56 124, tab 26 sort size vsbar
  check "Op", 16, 74 50 19 10, disable tab 26
  box "Auto", 19, 70 43 31 45, tab 26
  check "Voice", 17, 74 59 23 10, disable tab 26
  button "Join", 24, 14 179 40 12, disable tab 26
  list 30, 108 61 92 14, tab 26 size
  box "Idle Time", 31, 105 53 102 26, tab 26
  list 33, 97 25 58 11, tab 26 size
  button "Msg", 34, 75 178 30 10, disable tab 26
  button "Notice", 35, 125 178 30 10, disable tab 26
  box "Nick", 36, 50 17 111 22, tab 26
  button "Invite", 37, 175 178 30 10, disable tab 26
  text "User Info For", 10, 63 27 33 8, tab 26 center
  list 22, 73 122 134 11, tab 26 size
  box "CTCP", 27, 70 137 140 30, tab 26
  button "Version", 59, 128 156 22 9, disable tab 26
  list 61, 72 145 134 10, tab 26 size
  button "Ping", 28, 76 156 22 9, disable tab 26
  button "Time", 60, 181 156 22 9, disable tab 26
  box "Msg Center", 63, 71 169 139 23, tab 26
  check "Kick", 66, 74 67 23 10, disable tab 26
  check "Ban", 67, 74 76 25 10, disable tab 26
  tab "Help", 39
  text "Buddy List Help", 41, 72 27 55 8, tab 39
  text "*To add a buddy, click Add Buddy and type in a buddy", 40, 4 39 183 8, tab 39
  text "*To remove a buddy, click it, and click Remove Buddy under the listbox the nick is in", 43, 4 50 206 8, tab 39
  text "*The buddies online will go in the online section", 50, 4 63 189 8, tab 39
  text "*The buddies offline will go in the offline section", 44, 4 77 189 8, tab 39
  text "*In The Settings tab, you can set settings such as reload time and show on connect", 51, 4 90 206 8, tab 39
  text "*To Refresh the buddy list, click refresh", 49, 4 102 190 8, tab 39
  text "*To see info about a selected online buddy, double click the name & click User Info", 48, 4 115 201 8, tab 39
  text "*The User Info tab contains: idle time, name, channels, away msg, and user@host", 47, 4 129 203 8, tab 39
  text "*You can click a channel the buddy is in, and click join", 46, 4 142 191 8, tab 39
  text "*To msg/notice/invite the nick to a channel, click the appropriate button", 45, 4 155 190 8, tab 39
  text "*Check op/voice to auto op/voice the chosen nick in every channel you are in", 42, 4 167 200 8, tab 39
  text "*You can also double click a name to send a message to them", 64, 4 178 200 8, tab 39
  button "OK", 7, 79 198 40 12, ok cancel
  button "Refresh", 68, 3 203 26 10
  button "Help", 69, 184 203 26 10
}
dialog server {
  title "Choose A Server"
  size -1 -1 84 77
  option dbu
  combo 1, 12 23 60 50, size drop
  text "Choose A Server or Type One In", 2, 16 2 51 16, center
  edit "", 3, 3 51 50 10, autohs
  button "Connect", 4, 27 36 26 8
  button "Connect", 5, 56 52 26 8
  button "Cancel", 6, 28 66 22 8, ok cancel
}
on *:dialog:server:init:0:{
  var %servers = Undernet Quakenet Dalnet SwiftIRC Efnet  didtok server 1 32 %servers
  did -b server 4,5
}
on *:dialog:server:sclick:*:{
  if ($did == 1 && $did(server,1).text != $null) {
    did -e server 4
    if ($did(server,1).seltext == Undernet) writeini buddylist.ini server server mesa.az.us.undernet.org
    if ($did(server,1).seltext == Quakenet) writeini buddylist.ini server server us.quakenet.org
    if ($did(server,1).seltext == Dalnet) writeini buddylist.ini server server irc.dal.net
    if ($did(server,1).seltext == SwiftIRC) writeini buddylist.ini server server irc.swiftirc.net
    if ($did(server,1).seltext == Efnet) writeini buddylist.ini server server irc.efnet.net
  }
  if ($did == 4) { server $readini(buddylist.ini,server,server) | writeini buddylist.ini server status on | dialog -k server server }
  if ($did == 5) { server $did(server,3).text | writeini buddylist.ini server status on | dialog -k server server }
}
on *:dialog:server:edit:3:{
  if ($did(server,3).text != $null) did -e server 5
  if ($did(server,3).text == $null) did -b server 5
}
on *:connect:{
  if ($readini(buddylist.ini,server,status) == on) { .timer 1 2 bl | writeini buddylist.ini server off }
  .notify on
  if ($readini(buddylist.ini,connect,status) == on) .timer 1 2 bl
}
on *:join:#:{
  if ($me isop $chan) {
    if ($readini(buddylist.ini,aop,$nick) == yes) mode $chan +o $nick
    if ($readini(buddylist.ini,aov,$nick) == yes) mode $chan +v $nick
    if ($readini(buddylist.ini,kick,$nick) == yes) kick $chan $nick Settings in my buddy list say I shall kick you.
    if ($readini(buddylist.ini,ban,$nick) == yes) ban $chan $address($nick,2) Settings in my buddy list say I shall ban you.
  }
}
on *:load: window -o @Thanks 100 200 300 100 | aline @Thanks Thank you for using MountainDew's Buddy List!
raw *:*:{
  if ($numeric == 311) did -ra buddylist 20 $3 $+ @ $+ $4
  if ($numeric == 319) { var %channels $3- | did -r buddylist 25 | didtok buddylist 25 32 %channels }
  if ($numeric == 317) did -ra buddylist 30 $duration($3-,2) 
  if ($numeric == 301) did -ra buddylist 22 $3-
  if ($numeric == 403) { join $mid($2,2,$calc($len($2) - 1)) | haltdef }
}
on *:ctcpreply:*:{
  if ($1 == version) did -ra buddylist 61 $2-
  if ($1 == time) did -ra buddylist 61 $2-
  if ($1 == ping) did -ra buddylist 61 $calc($ctime - $2-) second(s)
}
on *:input:*: if ($1 == /notify && $2 == off) .timer 1 1 .notify on
on *:dialog:buddylist:sclick:*:{
  if ($did == 68) bl
  if ($did == 8) {
    did -u buddylist 16,17,66,67
    did -e buddylist 5,16-17,34-35,37,28,59-60,66-67,29
    did -r buddylist 25,61
    did -ra buddylist 33 $did(buddylist,8).seltext
    whois $did(buddylist,8).seltext $did(buddylist,8).seltext
  }
  if ($did == 25) did -e buddylist 24
  if ($did == 9) did -e buddylist 11
  if ($did == 5) {
    echo $$?!="Are you sure you would like to remove $did(buddylist,8).seltext $+ ?"
    if ($! == $true) { notify -r $did(buddylist,8).seltext | bl }
  }
  if ($did == 11) {
    echo $$?!="Are you sure you would like to remove $did(buddylist,9).seltext $+ ?"
    if ($! == $true) { notify -r $did(buddylist,9).seltext | bl }
  }
  if ($did == 56) {
    var %b4 = $$?="How many minutes?" 
    if (%b4 !isnum 1- || %b4 <= 0) halt
    else {
      writeini buddylist.ini Reload time $calc(%b4 * 60) 
      did -cv buddylist 65
      did -u buddylist 56
      did -ra buddylist 65 $calc($readini(buddylist.ini,reload,time) / 60) Minutes
    }
  }
  if ($did == 38 || $did == 58 || $did isnum 52-55) {
    did -h buddylist 65 | bl | did -f buddylist 13
    if ($did == 38) writeini buddylist.ini Reload time 30
    if ($did == 52) writeini buddylist.ini Reload time 60
    if ($did == 53) writeini buddylist.ini Reload time 300
    if ($did == 54) writeini buddylist.ini Reload time 600
    if ($did == 55) writeini buddylist.ini Reload time 900
    if ($did == 58) writeini buddylist.ini Reload time off
  }
  if ($did == 28) ctcp $did(buddylist,8).seltext ping
  if ($did == 59) ctcp $did(buddylist,8).seltext version
  if ($did == 60) ctcp $did(buddylist,8).seltext time
  if ($did == 34) query $did(buddylist,8).seltext
  if ($did == 35) notice $did(buddylist,8).seltext $$?="Notice?"
  if ($did == 62) {
    echo $$?!="Are you sure you would like to clear buddy list?"
    if ($! == $true) {
      while ($notify(1)) {
        notify -r $ifmatch
      }
    }
    bl
  }
  if ($did == 37) {
    var %chan = $$?="Channel?"
    if ($me isop %chan && $did(buddylist,8).seltext !ison %chan) invite $did(buddylist,8).seltext %chan
  }
  if ($did == 24) if ($me !ison $did(buddylist,25).seltext) join $did(buddylist,25).seltext
  if ($did == 6) {
    if ($did(buddylist,6).state == 1) writeini buddylist.ini connect status on
    if ($did(buddylist,6).state == 0) writeini buddylist.ini connect status off
  }
  if ($did == 4) {
    notify $$?="Who would you like to add?"
    .timer 1 1 bl
  }
  if ($did == 16) {
    if ($did(buddylist,16).state == 1) writeini buddylist.ini $did(buddylist,8).seltext aop yes
    if ($did(buddylist,16).state == 0) writeini buddylist.ini $did(buddylist,8).seltext aop no
  }
  if ($did == 17) {
    if ($did(buddylist,17).state == 1) writeini buddylist.ini $did(buddylist,8).seltext aov yes
    if ($did(buddylist,17).state == 0) writeini buddylist.ini $did(buddylist,8).seltext aov no
  }
  if ($did == 66) {
    if ($did(buddylist,66).state == 1) writeini buddylist.ini $did(buddylist,8).seltext kick yes
    if ($did(buddylist,66).state == 0) writeini buddylist.ini $did(buddylist,8).seltext kick no
  }
  if ($did == 67) {
    if ($did(buddylist,67).state == 1) writeini buddylist.ini $did(buddylist,8).seltext ban yes
    if ($did(buddylist,67).state == 0) writeini buddylist.ini $did(buddylist,8).seltext ban no
  }
  if ($did == 26) {
    if ($did(buddylist,8).seltext != $null && $readini(buddylist.ini,$did(buddylist,8).seltext,aop) == yes) did -c buddylist 16
    if ($did(buddylist,8).seltext != $null && $readini(buddylist.ini,$did(buddylist,8).seltext,aov) == yes) did -c buddylist 17
    if ($did(buddylist,8).seltext != $null && $readini(buddylist.ini,$did(buddylist,8).seltext,kick) == yes) did -c buddylist 66
    if ($did(buddylist,8).seltext != $null && $readini(buddylist.ini,$did(buddylist,8).seltext,ban) == yes) did -c buddylist 67
  }
  if ($did == 29) {
    did -f buddylist 26
    if ($did(buddylist,8).seltext != $null && $readini(buddylist.ini,$did(buddylist,8).seltext,aop) == yes) did -c buddylist 16
    if ($did(buddylist,8).seltext != $null && $readini(buddylist.ini,$did(buddylist,8).seltext,aov) == yes) did -c buddylist 17
    if ($did(buddylist,8).seltext != $null && $readini(buddylist.ini,$did(buddylist,8).seltext,kick) == yes) did -c buddylist 66
    if ($did(buddylist,8).seltext != $null && $readini(buddylist.ini,$did(buddylist,8).seltext,ban) == yes) did -c buddylist 67
  } 
  if ($did == 69) did -f buddylist 39
}
on *:dialog:buddylist:dclick:8: query $did(buddylist,8).seltext
on *:dialog:buddylist:init:0: if ($readini(buddylist.ini,reload,time) != off) .timerreload 0 $readini(buddylist.ini,reload,time) bl
on *:dialog:buddylist:close:*: .timerreload off
on *:disconnect: if ($dialog(buddylist)) dialog -k buddylist buddylist

Comments

Sign in to comment.
Warriorii   -  Dec 21, 2010

great script, I have it loaded now, but when i do a regular whois on someone i get this msg in my status window===> * /did: invalid parameters (line 155, Buddy-List.mrc)

More
 Respond  
tzar469   -  Feb 08, 2008

I thought I saw a script around here with that capability so I assumed it is possible. Let me see if I can find it.

More
 Respond  
mountaindew   -  Feb 07, 2008

Can this notify you if nicks on servers that you are not currently on sign in? If not, can you add it?

umm...that duznt make sense

how would you see if they sign on another network if you aren\'t on it?

More
 Respond  
mountaindew   -  Feb 07, 2008

yea this script was quite a while ago, i should have made it hash tables also. when i get some time, i\'ll do some recoding, and thanks for ur advice, glad you like it :)

More
 Respond  
Lindrian   -  Feb 07, 2008

Looks like a great script indeed. But you can save alot of bytes by using $replace(), $iif() and shortcut aliases. For example, instead of

if ($readini(buddylist.ini,reload,time) == 300)

All the time, you can do:

alias -l bini return $iif($readini(buddylist.ini,$1,$2),$true,$false)
and then use
if ($bini(reload,time)) == 300)

Etc, makes it alot shorter.

And for the part where you use

    if ($readini(buddylist.ini,reload,time) == off) did -c buddylist 58

, you can just use $replace. eg: $replace(,off,58,something,else) and so on. Also makes it alot shorter.

    if (!$dialog(buddylist)) dialog -m buddylist buddylist
    if ($dialog(buddylist)) { dialog -x buddylist buddylist | dialog -m buddylist buddylist }
can be made
dialog $iif($dialog(buddylist),-v,-m) buddylist buddylist

And so on. Ive just commented by looking at the code, not testing it. IM at work, som im a lil busy.

Good luck and good job though!

More
 Respond  
tzar469   -  Feb 07, 2008

Can this notify you if nicks on servers that you are not currently on sign in? If not, can you add it?

More
 Respond  
mountaindew   -  Jan 22, 2008

Thanks Xitr0

More
 Respond  
Xitr0   -  Jan 21, 2008

Nice Job Mountaindew.

More
 Respond  
mountaindew   -  Jan 15, 2008

thanks

More
 Respond  
CharltonJ   -  Jan 15, 2008

nice dude good job! :P

More
 Respond  
mountaindew   -  Sep 27, 2007

ty saltypeanuts :D

More
 Respond  
mountaindew   -  Sep 26, 2007

i think ill just keep it the way it is, so i dont have to move around the help button

More
 Respond  
mountaindew   -  Sep 26, 2007

yea, i need a visual im not understanding...ill look at it

More
 Respond  
Scakk   -  Sep 26, 2007

Menu yes.

Example of what I was talking abotu is on my Calculator dialog ( http://www.hawkee.com/snippet/2954/ )

More
 Respond  
mountaindew   -  Sep 26, 2007

i dont really think i have to on the first one

More
 Respond  
mountaindew   -  Sep 26, 2007

do you mean menu?

More
 Respond  
Scakk   -  Sep 26, 2007

The only thing I can see asthetically is the open space on the first and second tabs ( Users & Settings). Are you going to add more to them? If not may I suggest you using the Manu option then you can choose which one to open and have it size itself accordingly.

More
 Respond  
mountaindew   -  Sep 26, 2007

lol ty

More
 Respond  
Saeed   -  Sep 26, 2007

Ah yes I see. Didn\'t read the dialog carefully. It turns out that that the did -e does not work for the second list because the user isn\'t online. I guess I deserve a slap in the face for that one. Well anyway, nice coding.

More
 Respond  
mountaindew   -  Sep 26, 2007

(theyre list boxes)

More
 Respond  
mountaindew   -  Sep 26, 2007

1) i put dots in front of notify and timers, so it shuoldnt go to status anymore

2) those arent edit boxes, they just show a whois of the person you click that is online

More
 Respond  
Saeed   -  Sep 26, 2007

It seems to flood my status window with:

  • Notify is on

  • Timer reload activated

I also cannot edit things in the User Info tab. This is because you only enable the Remove buddy button on your did -e event on line 175. If you did get that working, it still wouldn\'t display the user in the editbox.

More
 Respond  
mountaindew   -  Sep 26, 2007

there was a minor bug with a variable, it was loading the dialog on connect always, but i put that and %server in the ini also, so all set

More
 Respond  
mountaindew   -  Sep 26, 2007

thanks token and akishoot :P

scackk, ty for pointing that out, i updated it

More
 Respond  
Scakk   -  Sep 25, 2007

When you click the Radio Button \" Other \" for time fram you can enter a long string of number. Also youcan enter letters. If you enter letters if will return the time of 0 minutes. Then it will enter a nasty recurring loop and you will not be able use it again with out removing the .ini file itself. So I changed

  if ($did == 56) {
    var %b4 = $$?=\"How many minutes?\" 
    if (%b4 isalpha) { halt } 
    if (%b4 isalnum) { halt }
    writeini buddylist.ini Reload time $calc(%b4 * 60) 
    did -cv buddylist 65
    did -u buddylist 56
    did -ra buddylist 65 $calc($readini(buddylist.ini,reload,time) / 60) Minutes
  }

to be the below and it fixed that issue for me anyway.

  if ($did == 56) {
    var %b4 = $$?=\"How many minutes?\" 
    if ((%b4 !isnum) || (%b4 <= 0)) { halt } 
    else {
      writeini buddylist.ini Reload time $calc(%b4 * 60) 
      did -cv buddylist 65
      did -u buddylist 56
      did -ra buddylist 65 $calc($readini(buddylist.ini,reload,time) / 60) Minutes
    }
  }
More
 Respond  
token   -  Sep 25, 2007

looks as lot better now =P

More
 Respond  
Akishoot   -  Sep 25, 2007

Again, nice work on the script mountaindew. =)

More
 Respond  
mountaindew   -  Sep 25, 2007

there was a little problem with the show on connect, the buddies werent coming up, but i fixd it

More
 Respond  
mountaindew   -  Sep 25, 2007

~~UPDATES~~

All global variables are removed, i used a .ini file instead All sclick\'s, raws, and ON CTCP REPLY\'s are together Fixed timer, didtok, and disconnect bug Added a mini dialog, which pops up if you do /bl when it aint connected. it lets you choose a server from a list, or type in another server, and it connects to it.

More
 Respond  
token   -  Sep 25, 2007

Eh it\'s okay. I would make use of an ini file or hash table as Kyousoukyoku has clearly stated.

More
 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.