[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r1903 - GNUnet/src/applications/fs/fsui GNUnet/src/include
From: |
grothoff |
Subject: |
[GNUnet-SVN] r1903 - GNUnet/src/applications/fs/fsui GNUnet/src/include GNUnet/src/util gnunet-gtk/src/plugins/fs |
Date: |
Thu, 25 Aug 2005 01:33:46 -0700 (PDT) |
Author: grothoff
Date: 2005-08-25 01:33:42 -0700 (Thu, 25 Aug 2005)
New Revision: 1903
Modified:
GNUnet/src/applications/fs/fsui/check.conf
GNUnet/src/applications/fs/fsui/namespace_info.c
GNUnet/src/include/gnunet_fsui_lib.h
GNUnet/src/util/hashing.c
gnunet-gtk/src/plugins/fs/meta.c
gnunet-gtk/src/plugins/fs/meta.h
gnunet-gtk/src/plugins/fs/namespace.c
Log:
sync
Modified: GNUnet/src/applications/fs/fsui/check.conf
===================================================================
--- GNUnet/src/applications/fs/fsui/check.conf 2005-08-25 07:48:34 UTC (rev
1902)
+++ GNUnet/src/applications/fs/fsui/check.conf 2005-08-25 08:33:42 UTC (rev
1903)
@@ -20,7 +20,7 @@
topology = "topology_default"
[NETWORK]
-PORT = 2080
+PORT = 2087
INTERFACE = eth0
HELOEXCHANGE = NO
TRUSTED = 127.0.0.0/8;
Modified: GNUnet/src/applications/fs/fsui/namespace_info.c
===================================================================
--- GNUnet/src/applications/fs/fsui/namespace_info.c 2005-08-25 07:48:34 UTC
(rev 1902)
+++ GNUnet/src/applications/fs/fsui/namespace_info.c 2005-08-25 08:33:42 UTC
(rev 1903)
@@ -482,7 +482,22 @@
}
+/**
+ * Compute the next ID for peridodically updated content.
+ * @param updateInterval MUST be a peridic interval (not NONE or SPORADIC)
+ * @param thisId MUST be known to FSUI
+ * @return OK on success, SYSERR on error
+ */
+int FSUI_computeNextId(const char * name,
+ const HashCode512 * lastId,
+ const HashCode512 * thisId,
+ TIME_T updateInterval,
+ HashCode512 * nextId) {
+ BREAK();
+ return SYSERR; /* not implemented -- FIXME! */
+}
+
/**
* Add an entry into a namespace (also for publishing
* updates).
@@ -649,8 +664,10 @@
TIME_T now;
if (OK != enc2hash(fil,
- &lastId))
+ &lastId)) {
+ BREAK();
return OK;
+ }
fi.uri = NULL;
fi.meta = NULL;
if (OK != readUpdateData(cls->name,
@@ -658,8 +675,10 @@
&nextId,
&fi,
&pubFreq,
- &lastTime))
+ &lastTime)) {
+ BREAK();
return OK;
+ }
cls->cnt++;
if (pubFreq == ECRS_SBLOCK_UPDATE_SPORADIC) {
nextTime = 0;
Modified: GNUnet/src/include/gnunet_fsui_lib.h
===================================================================
--- GNUnet/src/include/gnunet_fsui_lib.h 2005-08-25 07:48:34 UTC (rev
1902)
+++ GNUnet/src/include/gnunet_fsui_lib.h 2005-08-25 08:33:42 UTC (rev
1903)
@@ -758,6 +758,18 @@
const struct ECRS_MetaData * md); /* namespace_info.c */
/**
+ * Compute the next ID for peridodically updated content.
+ * @param updateInterval MUST be a peridic interval (not NONE or SPORADIC)
+ * @param thisId MUST be known to FSUI
+ * @return OK on success, SYSERR on error
+ */
+int FSUI_computeNextId(const char * name,
+ const HashCode512 * lastId,
+ const HashCode512 * thisId,
+ TIME_T updateInterval,
+ HashCode512 * nextId);
+
+/**
* List all updateable content in a given namespace.
*/
int FSUI_listNamespaceContent(struct FSUI_Context * ctx,
Modified: GNUnet/src/util/hashing.c
===================================================================
--- GNUnet/src/util/hashing.c 2005-08-25 07:48:34 UTC (rev 1902)
+++ GNUnet/src/util/hashing.c 2005-08-25 08:33:42 UTC (rev 1903)
@@ -405,6 +405,8 @@
unsigned int bits;
unsigned int vbit;
+ GNUNET_ASSERT(block != NULL);
+ GNUNET_ASSERT(result != NULL);
vbit = 0;
wpos = 0;
rpos = 0;
Modified: gnunet-gtk/src/plugins/fs/meta.c
===================================================================
--- gnunet-gtk/src/plugins/fs/meta.c 2005-08-25 07:48:34 UTC (rev 1902)
+++ gnunet-gtk/src/plugins/fs/meta.c 2005-08-25 08:33:42 UTC (rev 1903)
@@ -393,15 +393,8 @@
return timeIntervalToFancyString(interval * cronSECONDS);
}
-int tryParseTimeInterval(GladeXML * xml,
- const char * intervalComboBoxEntry,
- TIME_T * interval) {
- GtkWidget * update;
- const char * timeSpec;
-
- update = glade_xml_get_widget(xml,
- intervalComboBoxEntry);
- timeSpec = gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(update))));
+int parseTimeInterval(const char * timeSpec,
+ TIME_T * interval) {
if (timeSpec == NULL)
return SYSERR;
if (0 == strcmp(_("--sporadic update--"),
@@ -416,6 +409,19 @@
return OK;
}
+int tryParseTimeInterval(GladeXML * xml,
+ const char * intervalComboBoxEntry,
+ TIME_T * interval) {
+ GtkWidget * update;
+ const char * timeSpec;
+
+ update = glade_xml_get_widget(xml,
+ intervalComboBoxEntry);
+ timeSpec = gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(update))));
+ return parseTimeInterval(timeSpec,
+ interval);
+}
+
unsigned int getAnonymityLevel(GladeXML * xml,
const char * spinButtonName) {
GtkWidget * spin;
Modified: gnunet-gtk/src/plugins/fs/meta.h
===================================================================
--- gnunet-gtk/src/plugins/fs/meta.h 2005-08-25 07:48:34 UTC (rev 1902)
+++ gnunet-gtk/src/plugins/fs/meta.h 2005-08-25 08:33:42 UTC (rev 1903)
@@ -64,6 +64,9 @@
const char * intervalComboBoxEntry,
TIME_T * interval);
+int parseTimeInterval(const char * frequency,
+ TIME_T * interval);
+
unsigned int getAnonymityLevel(GladeXML * xml,
const char * spinButtonName);
Modified: gnunet-gtk/src/plugins/fs/namespace.c
===================================================================
--- gnunet-gtk/src/plugins/fs/namespace.c 2005-08-25 07:48:34 UTC (rev
1902)
+++ gnunet-gtk/src/plugins/fs/namespace.c 2005-08-25 08:33:42 UTC (rev
1903)
@@ -327,7 +327,10 @@
size = 0;
uriString = ECRS_uriToString(fi->uri);
hash2enc(lastId, &last);
- hash2enc(nextId, &next);
+ if (nextId != NULL)
+ hash2enc(nextId, &next);
+ else
+ memset(&next, 0, sizeof(EncName));
if (publicationFrequency == ECRS_SBLOCK_UPDATE_SPORADIC)
date = STRDUP(_("unspecified"));
else if (publicationFrequency == ECRS_SBLOCK_UPDATE_NONE)
@@ -684,6 +687,7 @@
GtkTreeSelection * selection;
IUC cls;
gint num;
+ GtkTreeIter iter;
contentList
= glade_xml_get_widget(getMainXML(),
@@ -703,6 +707,16 @@
gtk_widget_destroy(dialog);
return;
}
+ if (FALSE == gtk_tree_selection_get_selected(selection,
+ NULL,
+ &iter)) {
+ BREAK();
+ return;
+ }
+ gtk_tree_model_get(gtk_tree_view_get_model(GTK_TREE_VIEW(contentList)),
+ &iter,
+ NAMESPACE_META, &meta,
+ -1);
notebook
= glade_xml_get_widget(getMainXML(),
@@ -729,7 +743,7 @@
createMetaDataListTreeView(metaXML,
"metaDataTreeView",
"namespaceInsertPreview",
- NULL);
+ meta);
createMetaTypeComboBox(metaXML,
"namespaceInsertMetaTypeComboBox");
dialog = glade_xml_get_widget(metaXML,
@@ -836,6 +850,16 @@
gtk_widget_destroy(dialog);
return;
}
+ if (FALSE == gtk_tree_selection_get_selected(selection,
+ NULL,
+ &iter)) {
+ BREAK();
+ return;
+ }
+ gtk_tree_model_get(gtk_tree_view_get_model(GTK_TREE_VIEW(contentList)),
+ &iter,
+ NAMESPACE_META, &meta,
+ -1);
notebook
= glade_xml_get_widget(getMainXML(),
@@ -881,7 +905,6 @@
IN_NAMESPACE_LAST_STRING, &last,
IN_NAMESPACE_NEXT_STRING, &next,
IN_NAMESPACE_PUB_FREQ_STRING, &freq,
- IN_NAMESPACE_META, &meta,
-1);
metaXML
= glade_xml_new(getGladeFileName(),
@@ -909,8 +932,34 @@
}
nameLine = glade_xml_get_widget(metaXML,
"nextIdentifierEntry");
- gtk_entry_set_text(GTK_ENTRY(nameLine),
- ""); /* FIXME: compute next for sporadic updates (extend
libecrs?) */
+ if (OK != parseTimeInterval(freq,
+ &cls.updateInterval)) {
+ BREAK();
+ cls.updateInterval = ECRS_SBLOCK_UPDATE_SPORADIC;
+ }
+ if (cls.updateInterval == ECRS_SBLOCK_UPDATE_SPORADIC) {
+ gtk_entry_set_text(GTK_ENTRY(nameLine),
+ "");
+ } else {
+ EncName updateName;
+
+ if (OK != FSUI_computeNextId(list->name,
+ &prevId,
+ &cls.thisId,
+ cls.updateInterval,
+ &nextId)) {
+ BREAK();
+ UNREF(metaXML);
+ metaXML = NULL;
+ return;
+ }
+ hash2enc(&nextId,
+ &updateName);
+ gtk_entry_set_text(GTK_ENTRY(nameLine),
+ (const char*) &updateName);
+ gtk_entry_set_editable(GTK_ENTRY(nameLine),
+ FALSE);
+ }
update = glade_xml_get_widget(metaXML,
"namespaceUpdateIntervalComboBoxEntry");
@@ -927,9 +976,22 @@
gtk_dialog_set_default_response(GTK_DIALOG(dialog),
GTK_RESPONSE_OK);
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
+ const char * error = NULL;
+ nameLine = glade_xml_get_widget(metaXML,
+ "nextIdentifierEntry");
if (OK != tryParseTimeInterval(metaXML,
"namespaceUpdateIntervalComboBoxEntry",
&cls.updateInterval)) {
+ error = _("Failed to parse given time interval!");
+ } else {
+ identifierName = gtk_entry_get_text(GTK_ENTRY(nameLine));
+ if ( (cls.updateInterval != ECRS_SBLOCK_UPDATE_NONE) &&
+ ( (identifierName == NULL) ||
+ (strlen(identifierName) == 0)) ) {
+ error = _("You must specify an identifier for the next publication.");
+ }
+ }
+ if (error != NULL) {
gtk_widget_destroy(dialog);
UNREF(metaXML);
metaXML = NULL;
@@ -938,12 +1000,15 @@
GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
- _("Failed to parse given time interval!"));
+ error);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
return;
}
-
+ hash(identifierName,
+ strlen(identifierName),
+ &nextId);
+ cls.nextId = &nextId;
cls.meta = getMetaDataFromList(metaXML,
"namespaceUpdateMetaDataTreeView",
"namespaceUpdatePreviewImage");
@@ -951,18 +1016,6 @@
"namespaceUpdateAnonymitySpinButton");
cls.anonymityLevel
= gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin));
- nameLine = glade_xml_get_widget(metaXML,
- "nextIdentifierEntry");
- identifierName = gtk_entry_get_text(GTK_ENTRY(nameLine));
- if ( (identifierName == NULL) ||
- (strlen(identifierName) == 0)) {
- cls.nextId = NULL;
- } else {
- hash(identifierName,
- strlen(identifierName),
- &nextId);
- cls.nextId = &nextId;
- }
gtk_tree_selection_selected_foreach
(selection,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r1903 - GNUnet/src/applications/fs/fsui GNUnet/src/include GNUnet/src/util gnunet-gtk/src/plugins/fs,
grothoff <=