;--------------------------------------------------------------------------------------------------------------------------------
;msndialog.mrc
;Andy Carvell 2003
;Version 3.00
;--------------------------------------------------------------------------------------------------------------------------------


;***** DO NOT EDIT ANYTHING BELOW *****

dialog connect {
  title "Connect"
  size -1 -1 150 71
  option dbu
  icon $shortfn($scriptdir) $+ msn2.ico, 0
  text "Sign-In Name", 1, 5 5 40 10
  text "Password", 2, 6 25 40 10
  combo 3, 50 3 90 10
  edit "", 4, 50 23 90 10, pass
  text "eg. someone@hotmail.com", 5, 52 14 100 9
  check "Appear Offline on Connect", 6, 5 45 100 10
  icon 7, 130 53 150 150,  $shortfn($scriptdir) $+ msn.ico, 0
  button "Sign-In", 8, 50 57 40 10, ok
  check "Remember my username and password", 9, 5 36 107 10
}

dialog control {
  title "Control Panel"
  size -1 -1 216 201
  option dbu
  icon $shortfn($scriptdir) $+ msn.ico, 0
  button "Add User", 1, 5 10 40 10, flat
  button "Delete User", 2, 5 21 40 10, flat
  button "View Groups", 3, 99 9 50 10, flat
  button "Block Checker", 4, 99 20 50 10, flat
  button "Block User", 5, 47 10 40 10, flat
  button "Unblock User", 6, 47 21 40 10, flat
  button "Users see me typing?", 7, 150 20 60 10, flat
  button "Change MSN Name", 8, 150 9 60 10, flat
  button "View Conversation Logs", 9, 99 55 111 10, flat
  button "Turn Logging On/Off", 10, 150 31 60 10, flat
  button "Chat Window Style", 11, 5 68 84 10, flat
  box "MSN Users", 12, 1 1 91 35
  box "General", 13, 95 1 119 45
  box "Appearance", 14, 2 60 90 58
  box "Miscellaneous", 15, 95 47 119 46
  button "Proxy Settings", 16, 99 31 50 10, flat
  button "invisible", 17, 1 1 0 0, ok
  button "Enable", 18, 5 45 40 10, flat
  box "Sounds", 19, 2 37 90 21
  button "Disable", 20, 47 45 40 10, flat
  button "Settings", 22, 156 152 55 10, flat
  box "Display 'user has logged on' / 'toast' popups", 23, 96 166 119 22
  button "Enable / Disable", 24, 98 152 55 10, flat
  box "Fonts", 25, 2 119 91 21
  button "Messenger Window Font", 26, 5 127 84 10, flat
  button "Messenger Background", 27, 5 80 84 10, flat
  button "Automatically connect when mIRC starts", 28, 99 67 111 10, flat
  box "Set MSN away when I set away on IRC", 29, 95 95 119 22
  button "Enable", 31, 99 103 55 10, flat
  button "Disable", 32, 156 103 55 10, flat
  button "Reconnect to MSN when Disconnected", 30, 99 79 111 10, flat
  box "New Mail Notification", 33, 2 142 90 22
  button "Disable", 34, 49 150 40 10, flat
  button "Enable", 35, 5 150 40 10, flat
  button "Minimise on Connect", 21, 5 92 84 10, flat
  box "Chat Text Style", 36, 95 119 119 22
  button "MSN", 37, 99 127 55 10, flat
  button "IRC", 38, 156 127 55 10, flat
  box "Comment", 39, 2 166 91 22
  button "Send Comments to Author", 40, 5 174 84 10, flat
  button "Close", 41, 2 190 45 9, flat cancel
  box "Auto Idle", 42, 95 143 119 22
  button "Change Setting", 43, 98 175 113 10, flat
  button "Contact List Appearance", 44, 5 104 84 10, flat
  text MSN Messenger for mIRC v $+ $msnversion by carvell, 45, 103 191 112 8
}





dialog mail {
  title "New E-Mail Message"
  size -1 -1 90 35
  icon $shortfn($scriptdir) $+ msn.ico
  option dbu
  text %msn.newmail,1, 5 5 120 10
  button "Retreive",2, 5 20 35 10, ok
  button "Close",3, 45 20 35 10, cancel
}

dialog proxy {
  title "Proxy Settings"
  size -1 -1 131 112
  option dbu
  icon $shortfn($scriptdir) $+ msn.ico, 0
  box "HTTP Proxy", 8, 3 49 120 31
  text "Socks Server:", 10, 6 24 51 8
  text "Socks Port:", 11, 6 34 51 8
  edit %msn.server.socks.port, 12, 63 33 24 10
  edit %msn.server.socks, 13, 63 23 55 10
  box "Socks", 14, 3 15 120 33
  text "HTTP Proxy Server:", 15, 6 58 51 8
  text "HTTP Proxy Port:", 16, 6 68 51 8
  edit %msn.server.proxy.port, 17, 64 67 24 10
  edit %msn.server.proxy, 18, 64 57 55 10
  button "OK", 19, 24 98 37 12, ok
  radio "No Proxy", 20, 3 3 50 10
  radio "Socks", 21, 54 3 50 10
  radio "HTTP", 22, 104 3 50 10
  button "Cancel", 23, 69 98 37 12, cancel
  text "Note: You may not be able to talk to people behind Socks or HTTP Proxy, I'm working on it.", 2, 3 81 126 15
}

