Changed fn-fmsread --list[all] to include a hard coded list of known repository USKs.
diff --git a/infocalypse/fms.py b/infocalypse/fms.py
--- a/infocalypse/fms.py
+++ b/infocalypse/fms.py
@@ -25,6 +25,8 @@ import StringIO
from fcpclient import get_usk_hash, get_version, is_usk_file, \
get_usk_for_usk_version
+# Hmmm... This dependency doesn't really belong here.
+from knownrepos import KNOWN_REPOS
MSG_TEMPLATE = """From: %s
Newsgroups: %s
@@ -259,12 +261,18 @@ class USKAnnouncementParser(IFmsMessageS
""" Class which accumulates USK announcement notifications
from fms messages. """
# None means accept all announcements.
- def __init__(self, trust_map = None):
+ def __init__(self, trust_map = None, include_defaults=False):
IFmsMessageSink.__init__(self)
if not trust_map is None:
trust_map = strip_names(trust_map)
self.trust_map = trust_map
self.usks = {}
+ if include_defaults:
+ for owner, usk in KNOWN_REPOS:
+ if ((not trust_map is None) and
+ (not clean_nym(owner) in trust_map)):
+ continue
+ self.handle_announcement(owner, usk)
def wants_msg(self, dummy, items):
""" IFmsMessageSink implementation. """
diff --git a/infocalypse/infcmds.py b/infocalypse/infcmds.py
--- a/infocalypse/infcmds.py
+++ b/infocalypse/infcmds.py
@@ -711,7 +711,7 @@ def handled_listall(ui_, params, stored_
return False
if params['FMSREAD'] == 'listall':
- parser = USKAnnouncementParser()
+ parser = USKAnnouncementParser(None, True)
if params['VERBOSITY'] >= 2:
ui_.status('Listing all repo USKs.\n')
else:
@@ -721,7 +721,7 @@ def handled_listall(ui_, params, stored_
fms_ids.sort()
ui_.status(("Only listing repo USKs from trusted "
+ "fms IDs:\n%s\n\n") % '\n'.join(fms_ids))
- parser = USKAnnouncementParser(trust_map)
+ parser = USKAnnouncementParser(trust_map, True)
recv_msgs(stored_cfg.defaults['FMS_HOST'],
stored_cfg.defaults['FMS_PORT'],
diff --git a/infocalypse/knownrepos.py b/infocalypse/knownrepos.py
--- a/infocalypse/knownrepos.py
+++ b/infocalypse/knownrepos.py
@@ -22,12 +22,15 @@
let me know and I'll add it.
"""
-KNOW_REPOS = (
- 'USK@kRM~jJVREwnN2qnA8R0Vt8HmpfRzBZ0j4rHC2cQ-0hw,'
+# Not sure about this. Flat text file instead?
+KNOWN_REPOS = (
+ ('djk@isFiaD04zgAgnrEC5XJt1i4IE7AkNPqhBG5bONi6Yks',
+ 'USK@kRM~jJVREwnN2qnA8R0Vt8HmpfRzBZ0j4rHC2cQ-0hw,'
+ '2xcoQVdQLyqfTpF2DpkdUIbHFCeL4W~2X1phUYymnhM,AQACAAE/'
- + 'infocalypse.hgext.R1/23',
+ + 'infocalypse.hgext.R1/23'),
)
+# LATER: Compile from KNOWN_REPOS? To risky?
DEFAULT_TRUST = {
'djk@isFiaD04zgAgnrEC5XJt1i4IE7AkNPqhBG5bONi6Yks':
('be68e8feccdd', ),