User Control Panel

By Jack_Sparrow on May 20, 2008

This is a plain jane Dialog User Control Panel with some basic addons :)

Hope you like it :)

Cheers

; Pythons-IRC 3.0
dialog UCP {
  title "                                          User Control Panel"
  size -1 -1 250 240
  option dbu
  list 1, 15 110 70 104, size
  box "", 2, 5 20 235 67
  text "User Settings", 3, 102 7 45 10, center
  text "NickName", 4, 15 60 35 10, center
  edit "", 5, 60 60 50 10
  edit "", 6, 60 75 50 10
  text "Alternate Nick", 7, 15 75 35 10, center
  edit "Password", 10, 120 75 50 10, pass
  edit "Password", 11, 120 60 50 10, pass
  text "User", 8, 15 30 35 10, center
  edit "", 9, 60 30 50 10
  edit "Email ID", 12, 60 45 50 10
  text "Email ID", 13, 15 45 35 10, center
  box "", 14, 10 100 230 123
  text "Channels", 15, 102 93 45 8, center
  button "Add Channel", 16, 100 110 60 10
  button "Remove Channel", 17, 100 125 60 10
  button "Clear Channels", 18, 100 140 60 10
  button "OK", 19, 203 225 37 12, ok
  button "Close", 20, 10 225 37 12, cancel
}

on *:LOAD: {
if ($hget(Channel) != Channel) {
hmake Channel 10 }
if ($exists($mircdirHash\Channel.hsh) == $true) { hload Channel $mircdirHash\Channel.hsh }
else { hsave Channel $mircdirHash\Channel.hsh } }
;
;
on *:DIALOG:ucp:init:0: {
.timer -m 1 1 UCP.an
set %user $readini(mirc.ini, mIRC, user)
set %emailid $readini(mirc.ini, mIRC, email)
set %nick $readini(mirc.ini, mIRC, nick)
set %anick $readini(mirc.ini, mIRC, anick)
did -ra ucp 5 %nick
did -ra ucp 6 %anick
did -ra ucp 9 %user
did -ra ucp 12 %emailid
did -ra ucp 10 %anickpass
did -ra ucp 11 %nickpass
hload Channel $mircdirHash\Channel.hsh
writechan }

;Trigger Dialog
on *:DIALOG:ucp:sclick:*: {
if ($did == 16) { addchan }
if ($did == 17) { remchan }
if ($did == 18) { clearchan }
if ($did == 19) {
set %nickpass $did(11)
set %nickpass $did(10) } }
;
;
;Aliases
;
;
;Add Channel
alias addchan {
dialog -n UCP UCP
set %channame $$?="Channel Name?"
if ($left(%channame,1) != $chr(35)) { 
%channame = $chr(35) $+ %channame }
if (%chanlist == $null) { 
set %chanlist 0 }
inc %chanlist
did -i ucp 1 %chanlist %channame
hadd -m Channel %channame
hsave Channel $mircdirHash\Channel.hsh
hload Channel $mircdirHash\Channel.hsh }
;
;
;Remove Channel
alias remchan {
var %linen = $did(ucp,1,1).sel
did -d ucp 1 %linen
hdel -w Channel %linen
hsave Channel $mircdirHash\Channel.hsh
hload Channel $mircdirHash\Channel.hsh
dec %chanlist }
;
;
;Channel Lister
alias writechan {
if (%chanlist != $null) {
var %i 1
while (%i <= %chanlist) {
did -i ucp 1 %i $hget(Channel, $+ %i).item
inc %i } }
else return }
;
;
;Clear Channel List
alias clearchan {
if (%chanlist != $null) {
if ($hget(Channel) == Channel) {
hfree channel
hmake Channel 10
hsave Channel $mircdirHash\Channel.hsh
dialog -x ucp ucp
dialog -mado ucp ucp
unset %chanlist } } }
;
;
on *:CONNECT: {
if ($me == %nick) { nickserv identify %nickpass }
if (%chanlist != $null) {
var %i 1
while (%i <= %chanlist) {
join $hget(Channel, %i $+ ).item
inc %i } } }

alias UCP {
  if ($dialog(UCP)) {
    dialog -c UCP UCP
    dialog -mado UCP UCP
  }
  else { dialog -mado UCP UCP }
} 

alias UCP.an {
  var %w = 250
  var %h = 240
  var %i 0
  var %j 0
  while (%j <= %h) {
    dialog -srb UCP -1 -1 %i %j
    var %t 1
    while (%t <= 80) inc %t
    inc %j
    inc %i $calc(%w / %h)
  }
} 

Comments

Sign in to comment.
Jack_Sparrow   -  May 21, 2008

Edited it to make it use local variables :)
Thx Jonesy44

 Respond  
Jonesy44   -  May 20, 2008

make;

set %i 1

..

var %i 1
 Respond  
Jack_Sparrow   -  May 20, 2008

Edited it to Make it Hash Table Based ;)

 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.