dialog filerecv {
  title "Receiving File....."
  size -1 -1 150 46
  option dbu
  icon $shortfn($scriptdir) $+ msn.ico, 0
  text %msn.file.filename.spaces, 1, 2 1 145 8
  text "100% received", 2, 2 10 46 9
  text "File is received.", 3, 2 19 102 8
  text "Your file was received successfully. You may now close this dialog.", 4, 2 28 143 15
  button "Cancel", 5, 110 15 37 12
}

dialog filesend {
  title "Sending File....."
  size -1 -1 150 30
  option dbu
  icon $shortfn($scriptdir) $+ msn.ico, 0
  text %msn.filename.file, 1, 2 1 145 8
  text "100% sent", 2, 2 10 46 9
  text "File has been sent successfully.", 3, 2 19 102 8
  button "Cancel", 5, 110 15 37 12
}

dialog new_version {
  title "New Version"
  size -1 -1 184 37
  option dbu
  text "There is a new version of MSN Messenger for mIRC available to download.", 1, 1 2 183 8
  text "Would you like to download this new version?", 2, 1 13 182 8
  button "Yes", 4, 49 24 37 12, flat
  button "No", 5, 94 24 37 12, flat
}

dialog comment {
  title "Send Comment"
  size -1 -1 242 78
  option dbu
  edit "", 1, 60 24 86 11
  text "Your Name:", 2, 3 26 32 8
  text "You can use the form below to send comments and/or suggestions to the author of mIRC.  The comments posted will be checked periodically, every comment is read and suggestions are acted upon.", 3, 3 1 238 22
  text "Your E-mail address:", 4, 3 39 53 8
  edit "", 5, 60 38 86 11
  edit "", 6, 60 51 180 11
  text "Your Comment:", 7, 3 51 44 9
  button "Send to Author", 8, 198 64 42 12, flat ok
  text "Note that measures are in place to prevent the abuse of this system.", 9, 3 65 170 9
}

on *:dialog:filerecv:init:*:{
  did -h filerecv 3
  did -h filerecv 4
  did -o filerecv 2 1 0% completed
}

on *:dialog:filerecv:init:*:{
  did -h filerecv 3
  did -h filerecv 4
  did -o filerecv 2 1 0% completed
}

on *:dialog:filesend:init:*:{
  did -h filerecv 3
  did -o filerecv 2 1 0% completed
}

on *:dialog:filerecv:sclick:5:{
  if ( $sock(msnfile) != $null ) {
    sockwrite -n msnfile 100
    sockclose msnfile
  }
  dialog -x filerecv
}

on *:dialog:filesend:sclick:5:{
  if ( $sock(filesend) != $null ) {
    sockwrite -n filesend 100
    sockclose filesend
  }
  dialog -x filesend
}

on *:dialog:connect:sclick:8:{
  set %msn.user $did(3)
  set %msn.pass $did(4)
  set %msn.chg $did(6).state
  set %msn.rememberpass $did(9).state
  dialog -x connect
  msnstart
}

