;***************************************************
dialog sms_extra {
  title "Предупреждение"
  size -1 -1 346 113
  option pixels

  text "", 1, 30 20 285 54,
  button "Выход", 4, 230 80 75 27,  ok
}
on 1:dialog:sms_extra:close:*:{
  if (($dialog(sms_dialog) == $null) && ($dialog(sms_upgrade) == $null) && ($dialog(sms_add_user) == $null) && ($dialog(sms_log) == $null) && ($dialog(sms_adds) == $null) && ($dialog(sms_prefer) == $null)) .unload -rs sms_other.mrc
}
;**Дополнительный диалог*****************************
alias sms_extra.at {
  sms_extra
  did -o sms_extra 1 1 $1-
}
alias sms_extra.ok {
  sms_extra
  dialog -t sms_extra Ок
  did -o sms_extra 1 1 $1-
}
;***************************************************
;===================================================
;*************$1 - откуда брать.Id edit*************
alias sms_odnostr_mess {
  unset %sms.odnostr
  %sms.odnostr = $did(%sms_dialog,$1,1)
  %sms.editline = 2
  while (%sms.editline < $did(%sms_dialog,$1,1).lines) {
    %sms.odnostr = %sms.odnostr $+ $chr(1) $+ $did(%sms_dialog,$1,%sms.editline)
    %sms.editline = %sms.editline + 1
  }
  if ($did(%sms_dialog,$1,%sms.editline) != $null) %sms.odnostr = %sms.odnostr $+ $chr(1) $+ $did(%sms_dialog,$1,%sms.editline)
  unset %sms.editline
  return %sms.odnostr
}
;***************************************************
alias sms_translate return $replace($1-,А,A,Б,B,В,V,Г,G,Д,D,Е,E,Ё,E,Ж,Zh,З,Z,И,I,Й,Y,К,K,Л,L,М,M,Н,N,О,O,П,P,Р,R,С,S,Т,T,У,U,Ф,F,Х,H,Ц,Ts,Ч,Ch,Ш,Sh,Щ,Sch,Ъ,",Ы,I,Ь,',Э,E,Ю,Yu,Я,Ya,а,a,б,b,в,v,г,g,д,d,е,e,ё,e,ж,zh,з,z,и,i,й,y,к,k,л,l,м,m,н,n,о,o,п,p,р,r,с,s,т,t,у,u,ф,f,х,h,ц,ts,ч,ch,ш,sh,щ,sch,ъ,",ы,i,ь,',э,e,ю,yu,я,ya,&,_amp_,№,#,~,_=_,%,_prosent_,^,_-_,$chr(123),$chr(40),$chr(91),$chr(40),$chr(125),$chr(41),$chr(93),$chr(41),|,l)
;Установить картинку
alias sms_setpic { if ($2 != 1) did -g %sms_dialog %sms_icon SMS/pict/ $+ $1 $+ .bmp | if ($2 == 1)  did -g %sms_dialog %sms_icon SMS/ $+ $1 }
;***************************************************
alias sms_combo_update {
  if (!%sms.curcombo) { sms_extra.at Ошибка |  return }
  %sms.list.nums = 1
  did -r %sms_dialog %sms.curcombo
  while (%sms.list.nums <= $numtok($1-,124)) {
    did -i %sms_dialog %sms.curcombo %sms.list.nums $gettok($1-,%sms.list.nums,124) 
    %sms.list.nums = %sms.list.nums + 1
  }
  if ($did(%sms_dialog,%sms.curcombo).lines != 0) {
    did -c %sms_dialog %sms.curcombo 1
    if (%sms.blbut) did -e %sms_dialog %sms.blbut 1
  } 
  else sms_extra.at Данных нет
}
;*****Отмечаем выбранный текст в combo*************
alias sms_ch_line did -c $1 $2 $didwm($1,$2,$3-)
;****Вытаскиваем из файла все об операторе*********
alias sms_read_op return $readini($nofile($script) $+ operators.ini, $1, $2)
;****Вытаскиваем из названия оператора страну регион и название оператора
alias sms_pars_op return $gettok($ini($nofile($script) $+ operators.ini,$1),$2,46)
;***************************************************
alias sms_add_country {
  did -r $1 $2
  %sms.num_pref = 1
  while ($ini($nofile($script) $+ operators.ini,%sms.num_pref) != $null) {
    if (!$didwm($1,$2,$sms_pars_op(%sms.num_pref,1))) did -i $1 $2 $calc($did($1,$2).lines + 1) $sms_pars_op(%sms.num_pref,1)
    %sms.num_pref = %sms.num_pref + 1
  }
  if ($did($1,$2).lines != 0) {
    did -c $1 $2 1
    sms_add_region $1-
  }
  else sms_upgrade
}
;***************************************************
alias sms_add_region {
  did -r $1 $3
  %sms.num_pref = 1
  while ($ini($nofile($script) $+ operators.ini,%sms.num_pref) != $null) {
    if (!$didwm($1,$3,$sms_pars_op(%sms.num_pref,2)) && $sms_pars_op(%sms.num_pref,1) == $did($1,$2)) did -i $1 $3 $calc($did($1,$3).lines + 1) $sms_pars_op(%sms.num_pref,2)
    %sms.num_pref = %sms.num_pref + 1
  }
  if ($did($1,$3).lines != 0) {
    did -c $1 $3 1
    sms_add_op $1-
  }
}
;***************************************************
alias sms_add_op {
  did -r $1 $4
  %sms.num_pref = 1
  while ($ini($nofile($script) $+ operators.ini,%sms.num_pref) != $null) {
    if ($sms_pars_op(%sms.num_pref,2) == $did($1,$3) && $sms_pars_op(%sms.num_pref,1) == $did($1,$2)) did -i $1 $4 $calc($did($1,$4).lines + 1) $sms_pars_op(%sms.num_pref,3)
    %sms.num_pref = %sms.num_pref + 1
  }
  if ($did($1,$4).lines != 0) {
    did -c $1 $4 1 
    sms_add_pref $1- 
  }
}
;***************************************************
alias sms_add_pref {
  did -r $1 $5 
  %sms.num_pref = 1
  while (%sms.num_pref <= $numtok($sms_read_op($did($1,$2) $+ . $+ $did($1,$3) $+ . $+ $did($1,$4),pref),44)) {
    did -i $1 $5 %sms.num_pref $gettok($gettok($sms_read_op($did($1,$2) $+ . $+ $did($1,$3) $+ . $+ $did($1,$4),pref),%sms.num_pref,44),1,124)
    %sms.num_pref = %sms.num_pref + 1
  }
  did -c $1 $5 1 
  if ($1 == sms_dialog) { 
    did -g sms_dialog 35 SMS/pict/gotov.bmp 
    %sms.limit = $sms_read_op($did($1,$2) $+ . $+ $did($1,$3) $+ . $+ $did($1,$4),maxs)
    sms_limit
    %sms.form = $sms_read_op($did($1,$2) $+ . $+ $did($1,$3) $+ . $+ $did($1,$4),spage)
    %sms.script = $sms_read_op($did($1,$2) $+ . $+ $did($1,$3) $+ . $+ $did($1,$4),spath)
    %sms.op.ispic = $sms_read_op($did($1,$2) $+ . $+ $did($1,$3) $+ . $+ $did($1,$4),ppict)
    if (%sms.form != $null) sms_http_razd %sms.form
    else sms_http_razd %sms.script
    if ($1 == sms_dialog) did -o sms_dialog 6 1 http:// $+ %sms_http.host
    if (%sms.op.ispic == 1) sms_enable_bl 1
    else sms_enable_bl 2
    %sms.whosadd = $sms_read_op($did($1,$2) $+ . $+ $did($1,$3) $+ . $+ $did($1,$4),whosadd)
    if ($gettok(%sms.whosadd,1,1)) { did -d sms_dialog 56 1 | did -i sms_dialog 61 56 $gettok(%sms.whosadd,1,1) }
    did -d sms_dialog 61 1
    if (!$gettok(%sms.whosadd,2,1)) did -i sms_dialog 62 61 Нет данных о сайте | else did -i sms_dialog 62 61 На сайт!
    did -d sms_dialog 62 1
    if (!$gettok(%sms.whosadd,3,1)) did -i sms_dialog 63 62 Нет данных о e-mail | else did -i sms_dialog 63 62 Отправить письмо
    did -d sms_dialog 64
    if (!$gettok(%sms.whosadd,5,1)) did -i sms_dialog 63 64 Нет данных о сети | else did -i sms_dialog 63 64 Подключиться к сети
    did -d sms_dialog 63 1
    if ($gettok(%sms.whosadd,4,1)) did -i sms_dialog 64 63 ICQ: $gettok(%sms.whosadd,4,1) (копировать) 
    else did -i sms_dialog 64 63 Нет данных о ICQ
  }
}
alias sms_readpref {
  return $readini($nofile($script) $+ option.ini,about_me,$1)
}
