#!/usr/bin/env python3 # Nemubot is a smart and modulable IM bot. # Copyright (C) 2012-2017 Mercier Pierre-Olivier # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . import sys def fs_event(path): # open file # parse file to extract: # - correspondant number # - correspondant name # - message # build a command with given values def main(): import argparse parser = argparse.ArgumentParser() parser.add_argument("-S", "--socketfile", default="./nemubot.sock", help="path where open the socket for internal communication") args = parser.parse_args() # Resolve relatives paths args.socketfile = os.path.abspath(os.path.expanduser(args.socketfile)) import socket import select mypoll = select.poll() mypoll.register(sock.fileno(), select.POLLIN | select.POLLPRI) # TODO: inotify on FS if __name__ == "__main__": main()