2006-10-02 18:22:13 -04:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2006-10-10 12:44:59 -04:00
|
|
|
# File: inxep.py
|
2006-10-02 18:22:13 -04:00
|
|
|
# Version: 0.1
|
2006-10-04 14:40:38 -04:00
|
|
|
# Description: a script for announcing proto-XEPs
|
2006-10-02 18:22:13 -04:00
|
|
|
# Last Modified: 2004-09-14
|
|
|
|
# Author: Peter Saint-Andre (stpeter@jabber.org)
|
|
|
|
# License: public domain
|
2006-10-10 12:44:59 -04:00
|
|
|
# HowTo: ./inxep.py filename
|
2006-10-02 18:22:13 -04:00
|
|
|
# (note: do not include extension!)
|
|
|
|
|
|
|
|
# IMPORTS:
|
|
|
|
#
|
|
|
|
import glob
|
|
|
|
import os
|
|
|
|
from select import select
|
|
|
|
import smtplib
|
|
|
|
import socket
|
|
|
|
from string import split,strip,join,find
|
|
|
|
import sys
|
|
|
|
import time
|
|
|
|
from xml.dom.minidom import parse,parseString,Document
|
|
|
|
|
|
|
|
def getText(nodelist):
|
|
|
|
thisText = ""
|
|
|
|
for node in nodelist:
|
|
|
|
if node.nodeType == node.TEXT_NODE:
|
|
|
|
thisText = thisText + node.data
|
|
|
|
return thisText
|
|
|
|
|
|
|
|
# READ IN ARGS:
|
|
|
|
#
|
2006-10-04 14:40:38 -04:00
|
|
|
# 1. XEP filename (sans extension)
|
2006-10-02 18:22:13 -04:00
|
|
|
|
2006-10-10 12:44:59 -04:00
|
|
|
xepname = sys.argv[1];
|
2006-10-02 18:22:13 -04:00
|
|
|
|
2006-12-13 23:36:19 -05:00
|
|
|
xepfile = xepname + '.xml'
|
2006-10-02 18:22:13 -04:00
|
|
|
|
2006-10-04 14:40:38 -04:00
|
|
|
# PARSE XEP HEADERS:
|
2006-10-02 18:22:13 -04:00
|
|
|
#
|
|
|
|
# - title
|
|
|
|
# - abstract
|
|
|
|
# - version
|
|
|
|
# - date
|
|
|
|
# - initials
|
|
|
|
# - remark
|
|
|
|
|
2006-10-10 12:44:59 -04:00
|
|
|
thexep = parse(xepfile)
|
|
|
|
xepNode = (thexep.getElementsByTagName("xep")[0])
|
|
|
|
headerNode = (xepNode.getElementsByTagName("header")[0])
|
2006-10-02 18:22:13 -04:00
|
|
|
titleNode = (headerNode.getElementsByTagName("title")[0])
|
|
|
|
title = getText(titleNode.childNodes)
|
|
|
|
abstractNode = (headerNode.getElementsByTagName("abstract")[0])
|
|
|
|
abstract = getText(abstractNode.childNodes)
|
|
|
|
statusNode = (headerNode.getElementsByTagName("status")[0])
|
2006-10-10 12:44:59 -04:00
|
|
|
xepstatus = getText(statusNode.childNodes)
|
2006-10-02 18:22:13 -04:00
|
|
|
typeNode = (headerNode.getElementsByTagName("type")[0])
|
2006-10-10 12:44:59 -04:00
|
|
|
xeptype = getText(typeNode.childNodes)
|
2006-10-02 18:22:13 -04:00
|
|
|
revNode = (headerNode.getElementsByTagName("revision")[0])
|
|
|
|
versionNode = (revNode.getElementsByTagName("version")[0])
|
|
|
|
version = getText(versionNode.childNodes)
|
|
|
|
dateNode = (revNode.getElementsByTagName("date")[0])
|
|
|
|
date = getText(dateNode.childNodes)
|
|
|
|
initialsNode = (revNode.getElementsByTagName("initials")[0])
|
|
|
|
initials = getText(initialsNode.childNodes)
|
|
|
|
remarkNode = (revNode.getElementsByTagName("remark")[0])
|
|
|
|
remark = getText(remarkNode.childNodes)
|
|
|
|
|
|
|
|
# SEND MAIL:
|
|
|
|
#
|
2007-01-16 18:35:34 -05:00
|
|
|
# From: editor@xmpp.org
|
|
|
|
# To: standards@xmpp.org
|
2006-10-10 12:44:59 -04:00
|
|
|
# Subject: Proposed XMPP Extension: XEP-$xepnum ($title)
|
2006-10-02 18:22:13 -04:00
|
|
|
# Body:
|
2006-10-04 14:40:38 -04:00
|
|
|
# The XMPP Extensions Editor has received a proposal for a new XEP.
|
2006-10-02 18:22:13 -04:00
|
|
|
#
|
|
|
|
# Title: $title
|
|
|
|
#
|
|
|
|
# Abstract: $abstract
|
|
|
|
#
|
2006-10-10 12:44:59 -04:00
|
|
|
# URL: http://www.xmpp.org/extensions/inbox/$xepname.html
|
2006-10-02 18:22:13 -04:00
|
|
|
#
|
2006-10-04 14:40:38 -04:00
|
|
|
# The XMPP Council will now consider whether to accept
|
|
|
|
# this proposal as a full XEP.
|
2006-10-02 18:22:13 -04:00
|
|
|
#
|
|
|
|
|
2007-01-16 18:35:34 -05:00
|
|
|
fromaddr = "editor@xmpp.org"
|
2006-10-02 18:22:13 -04:00
|
|
|
# for testing...
|
|
|
|
# toaddrs = "stpeter@jabber.org"
|
|
|
|
# for real...
|
2007-01-16 18:35:34 -05:00
|
|
|
toaddrs = "standards@xmpp.org"
|
2006-10-02 18:22:13 -04:00
|
|
|
|
2006-10-10 12:44:59 -04:00
|
|
|
thesubject = 'Proposed XMPP Extension: ' + title
|
2006-10-04 14:40:38 -04:00
|
|
|
introline = 'The XMPP Extensions Editor has received a proposal for a new XEP.'
|
2006-10-02 18:22:13 -04:00
|
|
|
titleline = 'Title: ' + title
|
|
|
|
abstractline = 'Abstract: ' + abstract
|
2006-10-10 12:44:59 -04:00
|
|
|
urlline = 'URL: http://www.xmpp.org/extensions/inbox/' + xepname + '.html'
|
2007-07-31 15:37:44 -04:00
|
|
|
actionline = 'The XMPP Council will decide at its next meeting whether to accept this proposal as an official XEP.'
|
2006-10-02 18:22:13 -04:00
|
|
|
|
2006-10-10 12:45:47 -04:00
|
|
|
msg = "From: XMPP Extensions Editor <%s>\r\n" % fromaddr
|
2006-10-02 18:22:13 -04:00
|
|
|
msg = msg + "To: %s\r\n" % toaddrs
|
|
|
|
msg = msg + "Subject: %s\r\n" % thesubject
|
|
|
|
msg = msg + introline
|
|
|
|
msg = msg + "\r\n\n"
|
|
|
|
msg = msg + titleline
|
|
|
|
msg = msg + "\r\n\n"
|
|
|
|
msg = msg + abstractline
|
|
|
|
msg = msg + "\r\n\n"
|
|
|
|
msg = msg + urlline
|
|
|
|
msg = msg + "\r\n\n"
|
|
|
|
msg = msg + actionline
|
|
|
|
msg = msg + "\r\n\n"
|
|
|
|
|
|
|
|
server = smtplib.SMTP('localhost')
|
|
|
|
server.set_debuglevel(1)
|
|
|
|
server.sendmail(fromaddr, toaddrs, msg)
|
|
|
|
server.quit()
|
|
|
|
|
|
|
|
# END
|
|
|
|
|