* Add comment explaining logic of displaying join_gc window
* correct grammar regression
This commit is contained in:
parent
d05728fc55
commit
3da22df9c1
|
@ -18,8 +18,10 @@
|
||||||
##
|
##
|
||||||
|
|
||||||
from os import tmpfile
|
from os import tmpfile
|
||||||
|
from dialogs import *
|
||||||
|
|
||||||
USE_GPG = True
|
USE_GPG = True
|
||||||
|
GPG_DEBUG = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import GnuPGInterface # Debian package doesn't distribute 'our' file
|
import GnuPGInterface # Debian package doesn't distribute 'our' file
|
||||||
|
@ -54,19 +56,23 @@ else:
|
||||||
resp = {}
|
resp = {}
|
||||||
while 1:
|
while 1:
|
||||||
line = child_stdout.readline()
|
line = child_stdout.readline()
|
||||||
if line == "": break
|
if line == '': break
|
||||||
line = line.rstrip()
|
line = line.rstrip()
|
||||||
if line[0:9] == '[GNUPG:] ':
|
if line[0:9] == '[GNUPG:] ':
|
||||||
# Chop off the prefix
|
|
||||||
line = line[9:]
|
line = line[9:]
|
||||||
L = line.split(None, 1)
|
L = line.split(None, 1)
|
||||||
keyword = L[0]
|
# self._handle_response(L.pop(0), L)
|
||||||
if len(L) > 1:
|
|
||||||
resp[ keyword ] = L[1]
|
|
||||||
else:
|
|
||||||
resp[ keyword ] = ""
|
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
|
def _handle_response(self, response, parameters):
|
||||||
|
return
|
||||||
|
#if response == 'NEED_PASSPHRASE':
|
||||||
|
#w = dialogs.PassphraseDialog(
|
||||||
|
# _('Password Required'),
|
||||||
|
# _('Enter your password for key %s') % parameters[0][:8],
|
||||||
|
# _('Save password'))
|
||||||
|
#self.passphrase[parameters[0][:8]], save = w.run()
|
||||||
|
|
||||||
def encrypt(self, str, recipients):
|
def encrypt(self, str, recipients):
|
||||||
if not USE_GPG:
|
if not USE_GPG:
|
||||||
return str
|
return str
|
||||||
|
@ -98,25 +104,34 @@ else:
|
||||||
except IOError: pass
|
except IOError: pass
|
||||||
return output
|
return output
|
||||||
|
|
||||||
def sign(self, str, keyID):
|
def sign(self, data, keyID):
|
||||||
if not USE_GPG:
|
if not USE_GPG:
|
||||||
return str
|
return data
|
||||||
proc = self.run(['-b', '-u %s'%keyID], create_fhs=['stdin', 'stdout', 'status', 'stderr'])
|
proc = self.run(['-b', '-u %s'%keyID], create_fhs=['stdin', 'stdout', 'status', 'stderr', 'passphrase'])
|
||||||
proc.handles['stdin'].write(str)
|
proc.handles['stdin'].write(data)
|
||||||
proc.handles['stdin'].close()
|
proc.handles['stdin'].close()
|
||||||
|
proc.handles['passphrase'].close()
|
||||||
|
stat = proc.handles['status']
|
||||||
|
while 1:
|
||||||
|
line = stat.readline()
|
||||||
|
print line
|
||||||
|
if line == '': break
|
||||||
|
line = line.rstrip()
|
||||||
|
if line[0:9] == '[GNUPG:] ':
|
||||||
|
line = line[9:]
|
||||||
|
L = line.split(None, 1)
|
||||||
|
print L
|
||||||
|
#self._handle_response(L.pop(0), L)
|
||||||
|
proc.handles['status'].close()
|
||||||
|
|
||||||
output = proc.handles['stdout'].read()
|
output = proc.handles['stdout'].read()
|
||||||
proc.handles['stdout'].close()
|
proc.handles['stdout'].close()
|
||||||
proc.handles['stderr'].close()
|
proc.handles['stderr'].close()
|
||||||
|
|
||||||
stat = proc.handles['status']
|
|
||||||
resp = self._read_response(stat)
|
|
||||||
proc.handles['status'].close()
|
|
||||||
|
|
||||||
try: proc.wait()
|
try: proc.wait()
|
||||||
except IOError: pass
|
except IOError: pass
|
||||||
if resp.has_key('GOOD_PASSPHRASE') or resp.has_key('SIG_CREATED'):
|
#if resp.has_key('GOOD_PASSPHRASE') or resp.has_key('SIG_CREATED'):
|
||||||
return self._stripHeaderFooter(output)
|
# return self._stripHeaderFooter(output)
|
||||||
return 'BAD_PASSPHRASE'
|
return 'BAD_PASSPHRASE'
|
||||||
|
|
||||||
def verify(self, str, sign):
|
def verify(self, str, sign):
|
||||||
|
|
|
@ -700,8 +700,7 @@ class GroupchatWindow(chat.Chat):
|
||||||
else:
|
else:
|
||||||
server = servernick
|
server = servernick
|
||||||
nick = ''
|
nick = ''
|
||||||
#FIXME: autojoin with current nick or with the nick specified
|
#join_gc window is needed in order to provide for password entry.
|
||||||
#do not open join_gc window
|
|
||||||
if self.plugin.windows[self.account].has_key('join_gc'):
|
if self.plugin.windows[self.account].has_key('join_gc'):
|
||||||
self.plugin.windows[self.account]['join_gc'].window.present()
|
self.plugin.windows[self.account]['join_gc'].window.present()
|
||||||
else:
|
else:
|
||||||
|
@ -810,7 +809,7 @@ occupant specified by nickname from the room and optionally displays a \
|
||||||
reason. Does NOT support spaces in nickname.') % command, room_jid)
|
reason. Does NOT support spaces in nickname.') % command, room_jid)
|
||||||
elif command == 'me':
|
elif command == 'me':
|
||||||
self.print_conversation(_('Usage: /%s <action>, sends action to the \
|
self.print_conversation(_('Usage: /%s <action>, sends action to the \
|
||||||
current room. Use third person. (e.g. /%s explodes)') %
|
current room. Use third person. (e.g. /%s explodes.)') %
|
||||||
(command, command), room_jid)
|
(command, command), room_jid)
|
||||||
elif command == 'msg':
|
elif command == 'msg':
|
||||||
s = _('Usage: /%s <nickname> [message], opens a private message window and sends message to the occupant specified by nickname.') % command
|
s = _('Usage: /%s <nickname> [message], opens a private message window and sends message to the occupant specified by nickname.') % command
|
||||||
|
|
Loading…
Reference in New Issue