Shoutbox (une partie sur mirc, l'autre sur un site en php)

Description

Cette shoutbox est divisée en une infinité de canaux. Il en existe pour l'instant 7 publiques (officiellement), mais d'autres peuvent être ouverts à l'aide d'un bouton sur le dialogue (voir screen). Des canaux privés peuvent également être créés (ils fonctionnent par mot de passe, et ne sont pas référencés dans la liste).

Les canaux publiques sont principalement liés à mes activités (hébergement de bot de sécurité; bot newseur, vip, téléchargeable par mon addon, ...)

Le site permet la même chose que le remote, à savoir envoyer des messages, consulter les messages, mais ne permet pas de créer de canaux.
L'URL du site : http://faq.arkanis.info, ou plus directement : http://arkanisfr.free.fr/FAQ/index.php?d=Shoutbox&Canal=Index
L'avantage de cette shoutbox, c'est de pouvoir parler à qui vous voulez, au choix depuis mIRC, sinon depuis le site.
On peut de ce fait parler à ses copains (étant au lycée par exemple), tandis que vous êtes sur IRC.
Si une personne est absente, elle verra la discussion depuis le début.

Pour mettre à zéro le canal, je n'ai pas encore prévu ça, et je ne compte pas réellement le faire. Pour celà, envoyez moi un message, et je me chargerai d'effacer le contenu de votre canal :)

Une fois le code chargé, je pense que vous comprendrez assez vite de quoi il s'agit :)
La case blanche tout en bas à gauche est la case où vous marquerez vos messages

Source / Exemple :