on *:dialog:control:sclick:*:{
  if ( $did == 1 ) { addmsnuser $input(Enter the e-mail address of the user you wish to add:,5,Add User) }
  if ( $did == 2 ) { delmsnuser $input(Enter the e-mail address of the user you wish to delete:,5,Delete User) }
  if ( $did == 3 ) { 
    set %msn.temp $dll($shortfn($scriptdir) $+ listfiles.dll, setoutput, <fname>)
    set %msn.temp $dll($shortfn($scriptdir) $+ listfiles.dll,listfiles, fhs* > $mircdirmsn\groups.grp > $shortfn($scriptdir) $+ groups)
    set %msn.counter 0
    while ($lines($mircdirmsn\groups.grp) > %msn.counter) {
      inc %msn.counter
      set %msn.group.file $read( $shortfn($scriptdir) $+ groups.grp , %msn.counter )
      window -k0 @ $+ $gettok(%msn.group.file,1,46)
      set %msn.counter2 0
      while ($lines($shortfn($scriptdir) $+ groups\ $+ %msn.group.file) > %msn.counter2) {
        inc %msn.counter2
        aline @ $+ $gettok(%msn.group.file,1,46) $read($shortfn($scriptdir) $+ groups\ $+ %msn.group.file, %msn.counter2))
      }
    }
    renwin @grp @Not_on_List
  }
  if ( $did == 4 ) { 
    set %msn.message A few notes about the block checker. $crlf $crlf $+ The block checker works by trying to establish a conversation with the target e-mail address, if the conversation can be established then the user is really online, if the conversation cannot be established then the user has either set it so that only people on their contact list can contact them, or they are really offline.  Most likely they are really offline. $crlf $crlf $+ It is not 100% guaranteed that it will show if the user is online, but if they come back as being online, then you can be 100% certain that they are online. $crlf $crlf $+ The user will not know that you are checking if they use the official client, if they are using MSN for mIRC, then a chat window will appear.
    set %msn.temp $input(%msn.message,4,Block Checker)
    set %msn.message Enter the e-mail address of the contact to check. $crlf $crlf $+ A chat window will open, if the message in the chat window changes from: $crlf $+ *** Please wait for the user to join... *** $crlf $+ to $crlf $+ *** xxx has joined the conversation $crlf $+ the the user is ONLINE. $crlf $crlf $+ If the message stays as: $crlf $+ *** Please wait for the user to join... *** $crlf $+ then the user is either OFFLINE or has chosen not to receive messages from people not on their contact list.
    set %msn.clickemail $input(%msn.message,5,Block Checker)
    if (%msn.clickemail == $null) { halt }
    sockclose chat. $+ %msn.clickemail
    sendmsn XFR %msn.main SB
  }
  if ( $did == 5 ) { blockuser $input(Enter the e-mail address of the user you wish to block:,5,Block User) }
  if ( $did == 6 ) { unblockuser $input(Enter the e-mail address of the user you wish to unblock:,5,Unblock User) }
  if ( $did == 7 ) { if ( $?!"Allow users to see you typing?" == $true ) { set %msn.showtype YES } 
    else { set %msn.showtype NO }
  }
  if ( $did == 8 ) {
    set %msn.newname $?"New MSN Name?"
    set %msn.newname $urlencode(%msn.newname)
    if ( %msn.newname == $null ) { halt }
    set %msn.newname $replace(%msn.newname,$chr(32),$chr(37) $+ 20)
    sendmsn REA %msn.main %msn.user %msn.newname
    set %msn.name $rawurldecode( %msn.newname )
    echo @Messenger 10 $+ *** MSN Name changed to $rawurldecode( %msn.name )
  }
  if ( $did == 9 ) { viewlogs }
  if ( $did == 10 ) { 
    if ( %msn.log == 1 ) { disablelog | set %msn.temp $input(Conversation Logging Disabled,4,Conversation Logging) }
    else { enablelog | set %msn.temp $input(Conversation Logging Enabled,4,Conversation Logging) }
  }
  if ( $did == 11 ) {
    set %msn.chatwindow.style $input(Would you like MSN Chat windows to open with the same appearance as Channel windows?,168,Chat Window Style)
  } 
  if ( $did == 16 ) { dialog -m proxy proxy }
  if ( $did == 18 ) { 
    set %msn.sounds on
    set %msn.temp $input(Sounds Enabled,oi)
  }
  if ( $did == 20 ) {
    set %msn.sounds off
    set %msn.temp $input(Sounds Disabled,oi)
  }
  if ( $did == 21 ) {
    set %msn.window.minimise $input(Would you like the main messenger window to minimise on connect?,168,Messenger Window Minimise)
  }
  if ( $did = 22 ) {
    set %msn.maxidle $calc( $input(Set myself as idle after how many minutes?,eoq,Auto Idle,$calc( %msn.maxidle / 60 )) * 60 )
    set %msn.autoidle yes
  }

  if ( $did = 24 ) {
    if ( %msn.autoidle == yes ) {
      set %msn.autoidle no
      set %msn.temp $input(Auto Idle Disabled,4,Auto Idle)
      return
    }

    if ( %msn.autoidle == no ) {
      set %msn.autoidle yes
      set %msn.temp $input(Auto Idle Enabled,4,Auto Idle)
      return
    }
  }

  if ( $did = 26 ) { 
    set %msn.messenger.font $input(Usage: <font> <font size> $crlf $crlf $+ Example: $crlf $+ Verdana 10,eo,Messenger Window Font,%msn.messenger.font)
  }
  if ( $did = 27 ) {
    set %msn.background $input(Would you like to enable the background on the Messenger window? $crlf $crlf $+ You must restart MSN for mIRC for changes to take effect,yv,Messenger Background)
  }
  if ( $did = 28 ) {
    set %msn.autoconnect $input(Would you like MSN for mIRC to automatically connect to msn when you start mIRC? $crlf $crlf $+ Note: You must have 'Remember my username and password' enabled for this to work correctly,yv,Auto Connect)
  }
  if ( $did = 31 ) {
    set %msn.awaysync $yes
    set %msn.temp $input(Away Sync Enabled $crlf $crlf $+ Note: This may not work on some IRC Scripts,4,Away Sync)
  }
  if ( $did = 32 ) {
    set %msn.awaysync $no
    set %msn.temp $input(Away Sync Disabled,4,Away Sync)
  }

  if ( $did = 30 ) {
    set %msn.reconnect $?!"Reconnect to MSN when Disconnected?"
  }

  if ( $did = 35 ) {
    set %msn.mailnotification yes
    set %msn.temp $input(Mail Notification Enabled,4,Mail Notification)
  }

  if ( $did = 34 ) {
    set %msn.mailnotification no
    set %msn.temp $input(Mail Notification Disabled,4,Mail Notification)
  }

  if ( $did = 37 ) {
    set %msn.chat.style msn
    set %msn.temp $input(MSN chat window style selected,4,Chat Window Style)
  }

  if ( $did = 38 ) {
    set %msn.chat.style irc
    set %msn.temp $input(IRC chat window style selected,4,Chat Window Style)
  }

  if ($did = 40) {
    dialog -m comment comment
  }

  if ($did = 43) {
    set %msn.showlogon $?!"Show 'user has logged on' message or 'toast' popup for mIRC 6.3 and above?"
  }

  if ($did = 44) {
    set %msn.sortbygroup $?!"Would you like to sort your contact list by MSN group? $crlf $crlf $+ Note that you will need to restart MSN for mIRC for any change to take effect."
  }
}

