MPhone — File Browser

MPhonev1.0.0.1 / MPhonev1.0.0.1 / MPhone.mrc

MPhone.mrc — 4.27 KB — Download this file

on *:LOAD: { set %Mhone.DummyVar $dll($+($scriptdir,MPhone.dll), CheckVoiceConfig, $null) | unset %MPhone.* }

on *:UNLOAD: { unset %MPhone.* }

on *:START: { unset %MPhone.* }

on *:EXIT: { unset %MPhone.* }

on ^*:NOTICE:!MPHONE!/*:?: {
  if (%MPhone.RequestNick == $nick) && (%MPhone.State == OUTREQUEST) {
    if ($dll($+($scriptdir,MPhone.dll), GetStringType, $1) == ACCEPT) {
      set %MPhone.State INACCEPT
      if ($dll($+($scriptdir,MPhone.dll), LaunchServer, $+($me,/4121)) == OK) {         
        .timerMPhone 0 5 /MPhone.CheckState
      }
      else {
        .notice %MPhone.RequestNick $dll($+($scriptdir,MPhone.dll), CreateInformationString, HOSTFAIL) -- Voice conversation failed
        unset %MPhone.*
      }
    }
    else {
      if ($dll($+($scriptdir,MPhone.dll), GetStringType, $1) == BUSY) {
        set %Mhone.DummyVar $dll($+($scriptdir,MPhone.dll), Disconnect, $null)
        set %Mhone.DummyVar $dll($+($scriptdir,MPhone.dll), ShowInformationDialog, $+($nick,'s MPhone is busy))
        unset %MPhone.*
      } 
      else {
        if ($dll($+($scriptdir,MPhone.dll), GetStringType, $1) == CLIENTFAIL) {
          set %Mhone.DummyVar $dll($+($scriptdir,MPhone.dll), Disconnect, $null)
          set %Mhone.DummyVar $dll($+($scriptdir,MPhone.dll), ShowInformationDialog, $+($nick,'s MPhone client failed))
          unset %MPhone.*
        } 
      }
    }
  }
  else {
    if ($dll($+($scriptdir,MPhone.dll), GetStringType, $1) == REQUEST) {
      if (!%MPhone.State) {
        set %MPhone.RequestNick $nick     
        set %MPhone.State INREQUEST
        set %MPhone.RequestIP $dll($+($scriptdir,MPhone.dll), GetRequestStringIP, $1) 
        set %MPhone.RequestPort $dll($+($scriptdir,MPhone.dll), GetRequestStringPort, $1) 
        .timer 1 1 /MPhone.ResponseChoice
      }
      else {
        .notice $nick $dll($+($scriptdir,MPhone.dll), CreateInformationString, BUSY) -- MPhone is busy
      }      
    }  
    else {
      if (%MPhone.RequestNick == $nick) && (%MPhone.State == OUTACCEPT) {
        if ($dll($+($scriptdir,MPhone.dll), GetStringType, $1) == HOSTFAIL) {
          set %Mhone.DummyVar $dll($+($scriptdir,MPhone.dll), Disconnect, $null)
          set %Mhone.DummyVar $dll($+($scriptdir,MPhone.dll), ShowInformationDialog, $+($nick,'s MPhone host failed))
          unset %MPhone.*
        } 
      }
    }       
  }
  halt
}

alias -l MPhone.RequestCall {
  if (!%MPhone.State) {
    set %MPhone.RequestNick $1
    set %MPhone.State OUTREQUEST
    set %Mhone.DummyVar $dll($+($scriptdir,MPhone.dll), ShowInformationDialog, Waiting for %MPhone.RequestNick to respond /20) 
    .notice $1 $dll($+($scriptdir,MPhone.dll), CreateRequestString, $+($ip,/4121)) -- $me is requesting a voice conversation
    .timer 1 25 /MPhone.RequestTimeout
  }
}

alias -l MPhone.ResponseChoice {
  if ($dll($+($scriptdir,MPhone.dll), ShowAcceptDialog, %MPhone.RequestNick) == YES) {
    .notice %MPhone.RequestNick $dll($+($scriptdir,MPhone.dll), CreateInformationString, ACCEPT)
    set %MPhone.State OUTACCEPT
    if ($dll($+($scriptdir,MPhone.dll), LaunchClient,$+($me,/,%MPhone.RequestIP,/,%MPhone.RequestPort)) == OK) {         
      .timerMPhone 0 5 /MPhone.CheckState
    }
    else {
      .notice %MPhone.RequestNick $dll($+($scriptdir,MPhone.dll), CreateInformationString, CLIENTFAIL) -- Voice conversation failed
      unset %MPhone.*
    }
  }
  else {
    unset %MPhone.*
  }
}

alias -l MPhone.RequestTimeout {
  if (%MPhone.State == OUTREQUEST) { set %Mhone.DummyVar $dll($+($scriptdir,MPhone.dll), Disconnect, $null) | unset %MPhone.* }
}

alias -l MPhone.CheckState {
  if ($dll($+($scriptdir,MPhone.dll), GetPhoneState, $null) == FREE) { unset %MPhone.* | .timerMPhone off }
}

alias MPhone { if ((%MPhone.State == $null) && ($1 != $me) && ($1 != $null)) { MPhone.RequestCall $1 } }

alias MPhoneSetup { if (!%MPhone.State) { set %Mhone.DummyVar $dll($+($scriptdir,MPhone.dll), ShowVoiceConfigDialog, $null) } }

menu nicklist {
  -
  .$iif(((%MPhone.State != $null) || ($1 == $me) || ($1 == $null)),$style(2)) Voice Conversation : MPhone.RequestCall $1
  .$iif((%MPhone.State != $null),$style(2)) Voice Setup Wizard : { set %Mhone.DummyVar $dll($+($scriptdir,MPhone.dll), ShowVoiceConfigDialog, $null) }
}