WIP
This commit is contained in:
parent
db1e4e9266
commit
fecbc54d8c
53
smsgate.py
Normal file
53
smsgate.py
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#!/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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
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()
|
Loading…
x
Reference in New Issue
Block a user