You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

inxep.py 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #!/usr/bin/env python
  2. # File: protojep.py
  3. # Version: 0.1
  4. # Description: a script for announcing proto-XEPs
  5. # Last Modified: 2004-09-14
  6. # Author: Peter Saint-Andre (stpeter@jabber.org)
  7. # License: public domain
  8. # HowTo: ./protojep.py filename
  9. # (note: do not include extension!)
  10. # IMPORTS:
  11. #
  12. import glob
  13. import os
  14. from select import select
  15. import smtplib
  16. import socket
  17. from string import split,strip,join,find
  18. import sys
  19. import time
  20. from xml.dom.minidom import parse,parseString,Document
  21. def getText(nodelist):
  22. thisText = ""
  23. for node in nodelist:
  24. if node.nodeType == node.TEXT_NODE:
  25. thisText = thisText + node.data
  26. return thisText
  27. # READ IN ARGS:
  28. #
  29. # 1. XEP filename (sans extension)
  30. jepname = sys.argv[1];
  31. jepfile = 'inbox/' + jepname + '.xml'
  32. # PARSE XEP HEADERS:
  33. #
  34. # - title
  35. # - abstract
  36. # - version
  37. # - date
  38. # - initials
  39. # - remark
  40. thejep = parse(jepfile)
  41. jepNode = (thejep.getElementsByTagName("jep")[0])
  42. headerNode = (jepNode.getElementsByTagName("header")[0])
  43. titleNode = (headerNode.getElementsByTagName("title")[0])
  44. title = getText(titleNode.childNodes)
  45. abstractNode = (headerNode.getElementsByTagName("abstract")[0])
  46. abstract = getText(abstractNode.childNodes)
  47. statusNode = (headerNode.getElementsByTagName("status")[0])
  48. jepstatus = getText(statusNode.childNodes)
  49. typeNode = (headerNode.getElementsByTagName("type")[0])
  50. jeptype = getText(typeNode.childNodes)
  51. revNode = (headerNode.getElementsByTagName("revision")[0])
  52. versionNode = (revNode.getElementsByTagName("version")[0])
  53. version = getText(versionNode.childNodes)
  54. dateNode = (revNode.getElementsByTagName("date")[0])
  55. date = getText(dateNode.childNodes)
  56. initialsNode = (revNode.getElementsByTagName("initials")[0])
  57. initials = getText(initialsNode.childNodes)
  58. remarkNode = (revNode.getElementsByTagName("remark")[0])
  59. remark = getText(remarkNode.childNodes)
  60. # SEND MAIL:
  61. #
  62. # From: editor@jabber.org
  63. # To: standards-jig@jabber.org
  64. # Subject: LAST CALL: XEP-$jepnum ($title)
  65. # Body:
  66. # The XMPP Extensions Editor has received a proposal for a new XEP.
  67. #
  68. # Title: $title
  69. #
  70. # Abstract: $abstract
  71. #
  72. # URL: http://www.jabber.org/jeps/inbox/$jepname.html
  73. #
  74. # The XMPP Council will now consider whether to accept
  75. # this proposal as a full XEP.
  76. #
  77. fromaddr = "editor@jabber.org"
  78. # for testing...
  79. # toaddrs = "stpeter@jabber.org"
  80. # for real...
  81. toaddrs = "standards-jig@jabber.org"
  82. thesubject = 'proto-XEP: ' + title
  83. introline = 'The XMPP Extensions Editor has received a proposal for a new XEP.'
  84. titleline = 'Title: ' + title
  85. abstractline = 'Abstract: ' + abstract
  86. urlline = 'URL: http://www.jabber.org/jeps/inbox/' + jepname + '.html'
  87. actionline = 'The XMPP Council will decide within 7 days (or at its next meeting) whether to accept this proposal as an official XEP.'
  88. #msg = "From: %s\r\n" % fromaddr
  89. msg = "From: XEP Editor <%s>\r\n" % fromaddr
  90. msg = msg + "To: %s\r\n" % toaddrs
  91. msg = msg + "Subject: %s\r\n" % thesubject
  92. msg = msg + introline
  93. msg = msg + "\r\n\n"
  94. msg = msg + titleline
  95. msg = msg + "\r\n\n"
  96. msg = msg + abstractline
  97. msg = msg + "\r\n\n"
  98. msg = msg + urlline
  99. msg = msg + "\r\n\n"
  100. msg = msg + actionline
  101. msg = msg + "\r\n\n"
  102. server = smtplib.SMTP('localhost')
  103. server.set_debuglevel(1)
  104. server.sendmail(fromaddr, toaddrs, msg)
  105. server.quit()
  106. # END