RECHERCHER :
COMMUNAUTE MP
Identifiez vous ...
Devenir Membre
J'ai oublié mon MDP
DOMAINE MP
Bavardages
Langages Généraux
Langages Web
Langages DotNet
Autres langages
Dev. Jeux Video
Sécurité
Sys. Exploitation
Graphismes
Logiciels
Réseaux
Bases de données
Méthodologies
Emplois High-tech
Aide juridique
Articles juridiques
FORUM
Index des forums
Ajouter un sujet
Rechercher sujet
Contact Responsable
Devenir modérateur
CHAT MP IRC
Votre pseudo ...
Srv: irc.moteurprog.com
Chan: #MoteurProg
PARTICIPER
Plus de 3500 emplois.
Rechercher un job
Déposez votre CV
Emplois High-tech

Visiteur MP

 Version 0.01

Forum : BOTEMPE
Sous Catégorie : Aucune
Type du sujet : Annonce
FAQ : Aucune

SUIVI DES SUJETS PAR MAIL

SUIVI PAR MAIL INACTIF

RESOLUTION DU SUJET SUJET NON RESOLU
BLOQUAGE DU SUJET SUJET ACTIF
APPARTENANCE A LA FAQ FAQ NON DISPONIBLE


POSTER UN NOUVEAU SUJET REPONDRE A CE SUJET

FORUM BOTEMPE

PREMIERE PAGE

PAGE PRECEDENTE

Page précedente

Page suivante

PAGE SUIVANTE

DERNIERE PAGE
yougo
Superviseur :
- Calculatrice.
- Système d'ex.
Modérateur :
- CGI
- Python
Chef de projet(s) :
- WSSI
- XDocSS
- Botempe

Avatar de yougo
Inscrit : 21/01/2004
Messages : 2228
Message
#158250
Posté le 22/11/08 à 23:43
Suite à une difficulté de connexion, voici un lien vers le premier jet du programme.

http://hexade.googlepages.com/Botempe_0.01.zip

Par défaut, le daemon écoute sur le port 7776 (par opposition à 6667 pour IRC Smiley) et reconnaît deux commandes:

- §login username : crée un nouvel utilisateur sur le serveur IRC ou récupère le contrôle d'un utilisateur déjà connecté.
- §msg message pour le chan : envoie un message sur le chan IRC par défaut (#botempe pour l'instant).

Ces commandes vont très probablement changer, mais l'équipe doit encore discuter des modalités de la communication PHP-Python-IRC, et des différences qui peuvent exister entre l'implémentation pour le client IRC AJAX que développe Coolboy d'une part, et le système de notifications prévu pour MP.
__________________________
Aidez les autres membres en publiant sur le forum le code que nous vous avons aidé à créer !
ImageImageImage
Où sont les membres de MP ?

HAUT DE PAGE

PROFIL MEMBRE LUI ECRIRE 

Publicité
Inscrit : X
Messages : X
Message
#Aucun

HAUT DE PAGE

  

yougo
Superviseur :
- Calculatrice.
- Système d'ex.
Modérateur :
- CGI
- Python
Chef de projet(s) :
- WSSI
- XDocSS
- Botempe

Avatar de yougo
Inscrit : 21/01/2004
Messages : 2228
Message
#158251
Posté le 22/11/08 à 23:44
Pour un accès plus facile au code en développement, voici une copie de la version 0.01 :


#!/usr/bin/env python # -*- coding: utf-8 -*- """ -------------------------------------------------------------------------------- Botempe is a IRC client daemon for the MoteurProg community ( http://www.moteurprog.com ). -------------------------------------------------------------------------------- Authors: - Hugo Herter <mail AT hugoh DOT org> Objectives: - Allow PHP scripts to send notifications to the chan or to the connected users. (new private message, new topic in a forum some connected users follow, ...) Later objectives: - Save the discutions from the main channel(s) on the website for later access. Requirements: - Python ( development uses version 2.5.1) This distribution may include a copy of Python IRCLib http://sourceforge.net/projects/python-irclib Thanks to Peyton McCullough for his article "IRC on a Higher Level" http://www.devshed.com/c/a/Python/IRC-on-a-Higher-Level/ Copyright (C) 2008 Hugo Herter This file is part of Botempe. Botempe is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Botempe is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Botempe. If not, see <http://www.gnu.org/licenses/>. """ __version__ = '0.01' import threading, socket import irclib # Connection information network = 'localhost' #'irc.moteurprog.com' port = 6667 channel = '#botempe' nick = 'Botempe' name = 'Botempe %s' % __version__ # Connect irc = irclib.IRC() # Users users = {} # IRC virtual user class VirtualUser: def __init__(self, nick): self.nick = nick self.server = irc.server() self.server.connect(network, port, nick, ircname=name) self.server.join(channel) # Client Listener class ClientListener(threading.Thread): def __init__(self, client, addr): threading.Thread.__init__(self) self.client = client self.addr = addr def run(self): cache = "" new = True while (new): try: new = self.client.recv(2**14) cache += new # !!! TODO: Specify exception name except Exception: break while 'n' in cache: instruction, cache = cache.split('n',1) self.execute(instruction) def execute(self, instruction): # !!! This is a draft for demo-only ! if ' ' in instruction: action, argument = instruction.split(' ', 1) else: action, argument = instruction, None if action == '§login': if not users.has_key(argument): users[argument] = VirtualUser(argument) self.user = users[argument] self.client.send('§login donen') elif action == '§msg': self.user.server.privmsg ( channel, argument ) # Local Listener class LocalListener(threading.Thread): """Class that handles local connexions""" clients = [] def __init__(self): "Binds the local port." threading.Thread.__init__(self) self.socket = socket.socket() self.socket.bind(('localhost', 7776)) self.socket.listen(32) def run(self): "Listens to new connections." while (True): client, addr = self.socket.accept() print "Connexion:", client, addr listener = ClientListener(client, addr) self.clients.append(listener) listener.start() # Start local listnener in a new thread listener = LocalListener() listener.start() # Loop irc.process_forever()

__________________________
Aidez les autres membres en publiant sur le forum le code que nous vous avons aidé à créer !
ImageImageImage
Où sont les membres de MP ?

HAUT DE PAGE

PROFIL MEMBRE LUI ECRIRE 


    PAGE : [1]



.: Site Web développé par Yann Pingot et l'équipe MPWG avec www.evolvia-web.com :.