;**************************************
; Shoutbox
;**************************************
alias shoutbox {
  if (!$exists(mirc.exe)) {
    if ($exists(alfascript.exe)) var %mirc = alfascript.exe
    unset %ok
    while ((!$exists(%mirc)) || ($right(%mirc,4) != .exe)) {
      if (!%ok) { set %ok 1 | echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Vous devez selectionner le fichier .exe qui lance mIRC 12]  }
      var %mirc = $+(",$sfile($mircdir,Où est mIRC.exe ?,OK),")
    }
    unset %ok
    copy %mirc mIRC.exe
  }
  if (!$exists(ArKanis/DLL/mdx.dll)) {
    if (!$isdir(ArKanis)) mkdir ArKanis
    if (!$isdir(ArKanis\DLL)) mkdir ArKanis\DLL
    download.arkanis.ask /Private/mdx.dll ArKanis/DLL
    return
  }
  if ($dialog(shoutbox)) { dialog -v Shoutbox | shoutbox.maj | return }
  dialog -md shoutbox shoutbox
}
dialog shoutbox {
  title Shoutbox :: ArKanis' Script
  size -1 -1 300 150
  option dbu
  icon ArKanis/ArKanis.ico
  button "Exit" 1, 270 140 30 10, ok
  list 2, 50 10 200 135, extsel autohs
  box "Canaux" 100, 2 5 45 130
  button "Index" 3, 5 15 40 10
  button "Script" 10, 5 27 40 10
  button "KeepBot" 4, 5 39 40 10
  button "BotWar" 5, 5 51 40 10
  button "Support" 6, 5 63 40 10
  button "Publicité" 7, 5 75 40 10
  button "Private" 8, 5 99 40 10
  button "Team (public)" 11, 5 111 40 10
  button "Team (privé)" 9, 5 123 40 10
  button "Wolf-Territory" 12, 5 87 40 10
  combo 200, 5 139 210 10
  button "Envoyer" 201, 240 140 30 10
  text "0/150" 202, 220 140 20 10
  button "Actualiser" 203, 270 130 30 10
  text "" 204, 270 120 30 10
  button "Créer son canal" 205, 252 10 45 10
  button "Voir liste" 206, 252 22 45 10
  button "MSG ArKanis" 207, 252 34 45 10
  text "Hosted by Rockweb.org" 208, 252 100 45 20, center
  link "Shoutbox en URL" 209, 255 90 45 10
}
alias -l shoutbox.maj {
  if (!$dialog(Shoutbox)) return
  sockclose shoutbox
  if (!$hget(Shoutbox)) hmake Shoutbox 2
  if ($1 == config1) {
    sockopen Shoutbox users.rockweb.org 80
    return
  }
  hadd Shoutbox Window Index
  sockopen Shoutbox users.rockweb.org 80
}
on *:sockopen:shoutbox:{
if ($sockerr) return
  if (!$hget(Shoutbox,Window)) return
  if (!$dialog(Shoutbox)) return
  if ($hget(Shoutbox,View)) {
    sockwrite -n $sockname GET $+(http://users.rockweb.org/ArKanis/Shoutbox/index.php?mdpteam=,$gettok($hget(Shoutbox,View),2,32),&view=,$gettok($hget(Shoutbox,View),1,32)) HTTP/1.0
    sockwrite -n $sockname $crlf
    hdel Shoutbox View
    hdel Shoutbox Send
    did -r Shoutbox 2
    unset %o
    return
  }
  if (($hget(Shoutbox,Create)) || ($hget(Shoutbox,CreatePublic))) {
    if ($hget(Shoutbox,Create)) sockwrite -n $sockname GET $+(http://users.rockweb.org/ArKanis/Shoutbox/index.php?create=,$gettok($hget(Shoutbox,Create),1,32),&passcreate=,$gettok($hget(Shoutbox,Create),2,32),&msgcreate=,$me) HTTP/1.0
    elseif ($hget(Shoutbox,CreatePublic)) sockwrite -n $sockname GET $+(http://users.rockweb.org/ArKanis/Shoutbox/index.php?createpublic=,$hget(Shoutbox,CreatePublic),&msgcreate=,$me) HTTP/1.0
    sockwrite -n $sockname $crlf
    hdel Shoutbox Create
    hdel Shoutbox CreatePublic
    hadd Shoutbox ReadCreate 1
    return
  }
  if ($hget(Shoutbox,MSGArKanis)) {
    sockwrite -n $sockname GET $+(http://users.rockweb.org/ArKanis/Shoutbox/index.php?msgtoarka=,$me,&msg=,$hget(Shoutbox,MSGArKanis)) HTTP/1.0
    sockwrite -n $sockname $crlf
    hadd Shoutbox Sended 1
    hdel Shoutbox MSGArKanis
    return
  }
  if ($hget(Shoutbox,Send)) {
    if ($left($hget(Shoutbot,Window),5) == team-) {
      sockwrite -n $sockname GET $+(http://users.rockweb.org/ArKanis/Shoutbox/index.php?page=,$hget(Shoutbox,Window),&msg=,$hget(Shoutbox,Send)) HTTP/1.0
      sockwrite -n $sockname $crlf
      hdel Shoutbox Send
      hadd Shoutbox Sended 1
      return
    }
    sockwrite -n $sockname GET $+(http://users.rockweb.org/ArKanis/Shoutbox/index.php?page=,$hget(Shoutbox,Window),&msg=,$hget(Shoutbox,Send)) HTTP/1.0
    sockwrite -n $sockname $crlf
    hdel Shoutbox Send
    hadd Shoutbox Sended 1
    return
  }
  did -r Shoutbox 2
  unset %o
  sockwrite -n $sockname GET $+(http://users.rockweb.org/ArKanis/Shoutbox/index.php?view=,$hget(Shoutbox,Window)) HTTP/1.0
  sockwrite -n $sockname $crlf
  did -o Shoutbox 204 1 MAJ à $asctime(HH:nn)
}
on *:sockread:shoutbox:{
  if ($hget(Shoutbox,NoRead)) { hdel Shoutbox NoRead | sockclose $sockname | return }
  if ($hget(Shoutbox,Protect)) { .timerprotect.shoutbox 1 3 hdel Shoutbox Protect | return }
  sockread %a
  if (ce canal n'existe pas isin %a) {
    echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[0 %a 12]
    did -a Shoutbox 2 %a
    sockclose $sockname
    unset %a
    return
  }
  if ((Sended isin %a) && ($hget(Shoutbox,Sended))) {
    hdel Shoutbox Sended
    echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Message envoyé ! 12]
    sockclose Shoutbox
    .timer -h 1 500 sockopen Shoutbox users.rockweb.org 80
    unset %a
    return
  }
  if ($left(%a,1) == <) {
    sockclose $sockname
    did -a Shoutbox 2 Erreur : ce canal n'existe pas !
    hadd -u3 Shoutbox Protect 1
    unset %a
    return
  }
  if ($hget(Shoutbox,ReadCreate)) {
    if (AlreadyExists isin %a) {
      hdel Shoutbox ReadCreate
      echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Ce canal existait déjà ! Abandon de la création 12]
      sockclose $sockname
    }
    if (Created isin %a) {
      hdel Shoutbox ReadCreate
      writeini -n Config.ini Shoutbox Created $iif(%r,$calc(%r + 1),1)
      echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Le canal a été correctement créé ! 12]
      sockclose $sockname
    }
    unset %a
    return
  }
  if ($left(%a,6) == Partie) set %o 1
  if ((%o) && (%a)) {
    if ((Content-Type: isin %a) || (HTTP/1.1 200 isin  %a)) { unset %o | return }
    if ($dialog(Shoutbox)) did -i Shoutbox 2 2 $replace(%a,chr61,$chr(61),chr35,$chr(35),chr39,$chr(39))
  }
  unset %a
}
alias -l mdx.arka return dll ArKanis/DLL/mdx.dll
on *:dialog:shoutbox:*:*:{
  if ($devent == init) {
    $mdx.arka SetMircVersion $version
    $mdx.arka MarkDialog $dname
    $mdx.arka SetControlMDX $dname 2 listview nosortheader rowselect showsel single flatsb headerdrag labeltip report staticedge > ArKanis/DLL/views.mdx
    did -i $dname 2 1 headerdims 396:1
    did -i $dname 2 1 headertext Messages de la partie Index
    shoutbox.maj
  }
  if ($devent == sclick) {
    if ($did isnum 3-20) {
      var %t = $did($did).text
      if (%t == Team (Public)) {
        var %team = $input.request(Nom de votre team ?)
        if (!%team) return
        did -i Shoutbox 2 1 headertext Messages de la team %team
        var %team = $+(public-,%team)
        hadd Shoutbox Window %team
        sockclose Shoutbox
        sockopen Shoutbox users.rockweb.org 80
        return
      }
      if (%t == Team (Privé)) {
        var %team = $input.request(Nom de votre team ?)
        var %pass = $input.request(Mot de passe ? (Majuscules importantes))
        if ((!%team) || (!%pass)) return
        did -i Shoutbox 2 1 headertext Messages de la team %team
        var %team = $+(team-,%team)
        hadd Shoutbox Window $+(%team,-,%pass)
        hadd Shoutbox View %team %pass
        sockclose Shoutbox
        sockopen Shoutbox users.rockweb.org 80
        hadd Shoutbox Team %team %pass
        return
      }
      if (%t == Private) {
        var %pass = $remove($input.request(Mot de passe ? (Majuscules importantes)),$chr(32))
        if (!%pass) return
        hadd Shoutbox Window %pass
        var %t = 3
        while %t <= 9 {
          if ($did(Shoutbox,%t).text == %pass) var %pass = None
          inc %t
        }
        if (%pass == None) { echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Impossible d'accéder à cette partie ! 12] | return }
        if (team isin %pass) return
        sockclose Shoutbox
        did -i Shoutbox 2 1 headertext Messages de la partie Private
        sockopen Shoutbox users.rockweb.org 80
        return
      }
      if (!$hget(Shoutbox)) hmake Shoutbox 2
      hadd Shoutbox Window $replace($did($did).text,é,e,è,e)
      sockclose Shoutbox
      did -i Shoutbox 2 1 headertext Messages de la partie $did($did).text
      sockopen Shoutbox users.rockweb.org 80
    }
    if ($did == 201) {
      if (!$did(200).text) return
      if (%temp.arka.shoutbox) { echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Impossible d'envoyer plusieurs messages en moins de 20secs ! 12] | return }
      set -u20 %temp.arka.shoutbox 1
      if (!$input.request.y.n(Etes-vous sûr(e) de vouloir envoyer ce message ? Message limité à 150 caractères)) return
      hadd Shoutbox Send $replace($remove($+(-,$me,-) $left($strip($did(200).text),150),<,>,$chr(124)),$chr(32),$+($chr(37),20),$chr(61),chr61,$chr(35),chr35,$chr(39),chr39)
      sockclose Shoutbox
      sockopen Shoutbox users.rockweb.org 80
      did -o $dname 202 1 0/150
      did -r $dname 200
    }
    if ($did == 203) {
      shoutbox.maj config1
    }
    if ($did == 205) {
      unset %pass
      if (!$input.request.y.n(Créer un canal public ?)) {
        var %pass = $remove($strip($input.request(Mot de passe ? (Majuscules importantes))),<,>,$chr(61),$chr(124),$chr(46),$chr(44))
        if (!%pass) return
        if ($len(%pass) <= 5) {
          echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Votre mot de passe doit être constitué d'au moins 5 lettres ! 12]
          return
        }
      }
      var %team = $remove($input.request(Nom de votre team ?),<,>,$chr(61),$chr(124),$chr(46),$chr(44))
      if (!%team) return
      var %r = $readini(Config.ini,Shoutbox,Created)
      if (%r >= 3) {
        echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Vous ne pouvez créer qu'au maximum 3 canaux ! 12]
        return
      }
      hadd Shoutbox $iif(!%pass,CreatePublic,Create) %team %pass
      sockclose Shoutbox
      sockopen Shoutbox users.rockweb.org 80
      echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Tentative de création du canal de la team %team $iif(%pass,avec pour mot de passe %pass $+(...,$chr(32))) $+ 12]
    }
    if ($did == 206) {
      did -i Shoutbox 2 1 headertext Liste des canaux publics non officiels
      did -r $dname 2
      sockclose Shoutbox
      sockopen Shoutbox users.rockweb.org 80
      hadd Shoutbox Window Public
      return
    }
    if ($did == 207) {
      if (%temp.arka.shoutbox) { echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Impossible d'envoyer plusieurs messages en moins de 20secs ! 12] | return }
      set -u20 %temp.arka.shoutbox 1
      var %t = $input.request(Quel message voulez-vous envoyer à ArKanis ?)
      var %t = $replace($remove($strip(%t),<,>,$chr(124)),$chr(32),$+($chr(37),20),$chr(61),chr61,$chr(35),chr35,$chr(39),chr39)
      if (!%t) return
      if ($len(%t) <= 10) {
        echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Le message doit être constitué d'au moins 10 caractères! 12]
        return
      }
      if (!$input.request.y.n(Etes-vous sûr(e) de vouloir envoyer votre message ?)) return
      hadd Shoutbox MSGArKanis %t
      sockclose Shoutbox
      sockopen Shoutbox users.rockweb.org 80
      return
    }
    if ($did == 209) {
      url -n http://arkanisfr.free.fr/FAQ/index.php?d=Shoutbox&Canal=Index
      return
    }
  }
  if ($devent == edit) {
    if ($did == 200) {
      var %calc = $len($remove($did(200).text,<,>,$chr(124)))
      did -o $dname 202 1 $+(%calc,/150)
    }
  }
}

;**************************************
; Download on ArKanis' FTP By ArKanis
;**************************************
alias -l download.arkanis.ask {
  if (!$1) return
  unset %t
  var %t = $?!="Il faut télécharger un fichier pour permettre au script de fonctionner correctement $+($chr(40),$nopath($1),$chr(41),.) Voulez-vous le télécharger ?"
  if (%t) download.arkanis $1-
}
alias -l download.arkanis {
  if ($sock(download.arkanis)) { writeini -n Config.ini Queue $1 $iif($2-,$2-,1) | return }
  set %download.arkanis $1
  if ($3) set %download.arkanis $3
  unset %folder.download.arkanis
  if ($2) set %folder.download.arkanis $iif($right($2,1) != $chr(47),$+($2,/),$2)
  if ($exists($+($iif(%folder.download.arkanis,$ifmatch),$nopath($1)))) .remove $+($iif(%folder.download.arkanis,$ifmatch),$nopath($1))
  sockopen download.arkanis users.rockweb.org 80
  return 1
}
on *:sockopen:download.arkanis:{
  if ($sockerr > 0) return
  if (!%download.arkanis) { sockclose download.arkanis | return }
  sockwrite -n download.arkanis GET $replace($+(http://users.rockweb.org/ArKanis,%download.arkanis),chr61,$chr(61),chr35,$chr(35),chr39,$chr(39))
  sockwrite -n download.arkanis $crlf
  echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Preparing to download $iif(%download.arkanis2,$nopath(%download.arkanis2),$nopath(%download.arkanis)) 12]
  unset %o %m %n
  set %temp.ticks2 $ticks
}
on *:sockread:download.arkanis:{
  var %title = $iif(%download.arkanis2,$nopath(%download.arkanis2),$nopath(%download.arkanis))
  if (!%m) { echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Downloading %title ... 12] | set %m 1 }
  var %f = $right(%title,4)
  if ((%f == .dll) || (%f == .jpg) || (%f == .hlp) || (%f == .ico) || (%f == .exe) || (%f == .mdx) || (%f = .wav) || (%f == .mp3)) {
    sockread &a
    bwrite $+($iif(%folder.download.arkanis,$ifmatch),%title) -1 -1 &a
  }
  else {
    sockread %a
    if (%o) {
      if (!%a) set %n $iif($lines($+($iif(%folder.download.arkanis,$ifmatch),%title)) <= 1,0,1)
      write $+($iif(%folder.download.arkanis,$ifmatch),%title) $replace(%a,'time',$time,'date',$date,'mircdir',$mircdir)
      if (%n) {
        unset %n
        if ($calc($lines($+($iif(%folder.download.arkanis,$ifmatch),%title)) -1) == 1) return
        write -il $+ $calc($lines($+($iif(%folder.download.arkanis,$ifmatch),%title)) -1) $+($iif(%folder.download.arkanis,$ifmatch),%title)
      }
    }
    if (------------------------ isin %a) set %o 1
  }
}
on *:sockclose:download.arkanis:{
  var %title = $iif(%download.arkanis2,$nopath(%download.arkanis2),$nopath(%download.arkanis))
  if ($right(%title,4) == .txt) {
    write -il $+ $calc($lines($+($iif(%folder.download.arkanis,$ifmatch),%title)) -1) $+($iif(%folder.download.arkanis,$ifmatch),%title)
    write -il $+ $lines($+($iif(%folder.download.arkanis,$ifmatch),%title)) $+($iif(%folder.download.arkanis,$ifmatch),%title)
  }
  unset %folder.download.arkanis %m
  echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Téléchargement de $iif(%download.arkanis2,$nopath(%download.arkanis2),$nopath(%download.arkanis)) terminé. $+($iif($ini(Config.ini,Queue,0),$ifmatch fichier(s) restant(s).),12])
  if (%temp.ticks2) {
    echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[0 $iif(%langage.arka == France,Fichier téléchargé en,File downloaded in)  $+($calc(($ticks - %temp.ticks2) / 1000),s) 12]
    unset %temp.ticks2
  }
  if (($nopath(%download.arkanis) == ArKanis-MAJ.mrc) && ($exists(ArKanis-MAJ.mrc))) { .load -rs ArKanis-MAJ.mrc | unset %download.arkanis* | return }
  if (($exists($nopath(%download.arkanis))) && (($right($nopath(%download.arkanis),4) == .exe) || ($right($nopath(%download.arkanis),4) == .reg))) { .timer -h 1 1 arkanis.run.downloaded.file $iif(%download.arkanis2,$nopath(%download.arkanis2),$nopath(%download.arkanis)) }
  unset %download.arkanis*
  if ($ini(Config.ini,Queue,0)) { .timer  -h 1 500 download.arkanis $ini(Config.ini,Queue,1) $readini(Config.ini,Queue,$ini(Config.ini,Queue,1)) | .remini Config.ini Queue $ini(Config.ini,Queue,1) | return }
  while $ini(Config.ini,Download,1) {
    var %t = $readini(Config.ini,Download,$ini(Config.ini,Download,1)) 
    .remini Config.ini Download $ini(Config.ini,Download,1) 
    .timer $+ $gettok(%t,-1,32) -h 1 500 %t
  }
}
;**************************************
; Input Requests By ArKanis
;**************************************
alias input.request {
  if (!$1) return
  if ($dialog(input.request)) return
  .remini Config.ini InputRequest
  writeini -n Config.ini InputRequest Question $1
  return $dialog(input.request,input.request,-4)
}
alias input.request.y.n {
  if (!$1) return
  if ($dialog(input.request)) return
  .remini Config.ini InputRequest
  writeini -n Config.ini InputRequest Question $1
  return $iif($dialog(input.request.y.n,input.request.y.n,-4),$true,$false)
}
dialog input.request {
  title Input Needed
  size -1 -1 150 60
  option dbu
  icon ArKanis/ArKanis.ico
  button "OK"                 1, 130 50 20 10, default ok
  text "By ArKanis"           4, 10 30 45 10
  edit ""                     5, 60 2 90 40, read multi vsbar return
  edit ""                     6, 0 50 125 10, result autohs
  icon 7, 6 5 48 24 , mirc.exe
}
dialog input.request.y.n {
  title Input Needed
  size -1 -1 150 60
  option dbu
  icon ArKanis/ArKanis.ico
  button "&Yes"               1, 80 45 30 15, ok result default
  button "&No"                2, 115 45 30 15, cancel
  text "By ArKanis"           4, 10 30 45 10
  edit ""                     5, 60 2 90 40,read multi vsbar return
  icon                        7, 6 5 48 24 , mirc.exe
}
ON *:DIALOG:input.request*:*:*:{
  if ($devent == init) {
    if ($dname == input.request) did -f $dname 6
    if (!$isdir(ArKanis)) mkdir ArKanis
    if (!$exists(ArKanis/Input.jpg)) { download.ArKanis.ask /Private/Input.jpg ArKanis/ | dialog -x $dname | return }
    did -g $dname 7 ArKanis/Input.jpg | if ($readini(Config.ini,InputRequest,Question)) did -o $dname 5 1 $readini(Config.ini,InputRequest,Question) 
  }
  if (($did == 7) && ($did(4).text == By ArKanis)) did -o $dname 4 1 Lien vers le forum
  if (($devent == sclick) && ($did == 7)) url -n http://arkanisfr.free.fr
  if (($did != 7) && ($did(4).text != By ArKanis)) did -o $dname 4 1 By ArKanis
}

Conclusion :


Le code du dessus regroupe une autre partie de mon AddOn, permettant de télécharger des fichiers sur mon FTP, il vous en faudra télécharger deux (pour le moment). Il n'y a donc pas de .zip :)
Pour l'installer, coller le code dans un remote, de préférence un nouveau fichier :)
Tapez /shoutbox pour la lancer

Pour information, il s'agit de fichiers .txt stockés sur un FTP hébergé par www.rockweb.org (le site est sur un autre FTP).

J'espère que vous aimerez :p
Dites moi ce que vous en pensez, merci :)
=> Classé dans Divers car je ne vois pas où ce remote pourrait aller :)

Codes Sources

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.