on *:dialog:control:init:*:{
  if ( $sock(msn) == $null ) {
    did -b control 1
    did -b control 2
    did -b control 3
    did -b control 4
    did -b control 5
    did -b control 6
    did -b control 8
  }
}

on *:dialog:mail:sclick:2:{
  run https://loginnet.passport.com/ppsecure/post.srf?login= $+ %msn.user $+ &domain=hotmail.com&passwd= $+ %msn.pass $+ &curmbox=ACTIVE&js=no&_lang=EN&beta=0&ishotmail=1&mspp_shared=&id=2&fs=1&cb=_lang=EN&amp;country=UK&ct=1037213303
}

on *:dialog:mail:init:*:{
  if ( %msn.sounds == on ) { splay $shortfn($scriptdir) $+ mail.wav }
}

on *:dialog:proxy:init:*:{
  if ( %msn.useproxy == no ) { did -c proxy 20 }
  if ( %msn.useproxy == socks ) { did -c proxy 21 }
  if ( %msn.useproxy == proxy ) { did -c proxy 22 }
}

on *:dialog:proxy:sclick:19:{
  set %msn.server.proxy $did(18)
  set %msn.server.proxy.port $did(17)
  set %msn.server.socks $did(13)
  set %msn.server.socks.port $did(12)
  if ( $did(20).state == 1 ) { set %msn.useproxy no }
  if ( $did(21).state == 1 ) { set %msn.useproxy socks }
  if ( $did(22).state == 1 ) { set %msn.useproxy proxy }
  if ( %msn.useproxy == socks && %msn.server.proxy == $null && $version == 6.02 ) {
    set %msn.temp $input(You *may* experiance problems with password authentication if you use a socks server and do not specify an HTTP Proxy server to authenticate from using mIRC 6.02.,4,Proxy Server)
  }
}

on *:dialog:connect:init:*:{
  did -i connect 3 0 %msn.user
  if ( %msn.rememberpass = 1 ) { 
    did -r connect 4
    did -a connect 4 %msn.pass
  }
  if ( %msn.chg == 1 ) { did -c connect 6 }
}

on *:dialog:new_version:sclick:4:{
  run %msn.newversion.url
  dialog -x new_version
}

on *:dialog:new_version:sclick:5:{
  dialog -x new_version
}

on *:dialog:comment:sclick:8:{
  set %msn.comment.name $urlencode( $did(1) )
  set %msn.comment.email $urlencode( $did(5) )
  set %msn.comment.comment $urlencode( $did(6) )
  if ( %msn.comment.name == $null ) || ( %msn.comment.comment == $null ) {
    echo -a Comment not sent. You must enter your name and a comment.
    halt
  }
  sockopen comment www.burningimage.net 80
  echo -a Thankyou. You comments will be read and acted upon.  If you entered your E-mail address then expect an e-mail from the author.
}

on *:dialog:comment:init:{
  unset %msn.comment.*
}

on *:SOCKOPEN:comment:{
  if ($sock($sockname).status == active) {
    sockwrite comment GET /msn/comments/leavecomment.php?name= $+ %msn.comment.name $+ &email= $+ %msn.comment.email $+ & $+ comment= $+ %msn.comment.comment HTTP/1.0 $+ $crlf $+ Host: www.burningimage.net $+ $crlf $+ $crlf
  }
}
