[PATCH] python: add bindings for notmuch_message_get_propert(y/ies)

2018-05-02 Thread Ruben Pollan
Message.get_property (prop) returns a string with the value of the property and
Message.get_properties (prop, exact=False) yields key, value pairs
---
 bindings/python/docs/source/message.rst |  4 ++
 bindings/python/notmuch/globals.py  |  5 +++
 bindings/python/notmuch/message.py  | 80 -
 3 files changed, 88 insertions(+), 1 deletion(-)

diff --git a/bindings/python/docs/source/message.rst 
b/bindings/python/docs/source/message.rst
index 1a6cc3d5..b0033924 100644
--- a/bindings/python/docs/source/message.rst
+++ b/bindings/python/docs/source/message.rst
@@ -33,6 +33,10 @@
 
.. automethod:: get_tags
 
+   .. automethod:: get_property
+
+   .. automethod:: get_properties
+
.. automethod:: maildir_flags_to_tags
 
.. automethod:: tags_to_maildir_flags
diff --git a/bindings/python/notmuch/globals.py 
b/bindings/python/notmuch/globals.py
index 97413996..11e328b7 100644
--- a/bindings/python/notmuch/globals.py
+++ b/bindings/python/notmuch/globals.py
@@ -75,6 +75,11 @@ class NotmuchMessageS(Structure):
 NotmuchMessageP = POINTER(NotmuchMessageS)
 
 
+class NotmuchMessagePropertiesS(Structure):
+pass
+NotmuchMessagePropertiesP = POINTER(NotmuchMessagePropertiesS)
+
+
 class NotmuchTagsS(Structure):
 pass
 NotmuchTagsP = POINTER(NotmuchTagsS)
diff --git a/bindings/python/notmuch/message.py 
b/bindings/python/notmuch/message.py
index 1b1f2174..d242097a 100644
--- a/bindings/python/notmuch/message.py
+++ b/bindings/python/notmuch/message.py
@@ -19,7 +19,7 @@ Copyright 2010 Sebastian Spaeth 
 """
 
 
-from ctypes import c_char_p, c_long, c_uint, c_int
+from ctypes import c_char_p, c_long, c_uint, c_int, POINTER, byref
 from datetime import date
 from .globals import (
 nmlib,
@@ -29,6 +29,7 @@ from .globals import (
 NotmuchTagsP,
 NotmuchMessageP,
 NotmuchMessagesP,
+NotmuchMessagePropertiesP,
 NotmuchFilenamesP,
 )
 from .errors import (
@@ -113,6 +114,36 @@ class Message(Python3StringMixIn):
 _maildir_flags_to_tags.argtypes = [NotmuchMessageP]
 _maildir_flags_to_tags.restype = c_int
 
+"""notmuch_message_get_property"""
+_get_property = nmlib.notmuch_message_get_property
+_get_property.argtypes = [NotmuchMessageP, c_char_p, POINTER(c_char_p)]
+_get_property.restype = c_int
+
+"""notmuch_message_get_properties"""
+_get_properties = nmlib.notmuch_message_get_properties
+_get_properties.argtypes = [NotmuchMessageP, c_char_p, c_int]
+_get_properties.restype = NotmuchMessagePropertiesP
+
+"""notmuch_message_properties_valid"""
+_properties_valid = nmlib.notmuch_message_properties_valid
+_properties_valid.argtypes = [NotmuchMessagePropertiesP]
+_properties_valid.restype = bool
+
+"""notmuch_message_properties_value"""
+_properties_value = nmlib.notmuch_message_properties_value
+_properties_value.argtypes = [NotmuchMessagePropertiesP]
+_properties_value.restype = c_char_p
+
+"""notmuch_message_properties_key"""
+_properties_key = nmlib.notmuch_message_properties_key
+_properties_key.argtypes = [NotmuchMessagePropertiesP]
+_properties_key.restype = c_char_p
+
+"""notmuch_message_properties_move_to_next"""
+_properties_move_to_next = nmlib.notmuch_message_properties_move_to_next
+_properties_move_to_next.argtypes = [NotmuchMessagePropertiesP]
+_properties_move_to_next.restype = None
+
 #Constants: Flags that can be set/get with set_flag
 FLAG = Enum(['MATCH'])
 
@@ -433,6 +464,53 @@ class Message(Python3StringMixIn):
 _freeze.argtypes = [NotmuchMessageP]
 _freeze.restype = c_uint
 
+def get_property(self, prop):
+""" Retrieve the value for a single property key
+
+:param prop: The name of the property to get.
+:returns: String with the property value or None if there is no such
+  key. In the case of multiple values for the given key, the
+  first one is retrieved.
+:raises: :exc:`NotInitializedError` if message has not been
+ initialized
+"""
+if not self._msg:
+raise NotInitializedError()
+
+value = c_char_p()
+status = Message._get_property(self._msg, _str(prop), byref(value))
+if status != 0:
+raise NotmuchError(status)
+
+return value.value.decode('utf-8')
+
+def get_properties(self, prop="", exact=False):
+""" Get the properties of the message, returning a generator of
+name, value pairs.
+
+The generator will yield once per value. There might be more than one
+value on each name, so the generator might yield the same name several
+times.
+
+:param prop: The name of the property to get. Otherwise it will return
+ the full list of properties of the message.
+:param exact: if True, require exact match with key. Otherwise
+  treat as prefix.
+

[PATCH] python: add bindings for notmuch_message_get_propert(y/ies)

2018-05-01 Thread Ruben Pollan
Message.get_property (prop) returns a string with the value of the property and
Message.get_properties (prop, exact=False) yields key, value pairs
---
 bindings/python/docs/source/message.rst |  4 ++
 bindings/python/notmuch/globals.py  |  5 +++
 bindings/python/notmuch/message.py  | 80 -
 3 files changed, 88 insertions(+), 1 deletion(-)

diff --git a/bindings/python/docs/source/message.rst 
b/bindings/python/docs/source/message.rst
index 1a6cc3d5..b0033924 100644
--- a/bindings/python/docs/source/message.rst
+++ b/bindings/python/docs/source/message.rst
@@ -33,6 +33,10 @@
 
.. automethod:: get_tags
 
+   .. automethod:: get_property
+
+   .. automethod:: get_properties
+
.. automethod:: maildir_flags_to_tags
 
.. automethod:: tags_to_maildir_flags
diff --git a/bindings/python/notmuch/globals.py 
b/bindings/python/notmuch/globals.py
index 97413996..11e328b7 100644
--- a/bindings/python/notmuch/globals.py
+++ b/bindings/python/notmuch/globals.py
@@ -75,6 +75,11 @@ class NotmuchMessageS(Structure):
 NotmuchMessageP = POINTER(NotmuchMessageS)
 
 
+class NotmuchMessagePropertiesS(Structure):
+pass
+NotmuchMessagePropertiesP = POINTER(NotmuchMessagePropertiesS)
+
+
 class NotmuchTagsS(Structure):
 pass
 NotmuchTagsP = POINTER(NotmuchTagsS)
diff --git a/bindings/python/notmuch/message.py 
b/bindings/python/notmuch/message.py
index 1b1f2174..cc945037 100644
--- a/bindings/python/notmuch/message.py
+++ b/bindings/python/notmuch/message.py
@@ -19,7 +19,7 @@ Copyright 2010 Sebastian Spaeth 
 """
 
 
-from ctypes import c_char_p, c_long, c_uint, c_int
+from ctypes import c_char_p, c_long, c_uint, c_int, POINTER, byref
 from datetime import date
 from .globals import (
 nmlib,
@@ -29,6 +29,7 @@ from .globals import (
 NotmuchTagsP,
 NotmuchMessageP,
 NotmuchMessagesP,
+NotmuchMessagePropertiesP,
 NotmuchFilenamesP,
 )
 from .errors import (
@@ -113,6 +114,36 @@ class Message(Python3StringMixIn):
 _maildir_flags_to_tags.argtypes = [NotmuchMessageP]
 _maildir_flags_to_tags.restype = c_int
 
+"""notmuch_message_get_property"""
+_get_property = nmlib.notmuch_message_get_property
+_get_property.argtypes = [NotmuchMessageP, c_char_p, POINTER(c_char_p)]
+_get_property.restype = c_int
+
+"""notmuch_message_get_properties"""
+_get_properties = nmlib.notmuch_message_get_properties
+_get_properties.argtypes = [NotmuchMessageP, c_char_p, c_int]
+_get_properties.restype = NotmuchMessagePropertiesP
+
+"""notmuch_message_properties_valid"""
+_properties_valid = nmlib.notmuch_message_properties_valid
+_properties_valid.argtypes = [NotmuchMessagePropertiesP]
+_properties_valid.restype = bool
+
+"""notmuch_message_properties_value"""
+_properties_value = nmlib.notmuch_message_properties_value
+_properties_value.argtypes = [NotmuchMessagePropertiesP]
+_properties_value.restype = c_char_p
+
+"""notmuch_message_properties_key"""
+_properties_key = nmlib.notmuch_message_properties_key
+_properties_key.argtypes = [NotmuchMessagePropertiesP]
+_properties_key.restype = c_char_p
+
+"""notmuch_message_properties_move_to_next"""
+_properties_move_to_next = nmlib.notmuch_message_properties_move_to_next
+_properties_move_to_next.argtypes = [NotmuchMessagePropertiesP]
+_properties_move_to_next.restype = None
+
 #Constants: Flags that can be set/get with set_flag
 FLAG = Enum(['MATCH'])
 
@@ -433,6 +464,53 @@ class Message(Python3StringMixIn):
 _freeze.argtypes = [NotmuchMessageP]
 _freeze.restype = c_uint
 
+def get_property(self, prop):
+""" Retrieve the value for a single property key
+
+:param prop: The name of the property to get.
+:returns: String with the property value or None if there is no such
+  key. In the case of multiple values for the given key, the
+  first one is retrieved.
+:raises: :exc:`NotInitializedError` if message has not been
+ initialized
+"""
+if not self._msg:
+raise NotInitializedError()
+
+value = c_char_p()
+status = Message._get_property(self._msg, _str(prop), byref(value))
+if status != 0:
+raise NotmuchError(status)
+
+return value.value.decode('utf-8')
+
+def get_properties(self, prop="", exact=False):
+""" Get the properties of the message, returning a generator of
+name, value pairs.
+
+The generator will yield once per value. There might be more than one
+value on each name, so the generator might yield the same name several
+times.
+
+:param prop: The name of the property to get. Otherwise it will return
+ the full list of properties of the message.
+:param exact: if True, require exact match with key. Otherwise
+  treat as prefix.
+

[PATCH] python: add bindings for notmuch_message_get_propert(y/ies)

2018-04-27 Thread Ruben Pollan
Message.get_property (prop) returns a string with the value of the property and
Message.get_properties (prop, exact=False) yields key, value pairs
---
 bindings/python/docs/source/message.rst |  4 ++
 bindings/python/notmuch/globals.py  |  5 +++
 bindings/python/notmuch/message.py  | 80 -
 3 files changed, 88 insertions(+), 1 deletion(-)

diff --git a/bindings/python/docs/source/message.rst 
b/bindings/python/docs/source/message.rst
index 1a6cc3d5..b0033924 100644
--- a/bindings/python/docs/source/message.rst
+++ b/bindings/python/docs/source/message.rst
@@ -33,6 +33,10 @@
 
.. automethod:: get_tags
 
+   .. automethod:: get_property
+
+   .. automethod:: get_properties
+
.. automethod:: maildir_flags_to_tags
 
.. automethod:: tags_to_maildir_flags
diff --git a/bindings/python/notmuch/globals.py 
b/bindings/python/notmuch/globals.py
index 97413996..11e328b7 100644
--- a/bindings/python/notmuch/globals.py
+++ b/bindings/python/notmuch/globals.py
@@ -75,6 +75,11 @@ class NotmuchMessageS(Structure):
 NotmuchMessageP = POINTER(NotmuchMessageS)
 
 
+class NotmuchMessagePropertiesS(Structure):
+pass
+NotmuchMessagePropertiesP = POINTER(NotmuchMessagePropertiesS)
+
+
 class NotmuchTagsS(Structure):
 pass
 NotmuchTagsP = POINTER(NotmuchTagsS)
diff --git a/bindings/python/notmuch/message.py 
b/bindings/python/notmuch/message.py
index 1b1f2174..f57dbc80 100644
--- a/bindings/python/notmuch/message.py
+++ b/bindings/python/notmuch/message.py
@@ -19,7 +19,7 @@ Copyright 2010 Sebastian Spaeth 
 """
 
 
-from ctypes import c_char_p, c_long, c_uint, c_int
+from ctypes import c_char_p, c_long, c_uint, c_int, POINTER, byref
 from datetime import date
 from .globals import (
 nmlib,
@@ -29,6 +29,7 @@ from .globals import (
 NotmuchTagsP,
 NotmuchMessageP,
 NotmuchMessagesP,
+NotmuchMessagePropertiesP,
 NotmuchFilenamesP,
 )
 from .errors import (
@@ -113,6 +114,36 @@ class Message(Python3StringMixIn):
 _maildir_flags_to_tags.argtypes = [NotmuchMessageP]
 _maildir_flags_to_tags.restype = c_int
 
+"""notmuch_message_get_property"""
+_get_property = nmlib.notmuch_message_get_property
+_get_property.argtypes = [NotmuchMessageP, c_char_p, POINTER(c_char_p)]
+_get_property.restype = c_int
+
+"""notmuch_message_get_properties"""
+_get_properties = nmlib.notmuch_message_get_properties
+_get_properties.argtypes = [NotmuchMessageP, c_char_p, c_int]
+_get_properties.restype = NotmuchMessagePropertiesP
+
+"""notmuch_message_properties_valid"""
+_properties_valid = nmlib.notmuch_message_properties_valid
+_properties_valid.argtypes = [NotmuchMessagePropertiesP]
+_properties_valid.restype = bool
+
+"""notmuch_message_properties_value"""
+_properties_value = nmlib.notmuch_message_properties_value
+_properties_value.argtypes = [NotmuchMessagePropertiesP]
+_properties_value.restype = c_char_p
+
+"""notmuch_message_properties_key"""
+_properties_key = nmlib.notmuch_message_properties_key
+_properties_key.argtypes = [NotmuchMessagePropertiesP]
+_properties_key.restype = c_char_p
+
+"""notmuch_message_properties_move_to_next"""
+_properties_move_to_next = nmlib.notmuch_message_properties_move_to_next
+_properties_move_to_next.argtypes = [NotmuchMessagePropertiesP]
+_properties_move_to_next.restype = None
+
 #Constants: Flags that can be set/get with set_flag
 FLAG = Enum(['MATCH'])
 
@@ -433,6 +464,53 @@ class Message(Python3StringMixIn):
 _freeze.argtypes = [NotmuchMessageP]
 _freeze.restype = c_uint
 
+def get_property(self, prop):
+""" Retrieve the value for a single property key
+
+:param prop: The name of the property to get.
+:returns: String with the property value or None if there is no such
+  key. In the case of multiple values for the given key, the
+  first one is retrieved.
+:raises: :exc:`NotInitializedError` if message has not been
+ initialized
+"""
+if not self._msg:
+raise NotInitializedError()
+
+value = c_char_p("")
+status = Message._get_property(self._msg, prop, byref(value))
+if status != 0:
+raise NotmuchError(status)
+
+return value.value
+
+def get_properties(self, prop="", exact=False):
+""" Get the properties of the message, returning a generator of
+name, value pairs.
+
+The generator will yield once per value. There might be more than one
+value on each name, so the generator might yield the same name several
+times.
+
+:param prop: The name of the property to get. Otherwise it will return
+ the full list of properties of the message.
+:param exact: if True, require exact match with key. Otherwise
+  treat as prefix.
+:yields:  Each 

[PATCH] python: add bindings for notmuch_message_get_propert(y/ies)

2017-11-29 Thread Ruben Pollan
Message.get_property (prop) returns a string with the value of the property and
Message.get_properties (prop, exact=False) returns a list [(key, value)]
---
 bindings/python/notmuch/globals.py |  5 +++
 bindings/python/notmuch/message.py | 81 +-
 2 files changed, 85 insertions(+), 1 deletion(-)

diff --git a/bindings/python/notmuch/globals.py 
b/bindings/python/notmuch/globals.py
index 71426c84..801062dc 100644
--- a/bindings/python/notmuch/globals.py
+++ b/bindings/python/notmuch/globals.py
@@ -75,6 +75,11 @@ class NotmuchMessageS(Structure):
 NotmuchMessageP = POINTER(NotmuchMessageS)
 
 
+class NotmuchMessagePropertiesS(Structure):
+pass
+NotmuchMessagePropertiesP = POINTER(NotmuchMessagePropertiesS)
+
+
 class NotmuchTagsS(Structure):
 pass
 NotmuchTagsP = POINTER(NotmuchTagsS)
diff --git a/bindings/python/notmuch/message.py 
b/bindings/python/notmuch/message.py
index d5b98e4f..2025f979 100644
--- a/bindings/python/notmuch/message.py
+++ b/bindings/python/notmuch/message.py
@@ -19,7 +19,7 @@ Copyright 2010 Sebastian Spaeth 
 """
 
 
-from ctypes import c_char_p, c_long, c_uint, c_int
+from ctypes import c_char_p, c_long, c_uint, c_int, POINTER, byref
 from datetime import date
 from .globals import (
 nmlib,
@@ -29,6 +29,7 @@ from .globals import (
 NotmuchTagsP,
 NotmuchMessageP,
 NotmuchMessagesP,
+NotmuchMessagePropertiesP,
 NotmuchFilenamesP,
 )
 from .errors import (
@@ -113,6 +114,36 @@ class Message(Python3StringMixIn):
 _maildir_flags_to_tags.argtypes = [NotmuchMessageP]
 _maildir_flags_to_tags.restype = c_int
 
+"""notmuch_message_get_property"""
+_get_property = nmlib.notmuch_message_get_property
+_get_property.argtypes = [NotmuchMessageP, c_char_p, POINTER(c_char_p)]
+_get_property.restype = c_int
+
+"""notmuch_message_get_properties"""
+_get_properties = nmlib.notmuch_message_get_properties
+_get_properties.argtypes = [NotmuchMessageP, c_char_p, c_int]
+_get_properties.restype = NotmuchMessagePropertiesP
+
+"""notmuch_message_properties_valid"""
+_properties_valid = nmlib.notmuch_message_properties_valid
+_properties_valid.argtypes = [NotmuchMessagePropertiesP]
+_properties_valid.restype = bool
+
+"""notmuch_message_properties_value"""
+_properties_value = nmlib.notmuch_message_properties_value
+_properties_value.argtypes = [NotmuchMessagePropertiesP]
+_properties_value.restype = c_char_p
+
+"""notmuch_message_properties_key"""
+_properties_key = nmlib.notmuch_message_properties_key
+_properties_key.argtypes = [NotmuchMessagePropertiesP]
+_properties_key.restype = c_char_p
+
+"""notmuch_message_properties_move_to_next"""
+_properties_move_to_next = nmlib.notmuch_message_properties_move_to_next
+_properties_move_to_next.argtypes = [NotmuchMessagePropertiesP]
+_properties_move_to_next.restype = None
+
 #Constants: Flags that can be set/get with set_flag
 FLAG = Enum(['MATCH'])
 
@@ -433,6 +464,54 @@ class Message(Python3StringMixIn):
 _freeze.argtypes = [NotmuchMessageP]
 _freeze.restype = c_uint
 
+def get_property(self, prop):
+""" Retrieve the value for a single property key
+
+:param prop: The name of the property to get.
+:returns: String with the property value or None if there is no such
+  key. In the case of multiple values for the given key, the
+  first one is retrieved.
+:raises: :exc:`NotInitializedError` if message has not been
+ initialized
+"""
+if not self._msg:
+raise NotInitializedError()
+
+value = c_char_p("")
+status = Message._get_property(self._msg, prop, byref(value))
+if status != 0:
+raise NotmuchError(status)
+
+return value.value
+
+def get_properties(self, prop="", exact=False):
+""" Get the properties for *message*, returning
+notmuch_message_properties_t object which can be used to iterate
+over all properties.
+
+:param prop: The name of the property to get. Otherwise it will return
+ the full list of properties of the message.
+:param exact: if True, require exact match with key. Otherwise
+  treat as prefix.
+:returns: A dictionary with the property names and values {key: value}
+:raises: :exc:`NotInitializedError` if message has not been
+ initialized
+"""
+if not self._msg:
+raise NotInitializedError()
+
+properties_dict = {}
+properties = Message._get_properties(self._msg, prop, exact)
+while Message._properties_valid(properties):
+key = Message._properties_key(properties)
+value = Message._properties_value(properties)
+if key not in properties_dict:
+properties_dict[key] = []
+  

[PATCH] python: add bindings for notmuch_message_get_propert(y/ies)

2017-11-28 Thread Ruben Pollan
Message.get_property (prop) returns a string with the value of the property and
Message.get_properties (prop, exact=False) returns a list [(key, value)]
---
 bindings/python/notmuch/globals.py |  5 +++
 bindings/python/notmuch/message.py | 78 +-
 2 files changed, 82 insertions(+), 1 deletion(-)

diff --git a/bindings/python/notmuch/globals.py 
b/bindings/python/notmuch/globals.py
index 71426c84..801062dc 100644
--- a/bindings/python/notmuch/globals.py
+++ b/bindings/python/notmuch/globals.py
@@ -75,6 +75,11 @@ class NotmuchMessageS(Structure):
 NotmuchMessageP = POINTER(NotmuchMessageS)
 
 
+class NotmuchMessagePropertiesS(Structure):
+pass
+NotmuchMessagePropertiesP = POINTER(NotmuchMessagePropertiesS)
+
+
 class NotmuchTagsS(Structure):
 pass
 NotmuchTagsP = POINTER(NotmuchTagsS)
diff --git a/bindings/python/notmuch/message.py 
b/bindings/python/notmuch/message.py
index d5b98e4f..7b737943 100644
--- a/bindings/python/notmuch/message.py
+++ b/bindings/python/notmuch/message.py
@@ -19,7 +19,7 @@ Copyright 2010 Sebastian Spaeth 
 """
 
 
-from ctypes import c_char_p, c_long, c_uint, c_int
+from ctypes import c_char_p, c_long, c_uint, c_int, POINTER, byref
 from datetime import date
 from .globals import (
 nmlib,
@@ -29,6 +29,7 @@ from .globals import (
 NotmuchTagsP,
 NotmuchMessageP,
 NotmuchMessagesP,
+NotmuchMessagePropertiesP,
 NotmuchFilenamesP,
 )
 from .errors import (
@@ -113,6 +114,36 @@ class Message(Python3StringMixIn):
 _maildir_flags_to_tags.argtypes = [NotmuchMessageP]
 _maildir_flags_to_tags.restype = c_int
 
+"""notmuch_message_get_property"""
+_get_property = nmlib.notmuch_message_get_property
+_get_property.argtypes = [NotmuchMessageP, c_char_p, POINTER(c_char_p)]
+_get_property.restype = c_int
+
+"""notmuch_message_get_properties"""
+_get_properties = nmlib.notmuch_message_get_properties
+_get_properties.argtypes = [NotmuchMessageP, c_char_p, c_int]
+_get_properties.restype = NotmuchMessagePropertiesP
+
+"""notmuch_message_properties_valid"""
+_properties_valid = nmlib.notmuch_message_properties_valid
+_properties_valid.argtypes = [NotmuchMessagePropertiesP]
+_properties_valid.restype = bool
+
+"""notmuch_message_properties_value"""
+_properties_value = nmlib.notmuch_message_properties_value
+_properties_value.argtypes = [NotmuchMessagePropertiesP]
+_properties_value.restype = c_char_p
+
+"""notmuch_message_properties_key"""
+_properties_key = nmlib.notmuch_message_properties_key
+_properties_key.argtypes = [NotmuchMessagePropertiesP]
+_properties_key.restype = c_char_p
+
+"""notmuch_message_properties_move_to_next"""
+_properties_move_to_next = nmlib.notmuch_message_properties_move_to_next
+_properties_move_to_next.argtypes = [NotmuchMessagePropertiesP]
+_properties_move_to_next.restype = None
+
 #Constants: Flags that can be set/get with set_flag
 FLAG = Enum(['MATCH'])
 
@@ -433,6 +464,51 @@ class Message(Python3StringMixIn):
 _freeze.argtypes = [NotmuchMessageP]
 _freeze.restype = c_uint
 
+def get_property(self, prop):
+""" Retrieve the value for a single property key
+
+:param prop: The name of the property to get.
+:returns: String with the property value or None if there is no such
+  key. In the case of multiple values for the given key, the
+  first one is retrieved.
+:raises: :exc:`NotInitializedError` if message has not been
+ initialized
+"""
+if not self._msg:
+raise NotInitializedError()
+
+value = c_char_p("")
+status = Message._get_property(self._msg, prop, byref(value))
+if status != 0:
+raise NotmuchError(status)
+
+return value.value
+
+def get_properties(self, prop, exact=False):
+""" Get the properties for *message*, returning
+notmuch_message_properties_t object which can be used to iterate
+over all properties.
+
+:param prop: The name of the property to get.
+:param exact: if True, require exact match with key. Otherwise
+  treat as prefix.
+:returns: [(key, value)]
+:raises: :exc:`NotInitializedError` if message has not been
+ initialized
+"""
+if not self._msg:
+raise NotInitializedError()
+
+properties_list = []
+properties = Message._get_properties(self._msg, prop, exact)
+while Message._properties_valid(properties):
+key = Message._properties_key(properties)
+value = Message._properties_value(properties)
+properties_list.append((key, value))
+Message._properties_move_to_next(properties)
+
+return properties_list
+
 def freeze(self):
 """Freezes the current state of 'message' within the 

[PATCH] python: add bindings for notmuch_message_get_property

2017-11-15 Thread Ruben Pollan
Message.get_property (prop) returns a string with the value of the property.
---
 bindings/python/notmuch/message.py | 27 ++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/bindings/python/notmuch/message.py 
b/bindings/python/notmuch/message.py
index d5b98e4f..11263736 100644
--- a/bindings/python/notmuch/message.py
+++ b/bindings/python/notmuch/message.py
@@ -19,7 +19,7 @@ Copyright 2010 Sebastian Spaeth 
 """
 
 
-from ctypes import c_char_p, c_long, c_uint, c_int
+from ctypes import c_char_p, c_long, c_uint, c_int, POINTER, byref
 from datetime import date
 from .globals import (
 nmlib,
@@ -113,6 +113,11 @@ class Message(Python3StringMixIn):
 _maildir_flags_to_tags.argtypes = [NotmuchMessageP]
 _maildir_flags_to_tags.restype = c_int
 
+"""notmuch_message_get_property"""
+_get_property = nmlib.notmuch_message_get_property
+_get_property.argtypes = [NotmuchMessageP, c_char_p, POINTER(c_char_p)]
+_get_property.restype = c_int
+
 #Constants: Flags that can be set/get with set_flag
 FLAG = Enum(['MATCH'])
 
@@ -433,6 +438,26 @@ class Message(Python3StringMixIn):
 _freeze.argtypes = [NotmuchMessageP]
 _freeze.restype = c_uint
 
+def get_property(self, prop):
+""" Retrieve the value for a single property key
+
+:param prop: The name of the property to get.
+:returns: String with the property value or None if there is no such
+  key. In the case of multiple values for the given key, the
+  first one is retrieved.
+:raises: :exc:`NotInitializedError` if message has not been
+ initialized
+"""
+if not self._msg:
+raise NotInitializedError()
+
+value = c_char_p("")
+status = Message._get_property(self._msg, prop, byref(value))
+if status != 0:
+raise NotmuchError(status)
+
+return value.value
+
 def freeze(self):
 """Freezes the current state of 'message' within the database
 
-- 
2.15.0

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


alot: can't read sent emails, after encryption

2013-11-18 Thread Ruben Pollan
Quoting Jameson Graef Rollins (2013-11-17 20:43:25)
> On Sun, Nov 17 2013, Patrick Totzke  wrote:
> > Is this how notmuch emacs does it? I mean, is there some option to tell
> > emacs to always call gpg with --encrypt-to=me ?
> > I wonder if I need to change alot in any way or if one can simply globally 
> > configure
> > gnupg.. alot does not call the gpg binary but uses pygpgme.
> 
> You do not need to change alot, just notmuch emacs also doesn't need to
> do anything special to allow for this.  Just add an
> 
> encrypt-to 
> 
> line to your ~/.gnupg/gpg.conf, where  is your personal keyid.
> Then all encrypted data is also encrypted to your personal key, making
> it always viewable by you as well.  Then you can just open your
> encrypted sent mail as you would any other encrypted mail.

If I have to identities, with two different gpg keys (key1 and key2), and I set 
'encrypt-to key1' when I send emails with my identity of key2 it will also 
encrypt it with my key1 and will reveal to its receivers that I own key1. Isn't 
it?


-- 
Ruben Pollan  | http://meskio.net/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 My contact info: http://meskio.net/crypto.txt
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20131118/78d34560/attachment-0001.pgp>


Re: alot: can't read sent emails, after encryption

2013-11-18 Thread Ruben Pollan
Quoting Jameson Graef Rollins (2013-11-17 20:43:25)
 On Sun, Nov 17 2013, Patrick Totzke patricktot...@gmail.com wrote:
  Is this how notmuch emacs does it? I mean, is there some option to tell
  emacs to always call gpg with --encrypt-to=me ?
  I wonder if I need to change alot in any way or if one can simply globally 
  configure
  gnupg.. alot does not call the gpg binary but uses pygpgme.
 
 You do not need to change alot, just notmuch emacs also doesn't need to
 do anything special to allow for this.  Just add an
 
 encrypt-to keyid
 
 line to your ~/.gnupg/gpg.conf, where keyid is your personal keyid.
 Then all encrypted data is also encrypted to your personal key, making
 it always viewable by you as well.  Then you can just open your
 encrypted sent mail as you would any other encrypted mail.

If I have to identities, with two different gpg keys (key1 and key2), and I set 
'encrypt-to key1' when I send emails with my identity of key2 it will also 
encrypt it with my key1 and will reveal to its receivers that I own key1. Isn't 
it?


-- 
Ruben Pollan  | http://meskio.net/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 My contact info: http://meskio.net/crypto.txt
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.


signature.asc
Description: signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


alot: can't read sent emails, after encryption

2013-11-13 Thread Ruben Pollan
Quoting apmanine at idaaas.com (2013-11-12 15:27:42)
> I have recently switched to notmuch. Thank you for it!
> I'm using "alot" as a frontend (thank you for it, too!). Everything
> works smoothly, apart from one problem: with alot, I can't figure out how
> to read encrypted emails I previously sent: they appear to be encrypted
> using the addressee's key.
> 
> Is there some way to store encrypted sent emails with my own public gpg
> key?

Same problem here, I think what is stored is the email that was send. It will 
be 
great if alot stores it as you say with your own public gpg key.

I think we should open an issue about in the alot github tracker:
https://github.com/pazz/alot/issues
Can you do it?


-- 
Ruben Pollan  | http://meskio.net/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 My contact info: http://meskio.net/crypto.txt
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20131113/b2f2a9f7/attachment.pgp>


Re: alot: can't read sent emails, after encryption

2013-11-12 Thread Ruben Pollan
Quoting apman...@idaaas.com (2013-11-12 15:27:42)
 I have recently switched to notmuch. Thank you for it!
 I'm using alot as a frontend (thank you for it, too!). Everything
 works smoothly, apart from one problem: with alot, I can't figure out how
 to read encrypted emails I previously sent: they appear to be encrypted
 using the addressee's key.
 
 Is there some way to store encrypted sent emails with my own public gpg
 key?

Same problem here, I think what is stored is the email that was send. It will 
be 
great if alot stores it as you say with your own public gpg key.

I think we should open an issue about in the alot github tracker:
https://github.com/pazz/alot/issues
Can you do it?


-- 
Ruben Pollan  | http://meskio.net/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 My contact info: http://meskio.net/crypto.txt
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.


signature.asc
Description: signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[alot] announcing v0.3.5

2013-07-19 Thread Ruben Pollan
Quoting Patrick Totzke (2013-07-19 16:02:34)
> Hi Rub?n,
> 
> thanks for mentioning this. I must have accidentally dropped the 
> corresponding paragraph
> in the docs 
> (http://alot.readthedocs.org/en/testing/usage/index.html#cryptography).
> I'm almost certain I saw this documented a while back..
> 
> Basically, you need a running gpg-agent. Then, decryption of mails should 
> happen
> automatically once you open a thread. The same holds for signature 
> verification
> (the status of which will be mentioned in a pseudo-header).
> This holds for mails that comply PGP/MIME only. "ASCII-armored" text in 
> plaintext parts
> is not dealt with.
> 
> If this does not work, you've found a bug that you should kindly report :)

Sadly that is not what I see. I'm trying to read an email that mutt reports as 
PGP/MIME but the content appear blank. I guess I have gpg-agent properly 
working, because when I send a signed email I get a 'window' asking me for my 
passphrase and it signs it. But it don't asks for the password when I try to 
read an encrypted email.

Do I need any special configuration on gpg-agent for it?

-- 
Rub?n Poll?n  | http://meskio.net/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: signature
URL: 



[alot] announcing v0.3.5

2013-07-19 Thread Ruben Pollan
Hello pazz,

Quoting Patrick Totzke (2013-07-18 11:21:24)
> Most notably, this update comes with a rewrite of Thread buffers,
> allowing among other things thread-tree based focus movements.
> Alot now has full support for PGP/MIME encryption and signatures,
> courtesy of Justus (teythoon). Apart from this, the new release comes with the
> usual ton of fixes contributed by various people (see below).
[...]
> 
> Usage updates since v0.3.4:
> * full support for PGP/MIME [de|en]cryption and signatures

I see here that alot now is able to decrypt emails? How can I do it? I have a 
gpg-agent running and I can sign and encrypt emails when I send them, but I 
can't read any of the encrypted emails. Is there a key binding for it? (I 
didn't 
found it on the manual).


Thank you for keep alot alive. I've been using it as my primary email client 
since a couple of years and I'm pretty happy with it.

-- 
Rub?n Poll?n  | http://meskio.net/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: signature
URL: 



Re: [alot] announcing v0.3.5

2013-07-19 Thread Ruben Pollan
Quoting Patrick Totzke (2013-07-19 16:02:34)
 Hi Rubén,
 
 thanks for mentioning this. I must have accidentally dropped the 
 corresponding paragraph
 in the docs 
 (http://alot.readthedocs.org/en/testing/usage/index.html#cryptography).
 I'm almost certain I saw this documented a while back..
 
 Basically, you need a running gpg-agent. Then, decryption of mails should 
 happen
 automatically once you open a thread. The same holds for signature 
 verification
 (the status of which will be mentioned in a pseudo-header).
 This holds for mails that comply PGP/MIME only. ASCII-armored text in 
 plaintext parts
 is not dealt with.
 
 If this does not work, you've found a bug that you should kindly report :)

Sadly that is not what I see. I'm trying to read an email that mutt reports as 
PGP/MIME but the content appear blank. I guess I have gpg-agent properly 
working, because when I send a signed email I get a 'window' asking me for my 
passphrase and it signs it. But it don't asks for the password when I try to 
read an encrypted email.

Do I need any special configuration on gpg-agent for it?

-- 
Rubén Pollán  | http://meskio.net/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.


signature.asc
Description: signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [alot] announcing v0.3.5

2013-07-19 Thread Ruben Pollan
Quoting Patrick Totzke (2013-07-19 17:14:07)
  Sadly that is not what I see. I'm trying to read an email that mutt reports 
  as PGP/MIME but the content appear blank. 
 
 Is is possible that this mail's body is ctype 'text/html' and you haven't set 
 up
 your mailcap for html (as in FAQ #5 or issue #622)?
 
  I guess I have gpg-agent properly 
  working, because when I send a signed email I get a 'window' asking me for 
  my 
  passphrase and it signs it. But it don't asks for the password when I try 
  to 
  read an encrypted email.
 
 Yes, it seems you have set up gpg-agent correctly then.
  
  Do I need any special configuration on gpg-agent for it?
 
 Not that I know of.
 
 BTW: why did you not notice this earlier in the 'testing' branch? :P
 
 I cannot think of anything else atm, sorry. Maybe Justus has an Idea?
 Could you open an issue about this with some more details about the mail and 
 your setup?

I just found the problem. I was still having the debian package installed and 
alot was using it's old alot-egg from debian :( Now that I uninstall the 
package 
is working fine.

Sorry.

-- 
Rubén Pollán  | http://meskio.net/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.


signature.asc
Description: signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


notspam: a notmuch interface to spamassassin

2013-03-07 Thread Ruben Pollan
Quoting Svend Sorensen (2013-03-06 19:40:19)
> Jameson Graef Rollins  writes:
> > PS: if anyone has any suggestions for Bayesian classifiers better than
> > sa I'm all ears.  I'm not so happy with sa at the moment.
> 
> I used bogofilter when I was hosting my own email, and I was happy with
> it.

I use crm114 as spam filter, it also works pretty well.


-- 
Rub?n Poll?n  | http://meskio.net/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.


Re: notspam: a notmuch interface to spamassassin

2013-03-07 Thread Ruben Pollan
Quoting Svend Sorensen (2013-03-06 19:40:19)
 Jameson Graef Rollins jroll...@finestructure.net writes:
  PS: if anyone has any suggestions for Bayesian classifiers better than
  sa I'm all ears.  I'm not so happy with sa at the moment.
 
 I used bogofilter when I was hosting my own email, and I was happy with
 it.

I use crm114 as spam filter, it also works pretty well.


-- 
Rubén Pollán  | http://meskio.net/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


notmuch webmails

2013-02-14 Thread Ruben Pollan
As a way to learn javascript I'm experimenting with the idea of a notmuch based 
webmail. You can see the dummy demo I did at:
https://gitorious.org/notwebmail
It's far from a proper webmail, you can only search and see your email but not 
write or modify tags.

Yesterday on the irc Beamer told me someone was also working on a webmail. Is 
someone in the list hacking on that?

Cheers,

-- 
Rub?n Poll?n  | http://meskio.net/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.


notmuch webmails

2013-02-14 Thread Ruben Pollan
As a way to learn javascript I'm experimenting with the idea of a notmuch based 
webmail. You can see the dummy demo I did at:
https://gitorious.org/notwebmail
It's far from a proper webmail, you can only search and see your email but not 
write or modify tags.

Yesterday on the irc Beamer told me someone was also working on a webmail. Is 
someone in the list hacking on that?

Cheers,

-- 
Rubén Pollán  | http://meskio.net/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] test: change "#!/bin/bash" to "#!/usr/bin/env bash" enhances portability

2010-12-02 Thread Ruben Pollan
On 21:27, Wed 01 Dec 10, Joel Borggr?n-Franck wrote:
> From: Joel Borggr?n-Franck 
> 
> Change #!/bin/bash at start of tests to "#!/usr/bin/env bash". That way
> systems running on bash < 4 can prepend bash >= 4 to path before
> running the tests.

Is there any reason to use bash? Is the test system dependent to any key feature
of bash?

Not every system has bash installed. To have a dependency on bash just for
development I think is not a big issue. But if it don't requires any big effort
I think will be better to have it more generic.


-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 



Re: [PATCH] test: change #!/bin/bash to #!/usr/bin/env bash enhances portability

2010-12-02 Thread Ruben Pollan
On 21:27, Wed 01 Dec 10, Joel Borggrén-Franck wrote:
 From: Joel Borggrén-Franck j...@codehouse.se
 
 Change #!/bin/bash at start of tests to #!/usr/bin/env bash. That way
 systems running on bash  4 can prepend bash = 4 to path before
 running the tests.

Is there any reason to use bash? Is the test system dependent to any key feature
of bash?

Not every system has bash installed. To have a dependency on bash just for
development I think is not a big issue. But if it don't requires any big effort
I think will be better to have it more generic.


-- 
Rubén Pollán  | jabber:mes...@jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.


signature.asc
Description: Digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/2] Include 'unread' tag only to mails in new

2010-11-22 Thread Ruben Pollan
On 00:27, Sun 21 Nov 10, Michal Sojka wrote:
> Ruben's previous patch fixed the problem that he experienced, but it
> also caused the test "Removing info from filename leaves tags unchanged"
> to fail. This is an attempt to make all tests to pass.
> 
> The Ruben's change is restricted to be only effective in 'new' directory.

That patch works fine for me.

-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
?sta es la historia de una sociedad que se hunde
y mientras cae se repite:
hasta ahora todo va bien, hasta ahora todo va bien ...
Pero lo importante no es la caida sino el aterrizaje.
   el odio
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 



Re: [PATCH 2/2] Include 'unread' tag only to mails in new

2010-11-22 Thread Ruben Pollan
On 00:27, Sun 21 Nov 10, Michal Sojka wrote:
 Ruben's previous patch fixed the problem that he experienced, but it
 also caused the test Removing info from filename leaves tags unchanged
 to fail. This is an attempt to make all tests to pass.
 
 The Ruben's change is restricted to be only effective in 'new' directory.

That patch works fine for me.

-- 
Rubén Pollán  | jabber:mes...@jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Ésta es la historia de una sociedad que se hunde
y mientras cae se repite:
hasta ahora todo va bien, hasta ahora todo va bien ...
Pero lo importante no es la caida sino el aterrizaje.
   el odio


signature.asc
Description: Digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Maildir-flags synchronization now on master branch

2010-11-18 Thread Ruben Pollan
On 05:04, Thu 11 Nov 10, Carl Worth wrote:
> Thanks to work by Michal, and a few followups by me, I'm now happy to
> report that the patches for synchronizing tags with maildir flags are
> now pushed out to the master branch.

Nice to see that, I was waiting for this feature since a while.

I only find a problem with it. The 'unread' tag is not working as I expected.
notmuch only tags as 'unread' my email at 'cur' folder. fetchmail download the
email to the 'new' folder. As I understand that is a correct behaviour[0].


[0] http://cr.yp.to/proto/maildir.html

-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
   Hay un mundo
  a la vuelta de la esquina de tu mente,
 donde la realidad es un intruso
  y los sue?os se hacen realidad.

-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 



Re: Maildir-flags synchronization now on master branch

2010-11-18 Thread Ruben Pollan
On 05:04, Thu 11 Nov 10, Carl Worth wrote:
 Thanks to work by Michal, and a few followups by me, I'm now happy to
 report that the patches for synchronizing tags with maildir flags are
 now pushed out to the master branch.

Nice to see that, I was waiting for this feature since a while.

I only find a problem with it. The 'unread' tag is not working as I expected.
notmuch only tags as 'unread' my email at 'cur' folder. fetchmail download the
email to the 'new' folder. As I understand that is a correct behaviour[0].


[0] http://cr.yp.to/proto/maildir.html

-- 
Rubén Pollán  | jabber:mes...@jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
   Hay un mundo
  a la vuelta de la esquina de tu mente,
 donde la realidad es un intruso
  y los sueños se hacen realidad.



signature.asc
Description: Digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] [PATCH 3/4] Add maildir-based mailstore

2010-03-23 Thread Ruben Pollan
On 14:35, Tue 23 Mar 10, Michal Sojka wrote:
> On Tue, 23 Mar 2010, Ruben Pollan wrote:
> > On 16:39, Thu 18 Mar 10, Michal Sojka wrote:
> > > This mailstore allows bi-directional synchronization between maildir
> > > flags and certain tags. The flag-to-tag mapping is defined by flag2tag
> > > array.
> > 
> > I'm trying it, the synchronization from my maildir to notmuch seems to work 
> > fine
> > except for the "unread" tag, it is never set. I use normally my maildir with
> > mutt, so the unread messages are on mail_folder/new. Could that be the 
> > problem?
> > is it a bug or something I do wrong?
> 
> Yes, that's a bug. Messages in your mail_folder/new probably don't have
> any 'info' (flags) in their filename, which is correct with respect to
> http://cr.yp.to/proto/maildir.html. My patch incorrectly ignores the
> files without 'info'. I didn't catch this error because is seems that
> offlineimap puts 'info' part even to messages in new/.

True, I use fetchmail for download my email, it put the email in the new folder
without 'info'.

> I think that the correct fix for this is to change how notmuch new
> works: Whenever a message in new/ is found, it will be moved to cur/ and
> in there is no info part it will be appended and the message will be
> tagged accordingly.

I think is better if new keeps the email where it is, only updates the database,
and when you remove the unread tag move the message from folder to folder. Some 
mail readers (at least mutt) handles different the emails on the new folder than
the ones with no "S" flag con cur folder.

> I'll try to implement it and send a new patch.

That will be nice.


-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100323/7716eb75/attachment.pgp>


[notmuch] [PATCH 4/4] Tests for maildir-based mailstore

2010-03-23 Thread Ruben Pollan
On 16:39, Thu 18 Mar 10, Michal Sojka wrote:
> Signed-off-by: Michal Sojka 
> ---
>  test/t0006-maildir.sh |  113 
> +
>  test/test-lib.sh  |7 ++-
>  2 files changed, 118 insertions(+), 2 deletions(-)
>  create mode 100755 test/t0006-maildir.sh

This patch is not applicable on HEAD. The file test/test-lib.sh don't exists.


-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 No vamos a reivindicar nada,
no vamos a pedir nada.
Tomaremos, okuparemos.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 



[notmuch] [PATCH 3/4] Add maildir-based mailstore

2010-03-23 Thread Ruben Pollan
On 16:39, Thu 18 Mar 10, Michal Sojka wrote:
> This mailstore allows bi-directional synchronization between maildir
> flags and certain tags. The flag-to-tag mapping is defined by flag2tag
> array.

I'm trying it, the synchronization from my maildir to notmuch seems to work fine
except for the "unread" tag, it is never set. I use normally my maildir with
mutt, so the unread messages are on mail_folder/new. Could that be the problem?
is it a bug or something I do wrong?

Thanks for your patch.

-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
   Hay un mundo
  a la vuelta de la esquina de tu mente,
 donde la realidad es un intruso
  y los sue?os se hacen realidad.

-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 



Re: [notmuch] [PATCH 3/4] Add maildir-based mailstore

2010-03-23 Thread Ruben Pollan
On 16:39, Thu 18 Mar 10, Michal Sojka wrote:
 This mailstore allows bi-directional synchronization between maildir
 flags and certain tags. The flag-to-tag mapping is defined by flag2tag
 array.

I'm trying it, the synchronization from my maildir to notmuch seems to work fine
except for the unread tag, it is never set. I use normally my maildir with
mutt, so the unread messages are on mail_folder/new. Could that be the problem?
is it a bug or something I do wrong?

Thanks for your patch.

-- 
Rubén Pollán  | jabber:mes...@jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
   Hay un mundo
  a la vuelta de la esquina de tu mente,
 donde la realidad es un intruso
  y los sueños se hacen realidad.



signature.asc
Description: Digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] [PATCH 4/4] Tests for maildir-based mailstore

2010-03-23 Thread Ruben Pollan
On 16:39, Thu 18 Mar 10, Michal Sojka wrote:
 Signed-off-by: Michal Sojka sojk...@fel.cvut.cz
 ---
  test/t0006-maildir.sh |  113 
 +
  test/test-lib.sh  |7 ++-
  2 files changed, 118 insertions(+), 2 deletions(-)
  create mode 100755 test/t0006-maildir.sh

This patch is not applicable on HEAD. The file test/test-lib.sh don't exists.


-- 
Rubén Pollán  | jabber:mes...@jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 No vamos a reivindicar nada,
no vamos a pedir nada.
Tomaremos, okuparemos.


signature.asc
Description: Digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] [PATCH 3/4] Add maildir-based mailstore

2010-03-23 Thread Ruben Pollan
On 14:35, Tue 23 Mar 10, Michal Sojka wrote:
 On Tue, 23 Mar 2010, Ruben Pollan wrote:
  On 16:39, Thu 18 Mar 10, Michal Sojka wrote:
   This mailstore allows bi-directional synchronization between maildir
   flags and certain tags. The flag-to-tag mapping is defined by flag2tag
   array.
  
  I'm trying it, the synchronization from my maildir to notmuch seems to work 
  fine
  except for the unread tag, it is never set. I use normally my maildir with
  mutt, so the unread messages are on mail_folder/new. Could that be the 
  problem?
  is it a bug or something I do wrong?
 
 Yes, that's a bug. Messages in your mail_folder/new probably don't have
 any 'info' (flags) in their filename, which is correct with respect to
 http://cr.yp.to/proto/maildir.html. My patch incorrectly ignores the
 files without 'info'. I didn't catch this error because is seems that
 offlineimap puts 'info' part even to messages in new/.

True, I use fetchmail for download my email, it put the email in the new folder
without 'info'.

 I think that the correct fix for this is to change how notmuch new
 works: Whenever a message in new/ is found, it will be moved to cur/ and
 in there is no info part it will be appended and the message will be
 tagged accordingly.

I think is better if new keeps the email where it is, only updates the database,
and when you remove the unread tag move the message from folder to folder. Some 
mail readers (at least mutt) handles different the emails on the new folder than
the ones with no S flag con cur folder.

 I'll try to implement it and send a new patch.

That will be nice.


-- 
Rubén Pollán  | jabber:mes...@jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.


signature.asc
Description: Digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] reverse iterators

2010-03-22 Thread Ruben Pollan
On 21:07, Sun 21 Mar 10, Sebastian Spaeth wrote:
> On Sat, 20 Mar 2010 11:23:20 +0100, Ruben Pollan  
> wrote:
> > 
> > Adds support to reverse iteration on messages, threads and tags. To revew 
> > and
> > think if makes sense to include them on notmuch or wait until they have a 
> > real
> > use.
> 
> /me raises arm. Real use case here! Personally, I don't need the
> backwards operator (and I don't see the case where I would need to go
> back very often).

For me is pretty useful because I use the iterator as a cursor on an ncurses
notmuch interface. So the selected thread is where the iterator is and the user
can to go forward or backwards.

> But a _move_to_first() for threads, messages (and
> probably tags), would be really useful to me now:

:) Happy to see there is someone else needing it.


-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Lo hago para no volverme loco cuando noto
que solo me queda un demonio en un hombro
por que se ha cortado las venas
el ?ngel que hab?a en el otro.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100322/71079a1a/attachment.pgp>


[notmuch] Using notmuch as an address book for tab-completion

2010-03-22 Thread Ruben Pollan
On 22:35, Sat 20 Mar 10, Jesse Rosenthal wrote:
> There was some talk on IRC ages ago about using notmuch as an
> address-book for tab-completion in emacs message mode. Thanks to some
> great recent work (Ingmar Vanhassel's shared lib and Sebastians's
> cnotmuch python lib) I have been able to take a first step in that
> direction. I've written a python script (with some help and suggestions
> from spaetz) which can perform the address-book functionality, and a
> backend for emacs's EUDC address-lookup functionality to access the
> script.

Nice feature. I think it should be implemented in the library. There is already
a function notmuch_database_get_all_tags, will be nice to have a function
notmuch_database_get_all_addresses. And make it somehow accessible from the
notmuch cli.

-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Sed realistas, exigid lo imposible.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 



Re: [notmuch] Using notmuch as an address book for tab-completion

2010-03-22 Thread Ruben Pollan
On 22:35, Sat 20 Mar 10, Jesse Rosenthal wrote:
 There was some talk on IRC ages ago about using notmuch as an
 address-book for tab-completion in emacs message mode. Thanks to some
 great recent work (Ingmar Vanhassel's shared lib and Sebastians's
 cnotmuch python lib) I have been able to take a first step in that
 direction. I've written a python script (with some help and suggestions
 from spaetz) which can perform the address-book functionality, and a
 backend for emacs's EUDC address-lookup functionality to access the
 script.

Nice feature. I think it should be implemented in the library. There is already
a function notmuch_database_get_all_tags, will be nice to have a function
notmuch_database_get_all_addresses. And make it somehow accessible from the
notmuch cli.

-- 
Rubén Pollán  | jabber:mes...@jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Sed realistas, exigid lo imposible.


signature.asc
Description: Digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] reverse iterators

2010-03-22 Thread Ruben Pollan
On 21:07, Sun 21 Mar 10, Sebastian Spaeth wrote:
 On Sat, 20 Mar 2010 11:23:20 +0100, Ruben Pollan mes...@sindominio.net 
 wrote:
  
  Adds support to reverse iteration on messages, threads and tags. To revew 
  and
  think if makes sense to include them on notmuch or wait until they have a 
  real
  use.
 
 /me raises arm. Real use case here! Personally, I don't need the
 backwards operator (and I don't see the case where I would need to go
 back very often).

For me is pretty useful because I use the iterator as a cursor on an ncurses
notmuch interface. So the selected thread is where the iterator is and the user
can to go forward or backwards.

 But a _move_to_first() for threads, messages (and
 probably tags), would be really useful to me now:

:) Happy to see there is someone else needing it.


-- 
Rubén Pollán  | jabber:mes...@jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Lo hago para no volverme loco cuando noto
que solo me queda un demonio en un hombro
por que se ha cortado las venas
el ángel que había en el otro.


signature.asc
Description: Digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] [PATCH 2/2] Added backwards iterator to threads

2010-03-21 Thread Ruben Pollan
Added the functions notmuch_threads_move_to_prevoius,
notmuch_threads_move_to_last and  notmuch_threads_move_to_first to
notmuch library. With them is possible to iterate backwards on threads.

* notmuch_threads_move_to_prevoius do the opposite than
  notmuch_threads_move_to_next, getting the threads iterator one
  position backwards.

* notmuch_threads_move_to_last move the iterator to the first last
thread.

* notmuch_threads_move_to_first move the iterator to the first valid
  thread.

For it has been implemented notmuch_thread_list_t structur that stores
the thread_ids so the backwards iteration gets the thread_id in the same
order that was show on forward iteration.
---
 lib/notmuch.h |   28 
 lib/query.cc  |  209 
 2 files changed, 222 insertions(+), 15 deletions(-)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index 0d9cb0f..62f4ad4 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -466,6 +466,15 @@ notmuch_threads_valid (notmuch_threads_t *threads);
 notmuch_thread_t *
 notmuch_threads_get (notmuch_threads_t *threads);

+/* Move the 'threads' iterator to the first thread.  
+ *
+ * After that the 'threads' iterator will be set to the first valid
+ * thread, so it can be use to iterate with
+ * notmuch_threads_move_to_next.
+ */
+void
+notmuch_threads_move_to_first (notmuch_threads_t *threads);
+
 /* Move the 'threads' iterator to the next thread.
  *
  * If 'threads' is already pointing at the last thread then the
@@ -479,6 +488,25 @@ notmuch_threads_get (notmuch_threads_t *threads);
 void
 notmuch_threads_move_to_next (notmuch_threads_t *threads);

+/* Move the 'threads' iterator to the last thread.
+ *
+ * After that the 'threads' iterator will be set to the last valid
+ * thread, so it can be use to iterate with
+ * notmuch_threads_move_to_previous.
+ */
+void
+notmuch_threads_move_to_last (notmuch_threads_t *threads);
+
+/* Move the 'threads' iterator to the previous thread.
+ *
+ * If 'threads' is already pointing at the first thread then the
+ * iterator will be moved to a point just beyond that first thread,
+ * (where notmuch_threads_valid will return FALSE and
+ * notmuch_threads_get will return NULL).
+ */
+void
+notmuch_threads_move_to_previous (notmuch_threads_t *threads);
+
 /* Destroy a notmuch_threads_t object.
  *
  * It's not strictly necessary to call this function. All memory from
diff --git a/lib/query.cc b/lib/query.cc
index 514a156..727f449 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -35,16 +35,29 @@ typedef struct _notmuch_mset_messages {
 notmuch_messages_t base;
 notmuch_database_t *notmuch;
 Xapian::MSetIterator iterator;
+Xapian::MSetIterator iterator_begin;
 Xapian::MSetIterator iterator_end;
 } notmuch_mset_messages_t;

+typedef struct _notmuch_thread_node {
+const char *thread_id;
+struct _notmuch_thread_node *next;
+struct _notmuch_thread_node *prev;
+} notmuch_thread_node_t;
+
+typedef struct _notmuch_thread_list {
+notmuch_thread_node_t *head;
+notmuch_thread_node_t *tail;
+notmuch_thread_node_t *iterator;
+} notmuch_thread_list_t;
+
 struct _notmuch_threads {
 notmuch_query_t *query;
 GHashTable *threads;
 notmuch_messages_t *messages;

-/* This thread ID is our iterator state. */
-const char *thread_id;
+/* thread list with the thread_id of the showed messages */
+notmuch_thread_list_t *list;
 };

 notmuch_query_t *
@@ -86,6 +99,7 @@ static int
 _notmuch_messages_destructor (notmuch_mset_messages_t *messages)
 {
 messages->iterator.~MSetIterator ();
+messages->iterator_begin.~MSetIterator ();
 messages->iterator_end.~MSetIterator ();

 return 0;
@@ -108,6 +122,7 @@ notmuch_query_search_messages (notmuch_query_t *query)
messages->base.iterator = NULL;
messages->notmuch = notmuch;
new (>iterator) Xapian::MSetIterator ();
+   new (>iterator_begin) Xapian::MSetIterator ();
new (>iterator_end) Xapian::MSetIterator ();

talloc_set_destructor (messages, _notmuch_messages_destructor);
@@ -157,6 +172,7 @@ notmuch_query_search_messages (notmuch_query_t *query)
mset = enquire.get_mset (0, notmuch->xapian_db->get_doccount ());

messages->iterator = mset.begin ();
+   messages->iterator_begin = mset.begin ();
messages->iterator_end = mset.end ();

 } catch (const Xapian::Error ) {
@@ -208,6 +224,16 @@ _notmuch_mset_messages_get (notmuch_messages_t *messages)
 }

 void
+_notmuch_mset_messages_move_to_first (notmuch_messages_t *messages)
+{
+notmuch_mset_messages_t *mset_messages;
+
+mset_messages = (notmuch_mset_messages_t *) messages;
+
+mset_messages->iterator = mset_messages->iterator_begin;
+}
+
+void
 _notmuch_mset_messages_move_to_next (notmuch_messages_t *messages)
 {
 notmuch_mset_messages_t *mset_messages;
@@ -217,6 +243,113 @@ _notmuch_mset_messages_move_to_next (notmuch_messages_t 
*messages)
 

[notmuch] [PATCH 1/2] Move the logic of threads iterator out of 'valid'

2010-03-21 Thread Ruben Pollan
The logic of notmuch_threads_move_to_next iterator was on
notmuch_threads_valid function. Now notmuch_threads_valid just check if
the iterator is valid and is notmuch_threads_move_to_next wich actually
update the iterator.
---
 lib/query.cc |   54 ++
 1 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/lib/query.cc b/lib/query.cc
index 9266d35..514a156 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -233,6 +233,7 @@ notmuch_threads_t *
 notmuch_query_search_threads (notmuch_query_t *query)
 {
 notmuch_threads_t *threads;
+notmuch_message_t *message;

 threads = talloc (query, notmuch_threads_t);
 if (threads == NULL)
@@ -243,8 +244,17 @@ notmuch_query_search_threads (notmuch_query_t *query)
  free, NULL);

 threads->messages = notmuch_query_search_messages (query);
+if (!notmuch_messages_valid (threads->messages))
+{
+threads->thread_id = NULL;
+return threads;
+}

-threads->thread_id = NULL;
+message = notmuch_messages_get (threads->messages);
+threads->thread_id = notmuch_message_get_thread_id (message);
+g_hash_table_insert (threads->threads,
+ xstrdup (threads->thread_id),
+ NULL);

 talloc_set_destructor (threads, _notmuch_threads_destructor);

@@ -260,10 +270,25 @@ notmuch_query_destroy (notmuch_query_t *query)
 notmuch_bool_t
 notmuch_threads_valid (notmuch_threads_t *threads)
 {
-notmuch_message_t *message;
+return (threads->thread_id != NULL);
+}
+
+notmuch_thread_t *
+notmuch_threads_get (notmuch_threads_t *threads)
+{
+if (! notmuch_threads_valid (threads))
+   return NULL;
+
+return _notmuch_thread_create (threads->query,
+  threads->query->notmuch,
+  threads->thread_id,
+  threads->query->query_string);
+}

-if (threads->thread_id)
-   return TRUE;
+void
+notmuch_threads_move_to_next (notmuch_threads_t *threads)
+{
+notmuch_message_t *message;

 while (notmuch_messages_valid (threads->messages))
 {
@@ -278,32 +303,13 @@ notmuch_threads_valid (notmuch_threads_t *threads)
g_hash_table_insert (threads->threads,
 xstrdup (threads->thread_id), NULL);
notmuch_messages_move_to_next (threads->messages);
-   return TRUE;
+   return;
}

notmuch_messages_move_to_next (threads->messages);
 }

 threads->thread_id = NULL;
-return FALSE;
-}
-
-notmuch_thread_t *
-notmuch_threads_get (notmuch_threads_t *threads)
-{
-if (! notmuch_threads_valid (threads))
-   return NULL;
-
-return _notmuch_thread_create (threads->query,
-  threads->query->notmuch,
-  threads->thread_id,
-  threads->query->query_string);
-}
-
-void
-notmuch_threads_move_to_next (notmuch_threads_t *threads)
-{
-threads->thread_id = NULL;
 }

 void
-- 
1.7.0



[notmuch] [PATCH] sending again patches 3 & 4

2010-03-21 Thread Ruben Pollan
I send again the patches 3 and 4, beacuse I found a bug on them. The previous 
implementation did a segfault when the search didn't have results.



[notmuch] [PATCH] sending again patches 3 4

2010-03-21 Thread Ruben Pollan
I send again the patches 3 and 4, beacuse I found a bug on them. The previous 
implementation did a segfault when the search didn't have results.

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] [PATCH 1/2] Move the logic of threads iterator out of 'valid'

2010-03-21 Thread Ruben Pollan
The logic of notmuch_threads_move_to_next iterator was on
notmuch_threads_valid function. Now notmuch_threads_valid just check if
the iterator is valid and is notmuch_threads_move_to_next wich actually
update the iterator.
---
 lib/query.cc |   54 ++
 1 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/lib/query.cc b/lib/query.cc
index 9266d35..514a156 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -233,6 +233,7 @@ notmuch_threads_t *
 notmuch_query_search_threads (notmuch_query_t *query)
 {
 notmuch_threads_t *threads;
+notmuch_message_t *message;
 
 threads = talloc (query, notmuch_threads_t);
 if (threads == NULL)
@@ -243,8 +244,17 @@ notmuch_query_search_threads (notmuch_query_t *query)
  free, NULL);
 
 threads-messages = notmuch_query_search_messages (query);
+if (!notmuch_messages_valid (threads-messages))
+{
+threads-thread_id = NULL;
+return threads;
+}
 
-threads-thread_id = NULL;
+message = notmuch_messages_get (threads-messages);
+threads-thread_id = notmuch_message_get_thread_id (message);
+g_hash_table_insert (threads-threads,
+ xstrdup (threads-thread_id),
+ NULL);
 
 talloc_set_destructor (threads, _notmuch_threads_destructor);
 
@@ -260,10 +270,25 @@ notmuch_query_destroy (notmuch_query_t *query)
 notmuch_bool_t
 notmuch_threads_valid (notmuch_threads_t *threads)
 {
-notmuch_message_t *message;
+return (threads-thread_id != NULL);
+}
+
+notmuch_thread_t *
+notmuch_threads_get (notmuch_threads_t *threads)
+{
+if (! notmuch_threads_valid (threads))
+   return NULL;
+
+return _notmuch_thread_create (threads-query,
+  threads-query-notmuch,
+  threads-thread_id,
+  threads-query-query_string);
+}
 
-if (threads-thread_id)
-   return TRUE;
+void
+notmuch_threads_move_to_next (notmuch_threads_t *threads)
+{
+notmuch_message_t *message;
 
 while (notmuch_messages_valid (threads-messages))
 {
@@ -278,32 +303,13 @@ notmuch_threads_valid (notmuch_threads_t *threads)
g_hash_table_insert (threads-threads,
 xstrdup (threads-thread_id), NULL);
notmuch_messages_move_to_next (threads-messages);
-   return TRUE;
+   return;
}
 
notmuch_messages_move_to_next (threads-messages);
 }
 
 threads-thread_id = NULL;
-return FALSE;
-}
-
-notmuch_thread_t *
-notmuch_threads_get (notmuch_threads_t *threads)
-{
-if (! notmuch_threads_valid (threads))
-   return NULL;
-
-return _notmuch_thread_create (threads-query,
-  threads-query-notmuch,
-  threads-thread_id,
-  threads-query-query_string);
-}
-
-void
-notmuch_threads_move_to_next (notmuch_threads_t *threads)
-{
-threads-thread_id = NULL;
 }
 
 void
-- 
1.7.0

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] [PATCH 2/2] Added backwards iterator to threads

2010-03-21 Thread Ruben Pollan
Added the functions notmuch_threads_move_to_prevoius,
notmuch_threads_move_to_last and  notmuch_threads_move_to_first to
notmuch library. With them is possible to iterate backwards on threads.

* notmuch_threads_move_to_prevoius do the opposite than
  notmuch_threads_move_to_next, getting the threads iterator one
  position backwards.

* notmuch_threads_move_to_last move the iterator to the first last
thread.

* notmuch_threads_move_to_first move the iterator to the first valid
  thread.

For it has been implemented notmuch_thread_list_t structur that stores
the thread_ids so the backwards iteration gets the thread_id in the same
order that was show on forward iteration.
---
 lib/notmuch.h |   28 
 lib/query.cc  |  209 
 2 files changed, 222 insertions(+), 15 deletions(-)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index 0d9cb0f..62f4ad4 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -466,6 +466,15 @@ notmuch_threads_valid (notmuch_threads_t *threads);
 notmuch_thread_t *
 notmuch_threads_get (notmuch_threads_t *threads);
 
+/* Move the 'threads' iterator to the first thread.  
+ *
+ * After that the 'threads' iterator will be set to the first valid
+ * thread, so it can be use to iterate with
+ * notmuch_threads_move_to_next.
+ */
+void
+notmuch_threads_move_to_first (notmuch_threads_t *threads);
+
 /* Move the 'threads' iterator to the next thread.
  *
  * If 'threads' is already pointing at the last thread then the
@@ -479,6 +488,25 @@ notmuch_threads_get (notmuch_threads_t *threads);
 void
 notmuch_threads_move_to_next (notmuch_threads_t *threads);
 
+/* Move the 'threads' iterator to the last thread.
+ *
+ * After that the 'threads' iterator will be set to the last valid
+ * thread, so it can be use to iterate with
+ * notmuch_threads_move_to_previous.
+ */
+void
+notmuch_threads_move_to_last (notmuch_threads_t *threads);
+
+/* Move the 'threads' iterator to the previous thread.
+ *
+ * If 'threads' is already pointing at the first thread then the
+ * iterator will be moved to a point just beyond that first thread,
+ * (where notmuch_threads_valid will return FALSE and
+ * notmuch_threads_get will return NULL).
+ */
+void
+notmuch_threads_move_to_previous (notmuch_threads_t *threads);
+
 /* Destroy a notmuch_threads_t object.
  *
  * It's not strictly necessary to call this function. All memory from
diff --git a/lib/query.cc b/lib/query.cc
index 514a156..727f449 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -35,16 +35,29 @@ typedef struct _notmuch_mset_messages {
 notmuch_messages_t base;
 notmuch_database_t *notmuch;
 Xapian::MSetIterator iterator;
+Xapian::MSetIterator iterator_begin;
 Xapian::MSetIterator iterator_end;
 } notmuch_mset_messages_t;
 
+typedef struct _notmuch_thread_node {
+const char *thread_id;
+struct _notmuch_thread_node *next;
+struct _notmuch_thread_node *prev;
+} notmuch_thread_node_t;
+
+typedef struct _notmuch_thread_list {
+notmuch_thread_node_t *head;
+notmuch_thread_node_t *tail;
+notmuch_thread_node_t *iterator;
+} notmuch_thread_list_t;
+
 struct _notmuch_threads {
 notmuch_query_t *query;
 GHashTable *threads;
 notmuch_messages_t *messages;
 
-/* This thread ID is our iterator state. */
-const char *thread_id;
+/* thread list with the thread_id of the showed messages */
+notmuch_thread_list_t *list;
 };
 
 notmuch_query_t *
@@ -86,6 +99,7 @@ static int
 _notmuch_messages_destructor (notmuch_mset_messages_t *messages)
 {
 messages-iterator.~MSetIterator ();
+messages-iterator_begin.~MSetIterator ();
 messages-iterator_end.~MSetIterator ();
 
 return 0;
@@ -108,6 +122,7 @@ notmuch_query_search_messages (notmuch_query_t *query)
messages-base.iterator = NULL;
messages-notmuch = notmuch;
new (messages-iterator) Xapian::MSetIterator ();
+   new (messages-iterator_begin) Xapian::MSetIterator ();
new (messages-iterator_end) Xapian::MSetIterator ();
 
talloc_set_destructor (messages, _notmuch_messages_destructor);
@@ -157,6 +172,7 @@ notmuch_query_search_messages (notmuch_query_t *query)
mset = enquire.get_mset (0, notmuch-xapian_db-get_doccount ());
 
messages-iterator = mset.begin ();
+   messages-iterator_begin = mset.begin ();
messages-iterator_end = mset.end ();
 
 } catch (const Xapian::Error error) {
@@ -208,6 +224,16 @@ _notmuch_mset_messages_get (notmuch_messages_t *messages)
 }
 
 void
+_notmuch_mset_messages_move_to_first (notmuch_messages_t *messages)
+{
+notmuch_mset_messages_t *mset_messages;
+
+mset_messages = (notmuch_mset_messages_t *) messages;
+
+mset_messages-iterator = mset_messages-iterator_begin;
+}
+
+void
 _notmuch_mset_messages_move_to_next (notmuch_messages_t *messages)
 {
 notmuch_mset_messages_t *mset_messages;
@@ -217,6 +243,113 @@ _notmuch_mset_messages_move_to_next (notmuch_messages_t 

[notmuch] [PATCH 5/5] Added backwards iterator to tags

2010-03-20 Thread Ruben Pollan
Added the functions notmuch_tags_move_to_prevoius,
notmuch_tags_move_to_last and  notmuch_tags_move_to_first to notmuch
library. With them is possible to iterate backwards on tags.

* notmuch_tags_move_to_prevoius do the opposite than
  notmuch_tags_move_to_next, getting the tags iterator one
  position backwards.

* notmuch_tags_move_to_last move the iterator to the first last tag.

* notmuch_tags_move_to_first move the iterator to the first valid tag.
---
 lib/notmuch.h |   28 
 lib/tags.c|   21 +
 2 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index b96b624..dc668dc 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -1022,6 +1022,15 @@ notmuch_tags_valid (notmuch_tags_t *tags);
 const char *
 notmuch_tags_get (notmuch_tags_t *tags);

+/* Move the 'tags' iterator to the first tag.
+ *
+ * After that the 'tags' iterator will be set to the first valid 
+ * tag, so it can be use to iterate with 
+ * notmuch_tags_move_to_next.
+ */
+void
+notmuch_tags_move_to_first (notmuch_tags_t *tags);
+
 /* Move the 'tags' iterator to the next tag.
  *
  * If 'tags' is already pointing at the last tag then the iterator
@@ -1035,6 +1044,25 @@ notmuch_tags_get (notmuch_tags_t *tags);
 void
 notmuch_tags_move_to_next (notmuch_tags_t *tags);

+/* Move the 'tags' iterator to the last tag.
+ *
+ * After that the 'tags' iterator will be set to the last valid 
+ * tag, so it can be use to iterate with 
+ * notmuch_tags_move_to_previous.
+ */
+void
+notmuch_tags_move_to_last (notmuch_tags_t *tags);
+
+/* Move the 'tags' iterator to the previous tag.
+ *
+ * If 'tags' is already pointing at the first tag then the
+ * iterator will be moved to a point just beyond that first tag,
+ * (where notmuch_tags_valid will return FALSE and
+ * notmuch_tags_get will return NULL).
+ */
+void
+notmuch_tags_move_to_previous (notmuch_tags_t *tags);
+
 /* Destroy a notmuch_tags_t object.
  *
  * It's not strictly necessary to call this function. All memory from
diff --git a/lib/tags.c b/lib/tags.c
index 8fe4a3f..9c9a897 100644
--- a/lib/tags.c
+++ b/lib/tags.c
@@ -105,6 +105,12 @@ notmuch_tags_get (notmuch_tags_t *tags)
 }

 void
+notmuch_tags_move_to_first (notmuch_tags_t *tags)
+{
+tags->iterator = g_list_first (tags->tags);
+}
+
+void
 notmuch_tags_move_to_next (notmuch_tags_t *tags)
 {
 if (tags->iterator == NULL)
@@ -114,6 +120,21 @@ notmuch_tags_move_to_next (notmuch_tags_t *tags)
 }

 void
+notmuch_tags_move_to_last (notmuch_tags_t *tags)
+{
+tags->iterator = g_list_last (tags->tags);
+}
+
+void
+notmuch_tags_move_to_previous (notmuch_tags_t *tags)
+{
+if (tags->iterator == NULL)
+   return;
+
+tags->iterator = tags->iterator->prev;
+}
+
+void
 notmuch_tags_destroy (notmuch_tags_t *tags)
 {
 talloc_free (tags);
-- 
1.7.0



[notmuch] [PATCH 4/5] Added backwards iterator to threads

2010-03-20 Thread Ruben Pollan
Added the functions notmuch_threads_move_to_prevoius,
notmuch_threads_move_to_last and  notmuch_threads_move_to_first to
notmuch library. With them is possible to iterate backwards on threads.

* notmuch_threads_move_to_prevoius do the opposite than
  notmuch_threads_move_to_next, getting the threads iterator one
  position backwards.

* notmuch_threads_move_to_last move the iterator to the first last thread.

* notmuch_threads_move_to_first move the iterator to the first valid
  thread.

For it has been implemented notmuch_thread_list_t structur that stores
the thread_ids so the backwards iteration gets the thread_id in the same
order that was show on forward iteration.
---
 lib/notmuch.h |   28 +++
 lib/query.cc  |  143 -
 2 files changed, 159 insertions(+), 12 deletions(-)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index 753f3bb..b96b624 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -466,6 +466,15 @@ notmuch_threads_valid (notmuch_threads_t *threads);
 notmuch_thread_t *
 notmuch_threads_get (notmuch_threads_t *threads);

+/* Move the 'threads' iterator to the first thread.
+ *
+ * After that the 'threads' iterator will be set to the first valid 
+ * thread, so it can be use to iterate with 
+ * notmuch_threads_move_to_next.
+ */
+void
+notmuch_threads_move_to_first (notmuch_threads_t *threads);
+
 /* Move the 'threads' iterator to the next thread.
  *
  * If 'threads' is already pointing at the last thread then the
@@ -479,6 +488,25 @@ notmuch_threads_get (notmuch_threads_t *threads);
 void
 notmuch_threads_move_to_next (notmuch_threads_t *threads);

+/* Move the 'threads' iterator to the last thread.
+ *
+ * After that the 'threads' iterator will be set to the last valid 
+ * thread, so it can be use to iterate with 
+ * notmuch_threads_move_to_previous.
+ */
+void
+notmuch_threads_move_to_last (notmuch_threads_t *threads);
+
+/* Move the 'threads' iterator to the previous thread.
+ *
+ * If 'threads' is already pointing at the first thread then the
+ * iterator will be moved to a point just beyond that first thread,
+ * (where notmuch_threads_valid will return FALSE and
+ * notmuch_threads_get will return NULL).
+ */
+void
+notmuch_threads_move_to_previous (notmuch_threads_t *threads);
+
 /* Destroy a notmuch_threads_t object.
  *
  * It's not strictly necessary to call this function. All memory from
diff --git a/lib/query.cc b/lib/query.cc
index 44950c1..39985e7 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -39,13 +39,25 @@ typedef struct _notmuch_mset_messages {
 Xapian::MSetIterator iterator_end;
 } notmuch_mset_messages_t;

+typedef struct _notmuch_thread_node {
+const char *thread_id;
+struct _notmuch_thread_node *next;
+struct _notmuch_thread_node *prev;
+} notmuch_thread_node_t;
+
+typedef struct _notmuch_thread_list {
+notmuch_thread_node_t *head;
+notmuch_thread_node_t *tail;
+notmuch_thread_node_t *iterator;
+} notmuch_thread_list_t;
+
 struct _notmuch_threads {
 notmuch_query_t *query;
 GHashTable *threads;
 notmuch_messages_t *messages;

-/* This thread ID is our iterator state. */
-const char *thread_id;
+/* thread list with the thread_id of the showed messages */
+notmuch_thread_list_t *list;
 };

 notmuch_query_t *
@@ -269,6 +281,64 @@ _notmuch_mset_messages_move_to_previous 
(notmuch_messages_t *messages)
 }
 }

+static void
+_notmuch_thread_list_create (notmuch_thread_list_t *list, const char 
*thread_id)
+{
+list->head = talloc (list, notmuch_thread_node_t);
+list->tail = list->head;
+list->iterator = list->head;
+list->iterator->thread_id = thread_id;
+list->iterator->next = NULL;
+list->iterator->prev = NULL;
+}
+
+static void
+_notmuch_thread_list_append (notmuch_thread_list_t *list, const char 
*thread_id)
+{
+list->tail->next = talloc (list, notmuch_thread_node_t);
+list->iterator = list->tail->next;
+list->iterator->thread_id = thread_id;
+list->iterator->next = NULL;
+list->iterator->prev = list->tail;
+list->tail = list->iterator;
+}
+
+static const char *
+_notmuch_thread_list_get_id (notmuch_thread_list_t *list)
+{
+return list->iterator->thread_id;
+}
+
+static notmuch_bool_t
+_notmuch_thread_list_valid (notmuch_thread_list_t *list)
+{
+return (list->iterator != NULL);
+}
+
+static void
+_notmuch_thread_list_move_to_first (notmuch_thread_list_t *list)
+{
+list->iterator = list->head;
+}
+
+static void
+_notmuch_thread_list_move_to_next (notmuch_thread_list_t *list)
+{
+list->iterator = list->iterator->next;
+}
+
+static void
+_notmuch_thread_list_move_to_last (notmuch_thread_list_t *list)
+{
+list->iterator = list->tail;
+}
+
+static void
+_notmuch_thread_list_move_to_previous (notmuch_thread_list_t *list)
+{
+list->iterator = list->iterator->prev;
+}
+
 /* Glib objects force use to use a talloc destructor as well, (but not
  * nearly as ugly as the for messages due to 

[notmuch] [PATCH 3/5] Move the logic of threads iterator out of 'valid'

2010-03-20 Thread Ruben Pollan
The logic of notmuch_threads_move_to_next iterator was on
notmuch_threads_valid function. Now notmuch_threads_valid just check if
the iterator is valid and is notmuch_threads_move_to_next wich actually
update the iterator.
---
 lib/query.cc |   47 ---
 1 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/lib/query.cc b/lib/query.cc
index 970c35a..44950c1 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -285,6 +285,7 @@ notmuch_threads_t *
 notmuch_query_search_threads (notmuch_query_t *query)
 {
 notmuch_threads_t *threads;
+notmuch_message_t *message;

 threads = talloc (query, notmuch_threads_t);
 if (threads == NULL)
@@ -296,7 +297,10 @@ notmuch_query_search_threads (notmuch_query_t *query)

 threads->messages = notmuch_query_search_messages (query);

-threads->thread_id = NULL;
+message = notmuch_messages_get (threads->messages);
+threads->thread_id = notmuch_message_get_thread_id (message);
+g_hash_table_insert (threads->threads,
+ xstrdup (threads->thread_id), NULL);

 talloc_set_destructor (threads, _notmuch_threads_destructor);

@@ -312,10 +316,25 @@ notmuch_query_destroy (notmuch_query_t *query)
 notmuch_bool_t
 notmuch_threads_valid (notmuch_threads_t *threads)
 {
-notmuch_message_t *message;
+return (threads->thread_id != NULL);
+}

-if (threads->thread_id)
-   return TRUE;
+notmuch_thread_t *
+notmuch_threads_get (notmuch_threads_t *threads)
+{
+if (! notmuch_threads_valid (threads))
+   return NULL;
+
+return _notmuch_thread_create (threads->query,
+  threads->query->notmuch,
+  threads->thread_id,
+  threads->query->query_string);
+}
+
+void
+notmuch_threads_move_to_next (notmuch_threads_t *threads)
+{
+notmuch_message_t *message;

 while (notmuch_messages_valid (threads->messages))
 {
@@ -330,33 +349,15 @@ notmuch_threads_valid (notmuch_threads_t *threads)
g_hash_table_insert (threads->threads,
 xstrdup (threads->thread_id), NULL);
notmuch_messages_move_to_next (threads->messages);
-   return TRUE;
+   return;
}

notmuch_messages_move_to_next (threads->messages);
 }

 threads->thread_id = NULL;
-return FALSE;
-}
-
-notmuch_thread_t *
-notmuch_threads_get (notmuch_threads_t *threads)
-{
-if (! notmuch_threads_valid (threads))
-   return NULL;
-
-return _notmuch_thread_create (threads->query,
-  threads->query->notmuch,
-  threads->thread_id,
-  threads->query->query_string);
 }

-void
-notmuch_threads_move_to_next (notmuch_threads_t *threads)
-{
-threads->thread_id = NULL;
-}

 void
 notmuch_threads_destroy (notmuch_threads_t *threads)
-- 
1.7.0



[notmuch] [PATCH 2/5] Added backwards iterator to messages

2010-03-20 Thread Ruben Pollan
Added the functions notmuch_messages_move_to_prevoius,
notmuch_messages_move_to_last and  notmuch_messages_move_to_first to
notmuch library. With them is possible to iterate backwards on messages.

* notmuch_messages_move_to_prevoius do the opposite than
  notmuch_messages_move_to_next, getting the messages iterator one
  position backwards.

* notmuch_messages_move_to_last move the iterator to the first last
  message.

* notmuch_messages_move_to_first move the iterator to the first valid
  message.
---
 lib/messages.c|   31 +
 lib/notmuch-private.h |   10 +
 lib/notmuch.h |   28 ++
 lib/query.cc  |   52 +
 4 files changed, 121 insertions(+), 0 deletions(-)

diff --git a/lib/messages.c b/lib/messages.c
index 2a85774..975e4b1 100644
--- a/lib/messages.c
+++ b/lib/messages.c
@@ -90,6 +90,7 @@ _notmuch_messages_create (notmuch_message_list_t *list)

 messages->is_of_list_type = TRUE;
 messages->iterator = list->head;
+messages->list = list;

 return messages;
 }
@@ -134,6 +135,15 @@ notmuch_messages_get (notmuch_messages_t *messages)
 }

 void
+notmuch_messages_move_to_first (notmuch_messages_t *messages)
+{
+if (! messages->is_of_list_type)
+   return _notmuch_mset_messages_move_to_first (messages);
+
+messages->iterator = messages->list->head;
+}
+
+void
 notmuch_messages_move_to_next (notmuch_messages_t *messages)
 {
 if (! messages->is_of_list_type)
@@ -146,6 +156,27 @@ notmuch_messages_move_to_next (notmuch_messages_t 
*messages)
 }

 void
+notmuch_messages_move_to_last (notmuch_messages_t *messages)
+{
+if (! messages->is_of_list_type)
+   return _notmuch_mset_messages_move_to_last (messages);
+
+messages->iterator = messages->list->tail;
+}
+
+void
+notmuch_messages_move_to_previous (notmuch_messages_t *messages)
+{
+if (! messages->is_of_list_type)
+   return _notmuch_mset_messages_move_to_previous (messages);
+
+if (messages->iterator == NULL)
+   return;
+
+messages->iterator = messages->iterator->prev;
+}
+
+void
 notmuch_messages_destroy (notmuch_messages_t *messages)
 {
 talloc_free (messages);
diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index 3b3f0eb..2269d2b 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -364,6 +364,7 @@ typedef struct _notmuch_message_list {
 struct _notmuch_messages {
 notmuch_bool_t is_of_list_type;
 notmuch_message_node_t *iterator;
+notmuch_message_list_t *list;
 };

 notmuch_message_list_t *
@@ -389,8 +390,17 @@ notmuch_message_t *
 _notmuch_mset_messages_get (notmuch_messages_t *messages);

 void
+_notmuch_mset_messages_move_to_first (notmuch_messages_t *messages);
+
+void
 _notmuch_mset_messages_move_to_next (notmuch_messages_t *messages);

+void
+_notmuch_mset_messages_move_to_last (notmuch_messages_t *messages);
+
+void
+_notmuch_mset_messages_move_to_previous (notmuch_messages_t *messages);
+
 /* message.cc */

 void
diff --git a/lib/notmuch.h b/lib/notmuch.h
index 0d9cb0f..753f3bb 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -645,6 +645,15 @@ notmuch_messages_valid (notmuch_messages_t *messages);
 notmuch_message_t *
 notmuch_messages_get (notmuch_messages_t *messages);

+/* Move the 'messages' iterator to the first message.
+ *
+ * After that the 'messages' iterator will be set to the first valid 
+ * message, so it can be use to iterate with 
+ * notmuch_messages_move_to_next.
+ */
+void
+notmuch_messages_move_to_first (notmuch_messages_t *messages);
+
 /* Move the 'messages' iterator to the next message.
  *
  * If 'messages' is already pointing at the last message then the
@@ -658,6 +667,25 @@ notmuch_messages_get (notmuch_messages_t *messages);
 void
 notmuch_messages_move_to_next (notmuch_messages_t *messages);

+/* Move the 'messages' iterator to the last message.
+ *
+ * After that the 'messages' iterator will be set to the last valid 
+ * message, so it can be use to iterate with 
+ * notmuch_messages_move_to_previous.
+ */
+void
+notmuch_messages_move_to_last (notmuch_messages_t *messages);
+
+/* Move the 'messages' iterator to the previous message.
+ *
+ * If 'messages' is already pointing at the first message then the
+ * iterator will be moved to a point just beyond that first message,
+ * (where notmuch_messages_valid will return FALSE and
+ * notmuch_messages_get will return NULL).
+ */
+void
+notmuch_messages_move_to_previous (notmuch_messages_t *messages);
+
 /* Destroy a notmuch_messages_t object.
  *
  * It's not strictly necessary to call this function. All memory from
diff --git a/lib/query.cc b/lib/query.cc
index 9266d35..970c35a 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -35,6 +35,7 @@ typedef struct _notmuch_mset_messages {
 notmuch_messages_t base;
 notmuch_database_t *notmuch;
 Xapian::MSetIterator iterator;
+Xapian::MSetIterator iterator_begin;
 Xapian::MSetIterator 

[notmuch] [PATCH 1/5] Convert notmuch_message_list_t in a doubly linked

2010-03-20 Thread Ruben Pollan
The messages list now have pointers to previous nodes, so it is possible
to iterate backwards.
---
 lib/messages.c|   18 +-
 lib/notmuch-private.h |3 ++-
 lib/thread.cc |4 ++--
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/lib/messages.c b/lib/messages.c
index db2b7a1..2a85774 100644
--- a/lib/messages.c
+++ b/lib/messages.c
@@ -37,20 +37,28 @@ _notmuch_message_list_create (const void *ctx)
return NULL;

 list->head = NULL;
-list->tail = >head;
+list->tail = NULL;

 return list;
 }

-/* Append 'node' (which can of course point to an arbitrarily long
- * list of nodes) to the end of 'list'.
+/* Append 'node' to the end of 'list'.
  */
 void
 _notmuch_message_list_append (notmuch_message_list_t *list,
  notmuch_message_node_t *node)
 {
-*(list->tail) = node;
-list->tail = >next;
+node->prev = list->tail;
+if (list->head)
+{
+list->tail->next = node;
+}
+else
+{
+list->head = node;
+list->tail = node;
+}
+list->tail = node;
 }

 /* Allocate a new node for 'message' and append it to the end of
diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index d52d84d..3b3f0eb 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -349,11 +349,12 @@ notmuch_message_file_get_header (notmuch_message_file_t 
*message,
 typedef struct _notmuch_message_node {
 notmuch_message_t *message;
 struct _notmuch_message_node *next;
+struct _notmuch_message_node *prev;
 } notmuch_message_node_t;

 typedef struct _notmuch_message_list {
 notmuch_message_node_t *head;
-notmuch_message_node_t **tail;
+notmuch_message_node_t *tail;
 } notmuch_message_list_t;

 /* There's a rumor that there's an alternate struct _notmuch_messages
diff --git a/lib/thread.cc b/lib/thread.cc
index ec80f85..05d2c39 100644
--- a/lib/thread.cc
+++ b/lib/thread.cc
@@ -169,8 +169,8 @@ _resolve_thread_relationships (unused (notmuch_thread_t 
*thread))
  (void **) ))
{
*prev = node->next;
-   if (thread->message_list->tail == >next)
-   thread->message_list->tail = prev;
+   if (thread->message_list->tail == node)
+   thread->message_list->tail = node->prev;
node->next = NULL;
_notmuch_message_add_reply (parent, node);
} else {
-- 
1.7.0



[notmuch] reverse iterators

2010-03-20 Thread Ruben Pollan

Adds support to reverse iteration on messages, threads and tags. To revew and
think if makes sense to include them on notmuch or wait until they have a real
use.

The patch 3 "Move the logic of threads iterator out of 'valid'" is just a 
reorganization of the code, I think it makes sense to include it in notmuch even
if we decide that the reverse iterators are not included.


[notmuch] reverse iterators

2010-03-20 Thread Ruben Pollan

Adds support to reverse iteration on messages, threads and tags. To revew and
think if makes sense to include them on notmuch or wait until they have a real
use.

The patch 3 Move the logic of threads iterator out of 'valid' is just a 
reorganization of the code, I think it makes sense to include it in notmuch even
if we decide that the reverse iterators are not included.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] [PATCH 1/5] Convert notmuch_message_list_t in a doubly linked

2010-03-20 Thread Ruben Pollan
The messages list now have pointers to previous nodes, so it is possible
to iterate backwards.
---
 lib/messages.c|   18 +-
 lib/notmuch-private.h |3 ++-
 lib/thread.cc |4 ++--
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/lib/messages.c b/lib/messages.c
index db2b7a1..2a85774 100644
--- a/lib/messages.c
+++ b/lib/messages.c
@@ -37,20 +37,28 @@ _notmuch_message_list_create (const void *ctx)
return NULL;
 
 list-head = NULL;
-list-tail = list-head;
+list-tail = NULL;
 
 return list;
 }
 
-/* Append 'node' (which can of course point to an arbitrarily long
- * list of nodes) to the end of 'list'.
+/* Append 'node' to the end of 'list'.
  */
 void
 _notmuch_message_list_append (notmuch_message_list_t *list,
  notmuch_message_node_t *node)
 {
-*(list-tail) = node;
-list-tail = node-next;
+node-prev = list-tail;
+if (list-head)
+{
+list-tail-next = node;
+}
+else
+{
+list-head = node;
+list-tail = node;
+}
+list-tail = node;
 }
 
 /* Allocate a new node for 'message' and append it to the end of
diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index d52d84d..3b3f0eb 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -349,11 +349,12 @@ notmuch_message_file_get_header (notmuch_message_file_t 
*message,
 typedef struct _notmuch_message_node {
 notmuch_message_t *message;
 struct _notmuch_message_node *next;
+struct _notmuch_message_node *prev;
 } notmuch_message_node_t;
 
 typedef struct _notmuch_message_list {
 notmuch_message_node_t *head;
-notmuch_message_node_t **tail;
+notmuch_message_node_t *tail;
 } notmuch_message_list_t;
 
 /* There's a rumor that there's an alternate struct _notmuch_messages
diff --git a/lib/thread.cc b/lib/thread.cc
index ec80f85..05d2c39 100644
--- a/lib/thread.cc
+++ b/lib/thread.cc
@@ -169,8 +169,8 @@ _resolve_thread_relationships (unused (notmuch_thread_t 
*thread))
  (void **) parent))
{
*prev = node-next;
-   if (thread-message_list-tail == node-next)
-   thread-message_list-tail = prev;
+   if (thread-message_list-tail == node)
+   thread-message_list-tail = node-prev;
node-next = NULL;
_notmuch_message_add_reply (parent, node);
} else {
-- 
1.7.0

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] [PATCH 2/5] Added backwards iterator to messages

2010-03-20 Thread Ruben Pollan
Added the functions notmuch_messages_move_to_prevoius,
notmuch_messages_move_to_last and  notmuch_messages_move_to_first to
notmuch library. With them is possible to iterate backwards on messages.

* notmuch_messages_move_to_prevoius do the opposite than
  notmuch_messages_move_to_next, getting the messages iterator one
  position backwards.

* notmuch_messages_move_to_last move the iterator to the first last
  message.

* notmuch_messages_move_to_first move the iterator to the first valid
  message.
---
 lib/messages.c|   31 +
 lib/notmuch-private.h |   10 +
 lib/notmuch.h |   28 ++
 lib/query.cc  |   52 +
 4 files changed, 121 insertions(+), 0 deletions(-)

diff --git a/lib/messages.c b/lib/messages.c
index 2a85774..975e4b1 100644
--- a/lib/messages.c
+++ b/lib/messages.c
@@ -90,6 +90,7 @@ _notmuch_messages_create (notmuch_message_list_t *list)
 
 messages-is_of_list_type = TRUE;
 messages-iterator = list-head;
+messages-list = list;
 
 return messages;
 }
@@ -134,6 +135,15 @@ notmuch_messages_get (notmuch_messages_t *messages)
 }
 
 void
+notmuch_messages_move_to_first (notmuch_messages_t *messages)
+{
+if (! messages-is_of_list_type)
+   return _notmuch_mset_messages_move_to_first (messages);
+
+messages-iterator = messages-list-head;
+}
+
+void
 notmuch_messages_move_to_next (notmuch_messages_t *messages)
 {
 if (! messages-is_of_list_type)
@@ -146,6 +156,27 @@ notmuch_messages_move_to_next (notmuch_messages_t 
*messages)
 }
 
 void
+notmuch_messages_move_to_last (notmuch_messages_t *messages)
+{
+if (! messages-is_of_list_type)
+   return _notmuch_mset_messages_move_to_last (messages);
+
+messages-iterator = messages-list-tail;
+}
+
+void
+notmuch_messages_move_to_previous (notmuch_messages_t *messages)
+{
+if (! messages-is_of_list_type)
+   return _notmuch_mset_messages_move_to_previous (messages);
+
+if (messages-iterator == NULL)
+   return;
+
+messages-iterator = messages-iterator-prev;
+}
+
+void
 notmuch_messages_destroy (notmuch_messages_t *messages)
 {
 talloc_free (messages);
diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index 3b3f0eb..2269d2b 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -364,6 +364,7 @@ typedef struct _notmuch_message_list {
 struct _notmuch_messages {
 notmuch_bool_t is_of_list_type;
 notmuch_message_node_t *iterator;
+notmuch_message_list_t *list;
 };
 
 notmuch_message_list_t *
@@ -389,8 +390,17 @@ notmuch_message_t *
 _notmuch_mset_messages_get (notmuch_messages_t *messages);
 
 void
+_notmuch_mset_messages_move_to_first (notmuch_messages_t *messages);
+
+void
 _notmuch_mset_messages_move_to_next (notmuch_messages_t *messages);
 
+void
+_notmuch_mset_messages_move_to_last (notmuch_messages_t *messages);
+
+void
+_notmuch_mset_messages_move_to_previous (notmuch_messages_t *messages);
+
 /* message.cc */
 
 void
diff --git a/lib/notmuch.h b/lib/notmuch.h
index 0d9cb0f..753f3bb 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -645,6 +645,15 @@ notmuch_messages_valid (notmuch_messages_t *messages);
 notmuch_message_t *
 notmuch_messages_get (notmuch_messages_t *messages);
 
+/* Move the 'messages' iterator to the first message.
+ *
+ * After that the 'messages' iterator will be set to the first valid 
+ * message, so it can be use to iterate with 
+ * notmuch_messages_move_to_next.
+ */
+void
+notmuch_messages_move_to_first (notmuch_messages_t *messages);
+
 /* Move the 'messages' iterator to the next message.
  *
  * If 'messages' is already pointing at the last message then the
@@ -658,6 +667,25 @@ notmuch_messages_get (notmuch_messages_t *messages);
 void
 notmuch_messages_move_to_next (notmuch_messages_t *messages);
 
+/* Move the 'messages' iterator to the last message.
+ *
+ * After that the 'messages' iterator will be set to the last valid 
+ * message, so it can be use to iterate with 
+ * notmuch_messages_move_to_previous.
+ */
+void
+notmuch_messages_move_to_last (notmuch_messages_t *messages);
+
+/* Move the 'messages' iterator to the previous message.
+ *
+ * If 'messages' is already pointing at the first message then the
+ * iterator will be moved to a point just beyond that first message,
+ * (where notmuch_messages_valid will return FALSE and
+ * notmuch_messages_get will return NULL).
+ */
+void
+notmuch_messages_move_to_previous (notmuch_messages_t *messages);
+
 /* Destroy a notmuch_messages_t object.
  *
  * It's not strictly necessary to call this function. All memory from
diff --git a/lib/query.cc b/lib/query.cc
index 9266d35..970c35a 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -35,6 +35,7 @@ typedef struct _notmuch_mset_messages {
 notmuch_messages_t base;
 notmuch_database_t *notmuch;
 Xapian::MSetIterator iterator;
+Xapian::MSetIterator iterator_begin;
 Xapian::MSetIterator 

[notmuch] [PATCH 4/5] Added backwards iterator to threads

2010-03-20 Thread Ruben Pollan
Added the functions notmuch_threads_move_to_prevoius,
notmuch_threads_move_to_last and  notmuch_threads_move_to_first to
notmuch library. With them is possible to iterate backwards on threads.

* notmuch_threads_move_to_prevoius do the opposite than
  notmuch_threads_move_to_next, getting the threads iterator one
  position backwards.

* notmuch_threads_move_to_last move the iterator to the first last thread.

* notmuch_threads_move_to_first move the iterator to the first valid
  thread.

For it has been implemented notmuch_thread_list_t structur that stores
the thread_ids so the backwards iteration gets the thread_id in the same
order that was show on forward iteration.
---
 lib/notmuch.h |   28 +++
 lib/query.cc  |  143 -
 2 files changed, 159 insertions(+), 12 deletions(-)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index 753f3bb..b96b624 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -466,6 +466,15 @@ notmuch_threads_valid (notmuch_threads_t *threads);
 notmuch_thread_t *
 notmuch_threads_get (notmuch_threads_t *threads);
 
+/* Move the 'threads' iterator to the first thread.
+ *
+ * After that the 'threads' iterator will be set to the first valid 
+ * thread, so it can be use to iterate with 
+ * notmuch_threads_move_to_next.
+ */
+void
+notmuch_threads_move_to_first (notmuch_threads_t *threads);
+
 /* Move the 'threads' iterator to the next thread.
  *
  * If 'threads' is already pointing at the last thread then the
@@ -479,6 +488,25 @@ notmuch_threads_get (notmuch_threads_t *threads);
 void
 notmuch_threads_move_to_next (notmuch_threads_t *threads);
 
+/* Move the 'threads' iterator to the last thread.
+ *
+ * After that the 'threads' iterator will be set to the last valid 
+ * thread, so it can be use to iterate with 
+ * notmuch_threads_move_to_previous.
+ */
+void
+notmuch_threads_move_to_last (notmuch_threads_t *threads);
+
+/* Move the 'threads' iterator to the previous thread.
+ *
+ * If 'threads' is already pointing at the first thread then the
+ * iterator will be moved to a point just beyond that first thread,
+ * (where notmuch_threads_valid will return FALSE and
+ * notmuch_threads_get will return NULL).
+ */
+void
+notmuch_threads_move_to_previous (notmuch_threads_t *threads);
+
 /* Destroy a notmuch_threads_t object.
  *
  * It's not strictly necessary to call this function. All memory from
diff --git a/lib/query.cc b/lib/query.cc
index 44950c1..39985e7 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -39,13 +39,25 @@ typedef struct _notmuch_mset_messages {
 Xapian::MSetIterator iterator_end;
 } notmuch_mset_messages_t;
 
+typedef struct _notmuch_thread_node {
+const char *thread_id;
+struct _notmuch_thread_node *next;
+struct _notmuch_thread_node *prev;
+} notmuch_thread_node_t;
+
+typedef struct _notmuch_thread_list {
+notmuch_thread_node_t *head;
+notmuch_thread_node_t *tail;
+notmuch_thread_node_t *iterator;
+} notmuch_thread_list_t;
+
 struct _notmuch_threads {
 notmuch_query_t *query;
 GHashTable *threads;
 notmuch_messages_t *messages;
 
-/* This thread ID is our iterator state. */
-const char *thread_id;
+/* thread list with the thread_id of the showed messages */
+notmuch_thread_list_t *list;
 };
 
 notmuch_query_t *
@@ -269,6 +281,64 @@ _notmuch_mset_messages_move_to_previous 
(notmuch_messages_t *messages)
 }
 }
 
+static void
+_notmuch_thread_list_create (notmuch_thread_list_t *list, const char 
*thread_id)
+{
+list-head = talloc (list, notmuch_thread_node_t);
+list-tail = list-head;
+list-iterator = list-head;
+list-iterator-thread_id = thread_id;
+list-iterator-next = NULL;
+list-iterator-prev = NULL;
+}
+
+static void
+_notmuch_thread_list_append (notmuch_thread_list_t *list, const char 
*thread_id)
+{
+list-tail-next = talloc (list, notmuch_thread_node_t);
+list-iterator = list-tail-next;
+list-iterator-thread_id = thread_id;
+list-iterator-next = NULL;
+list-iterator-prev = list-tail;
+list-tail = list-iterator;
+}
+
+static const char *
+_notmuch_thread_list_get_id (notmuch_thread_list_t *list)
+{
+return list-iterator-thread_id;
+}
+
+static notmuch_bool_t
+_notmuch_thread_list_valid (notmuch_thread_list_t *list)
+{
+return (list-iterator != NULL);
+}
+
+static void
+_notmuch_thread_list_move_to_first (notmuch_thread_list_t *list)
+{
+list-iterator = list-head;
+}
+
+static void
+_notmuch_thread_list_move_to_next (notmuch_thread_list_t *list)
+{
+list-iterator = list-iterator-next;
+}
+
+static void
+_notmuch_thread_list_move_to_last (notmuch_thread_list_t *list)
+{
+list-iterator = list-tail;
+}
+
+static void
+_notmuch_thread_list_move_to_previous (notmuch_thread_list_t *list)
+{
+list-iterator = list-iterator-prev;
+}
+
 /* Glib objects force use to use a talloc destructor as well, (but not
  * nearly as ugly as the for messages due to C++ objects). At
  * this point, 

[notmuch] [PATCH 3/5] Move the logic of threads iterator out of 'valid'

2010-03-20 Thread Ruben Pollan
The logic of notmuch_threads_move_to_next iterator was on
notmuch_threads_valid function. Now notmuch_threads_valid just check if
the iterator is valid and is notmuch_threads_move_to_next wich actually
update the iterator.
---
 lib/query.cc |   47 ---
 1 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/lib/query.cc b/lib/query.cc
index 970c35a..44950c1 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -285,6 +285,7 @@ notmuch_threads_t *
 notmuch_query_search_threads (notmuch_query_t *query)
 {
 notmuch_threads_t *threads;
+notmuch_message_t *message;
 
 threads = talloc (query, notmuch_threads_t);
 if (threads == NULL)
@@ -296,7 +297,10 @@ notmuch_query_search_threads (notmuch_query_t *query)
 
 threads-messages = notmuch_query_search_messages (query);
 
-threads-thread_id = NULL;
+message = notmuch_messages_get (threads-messages);
+threads-thread_id = notmuch_message_get_thread_id (message);
+g_hash_table_insert (threads-threads,
+ xstrdup (threads-thread_id), NULL);
 
 talloc_set_destructor (threads, _notmuch_threads_destructor);
 
@@ -312,10 +316,25 @@ notmuch_query_destroy (notmuch_query_t *query)
 notmuch_bool_t
 notmuch_threads_valid (notmuch_threads_t *threads)
 {
-notmuch_message_t *message;
+return (threads-thread_id != NULL);
+}
 
-if (threads-thread_id)
-   return TRUE;
+notmuch_thread_t *
+notmuch_threads_get (notmuch_threads_t *threads)
+{
+if (! notmuch_threads_valid (threads))
+   return NULL;
+
+return _notmuch_thread_create (threads-query,
+  threads-query-notmuch,
+  threads-thread_id,
+  threads-query-query_string);
+}
+
+void
+notmuch_threads_move_to_next (notmuch_threads_t *threads)
+{
+notmuch_message_t *message;
 
 while (notmuch_messages_valid (threads-messages))
 {
@@ -330,33 +349,15 @@ notmuch_threads_valid (notmuch_threads_t *threads)
g_hash_table_insert (threads-threads,
 xstrdup (threads-thread_id), NULL);
notmuch_messages_move_to_next (threads-messages);
-   return TRUE;
+   return;
}
 
notmuch_messages_move_to_next (threads-messages);
 }
 
 threads-thread_id = NULL;
-return FALSE;
-}
-
-notmuch_thread_t *
-notmuch_threads_get (notmuch_threads_t *threads)
-{
-if (! notmuch_threads_valid (threads))
-   return NULL;
-
-return _notmuch_thread_create (threads-query,
-  threads-query-notmuch,
-  threads-thread_id,
-  threads-query-query_string);
 }
 
-void
-notmuch_threads_move_to_next (notmuch_threads_t *threads)
-{
-threads-thread_id = NULL;
-}
 
 void
 notmuch_threads_destroy (notmuch_threads_t *threads)
-- 
1.7.0

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] [PATCH 5/5] Added backwards iterator to tags

2010-03-20 Thread Ruben Pollan
Added the functions notmuch_tags_move_to_prevoius,
notmuch_tags_move_to_last and  notmuch_tags_move_to_first to notmuch
library. With them is possible to iterate backwards on tags.

* notmuch_tags_move_to_prevoius do the opposite than
  notmuch_tags_move_to_next, getting the tags iterator one
  position backwards.

* notmuch_tags_move_to_last move the iterator to the first last tag.

* notmuch_tags_move_to_first move the iterator to the first valid tag.
---
 lib/notmuch.h |   28 
 lib/tags.c|   21 +
 2 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index b96b624..dc668dc 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -1022,6 +1022,15 @@ notmuch_tags_valid (notmuch_tags_t *tags);
 const char *
 notmuch_tags_get (notmuch_tags_t *tags);
 
+/* Move the 'tags' iterator to the first tag.
+ *
+ * After that the 'tags' iterator will be set to the first valid 
+ * tag, so it can be use to iterate with 
+ * notmuch_tags_move_to_next.
+ */
+void
+notmuch_tags_move_to_first (notmuch_tags_t *tags);
+
 /* Move the 'tags' iterator to the next tag.
  *
  * If 'tags' is already pointing at the last tag then the iterator
@@ -1035,6 +1044,25 @@ notmuch_tags_get (notmuch_tags_t *tags);
 void
 notmuch_tags_move_to_next (notmuch_tags_t *tags);
 
+/* Move the 'tags' iterator to the last tag.
+ *
+ * After that the 'tags' iterator will be set to the last valid 
+ * tag, so it can be use to iterate with 
+ * notmuch_tags_move_to_previous.
+ */
+void
+notmuch_tags_move_to_last (notmuch_tags_t *tags);
+
+/* Move the 'tags' iterator to the previous tag.
+ *
+ * If 'tags' is already pointing at the first tag then the
+ * iterator will be moved to a point just beyond that first tag,
+ * (where notmuch_tags_valid will return FALSE and
+ * notmuch_tags_get will return NULL).
+ */
+void
+notmuch_tags_move_to_previous (notmuch_tags_t *tags);
+
 /* Destroy a notmuch_tags_t object.
  *
  * It's not strictly necessary to call this function. All memory from
diff --git a/lib/tags.c b/lib/tags.c
index 8fe4a3f..9c9a897 100644
--- a/lib/tags.c
+++ b/lib/tags.c
@@ -105,6 +105,12 @@ notmuch_tags_get (notmuch_tags_t *tags)
 }
 
 void
+notmuch_tags_move_to_first (notmuch_tags_t *tags)
+{
+tags-iterator = g_list_first (tags-tags);
+}
+
+void
 notmuch_tags_move_to_next (notmuch_tags_t *tags)
 {
 if (tags-iterator == NULL)
@@ -114,6 +120,21 @@ notmuch_tags_move_to_next (notmuch_tags_t *tags)
 }
 
 void
+notmuch_tags_move_to_last (notmuch_tags_t *tags)
+{
+tags-iterator = g_list_last (tags-tags);
+}
+
+void
+notmuch_tags_move_to_previous (notmuch_tags_t *tags)
+{
+if (tags-iterator == NULL)
+   return;
+
+tags-iterator = tags-iterator-prev;
+}
+
+void
 notmuch_tags_destroy (notmuch_tags_t *tags)
 {
 talloc_free (tags);
-- 
1.7.0

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] [PATCH] Added regress option to tags iterator

2010-03-11 Thread Ruben Pollan
On 09:36, Tue 09 Mar 10, Carl Worth wrote:
> So the final proposal for iteration in either direction is:
> 
>   move_to_first
> valid
> move_to_next
> 
>   move_to_last
> valid
> move_to_previous
> 
> get

Fine for me.

> I've just pushed commits changing the existing functions (which allow
> only forward iteration) to use this naming scheme. I haven't added any
> of the reverse-iteration functions yet, so Ruben, if you'd like to do
> those within this scheme, that would be find. (Or we could wait until we
> have an actual use in mind for them.)

I'll implemented them again and we'll decide if make sense to have them even if
there is no code now using them. I think is a useful feature to create a client
based on notmuch library, but I also think is bad behavior to keep code that is 
not in use.

I'm still thinking in a ncurses client (but I didn't hack on that on a while)
and I guess I'll use this functions on it. But I don't mind to have them just in
my own repository until I have something working.

I'm not having too much hacking time lately, so I don't know when I'll have
some time for it. I hope in few days.


-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 Cuando los que mandan pierden la verg?enza,
los que obedecen pierden el respeto.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 



[notmuch] notmuch for mutt (was: vim client)

2010-02-21 Thread Ruben Pollan
On 07:56, Sun 21 Feb 10, martin f krafft wrote:
> also sprach Ruben Pollan  [2010.02.19.2112 +0100]:
> > > 1. will there be a usable  ncurses or mutt version that supports
> > > notmuch anytime soon?
> > 
> > I started to work on that I while ago. I didn't hack on it for
> > a while, but I hope I'll return to it soon. Anyway to create
> > a proper good client is a lot of work, I don't think I'll be able
> > to make something usable in months (if I ever make it).
> 
> How would mutt support notmuch? Could you elaborate on the way you
> plan to integrate them?

Ups. I see I explained it wrong. I started to create a ncurses client. I
didn't think about mutt.

I'm not sure if notmuch can be well integrated on mutt. They have kind of
different approach. Maybe the best way to integrate it is the notmuch-fuse that
someone propose a while ago in this list.


-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100221/6c908bb3/attachment.pgp>


Re: [notmuch] notmuch for mutt (was: vim client)

2010-02-21 Thread Ruben Pollan
On 07:56, Sun 21 Feb 10, martin f krafft wrote:
 also sprach Ruben Pollan mes...@sindominio.net [2010.02.19.2112 +0100]:
   1. will there be a usable  ncurses or mutt version that supports
   notmuch anytime soon?
  
  I started to work on that I while ago. I didn't hack on it for
  a while, but I hope I'll return to it soon. Anyway to create
  a proper good client is a lot of work, I don't think I'll be able
  to make something usable in months (if I ever make it).
 
 How would mutt support notmuch? Could you elaborate on the way you
 plan to integrate them?

Ups. I see I explained it wrong. I started to create a ncurses client. I
didn't think about mutt.

I'm not sure if notmuch can be well integrated on mutt. They have kind of
different approach. Maybe the best way to integrate it is the notmuch-fuse that
someone propose a while ago in this list.


-- 
Rubén Pollán  | jabber:mes...@jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.


signature.asc
Description: Digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] Quick thoughts on a notmuch daemon

2010-02-20 Thread Ruben Pollan
I started to code something base on your idea of a notmuch daemon. You can find
it on:
git://gitorious.org/notsomuch/notmuch.git
On the server branch.

The idea is to use unix named sockets to intercomunicate between the daemon and 
the
client. And threads on the server to handle every request. The implementation 
is 
no great, it's a fast hack. It can only handle one request per connection and 
breaks 
some times on concurrent request. But I hope helps to see the idea.

I implemented both, daemon and client in the same binary. So you can still run
as before:
$ notmuch search inbox
If the daemon is already running (so the socket is in 
MAILDIR_PATH/.notmuch/socket) 
it will connect to it and ask for the search. If is not running will fork
creating it and send it the search.

Up to now the comunication between daemon and client is with the same syntax of
notmuch. But I think will be a nice idea to use JSON (or some other
computer-friendly syntax) and convert it to human readable on the client.

What do you think about that approach? Will it fit on what you imagined or is it
to far?

I'm not sure if that is adding to much complexity to notmuch or is a good idea.

-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 



[notmuch] vim client

2010-02-19 Thread Ruben Pollan
On 17:49, Fri 19 Feb 10, Arian Kuschki wrote:
> 1. will there be a usable  ncurses or mutt version that supports notmuch 
> anytime soon?

I started to work on that I while ago. I didn't hack on it for a while, but I
hope I'll return to it soon. Anyway to create a proper good client is a lot of
work, I don't think I'll be able to make something usable in months (if I ever
make it).

If someone is willing to work on that I'll love to collaborate and hack
together.

-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
   La felicidad no es hacer lo que deseas
 es desear lo que haces.

-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 



Re: [notmuch] vim client

2010-02-19 Thread Ruben Pollan
On 17:49, Fri 19 Feb 10, Arian Kuschki wrote:
 1. will there be a usable  ncurses or mutt version that supports notmuch 
 anytime soon?

I started to work on that I while ago. I didn't hack on it for a while, but I
hope I'll return to it soon. Anyway to create a proper good client is a lot of
work, I don't think I'll be able to make something usable in months (if I ever
make it).

If someone is willing to work on that I'll love to collaborate and hack
together.

-- 
Rubén Pollán  | jabber:mes...@jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
   La felicidad no es hacer lo que deseas
 es desear lo que haces.



signature.asc
Description: Digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] Quick thoughts on a notmuch daemon

2010-02-19 Thread Ruben Pollan
I started to code something base on your idea of a notmuch daemon. You can find
it on:
git://gitorious.org/notsomuch/notmuch.git
On the server branch.

The idea is to use unix named sockets to intercomunicate between the daemon and 
the
client. And threads on the server to handle every request. The implementation 
is 
no great, it's a fast hack. It can only handle one request per connection and 
breaks 
some times on concurrent request. But I hope helps to see the idea.

I implemented both, daemon and client in the same binary. So you can still run
as before:
$ notmuch search inbox
If the daemon is already running (so the socket is in 
MAILDIR_PATH/.notmuch/socket) 
it will connect to it and ask for the search. If is not running will fork
creating it and send it the search.

Up to now the comunication between daemon and client is with the same syntax of
notmuch. But I think will be a nice idea to use JSON (or some other
computer-friendly syntax) and convert it to human readable on the client.

What do you think about that approach? Will it fit on what you imagined or is it
to far?

I'm not sure if that is adding to much complexity to notmuch or is a good idea.

-- 
Rubén Pollán  | jabber:mes...@jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Nos vamos a Croatan.


signature.asc
Description: Digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] indexing encrypted messages (was: OpenPGP support)

2010-01-10 Thread Ruben Pollan
On 14:41, Fri 08 Jan 10, micah anderson wrote:
> On Fri, 8 Jan 2010 10:21:21 +0100, Ruben Pollan  
> wrote:
> > On 15:56, Fri 08 Jan 10, martin f krafft wrote:
> > > How about indexing GPG-encrypted messages?
> > 
> > I think that would be security hole. You should not store the
> > encrypted messages on a decrypted database. A solution whould be to
> > encrypt as well the xapian DB, but I think is too complex for the use.
> 
> Would you consider it a security hole if you stored your database on
> encrypted media (such as on-disk block encryption)?

No, in this case should be not a security hole. But anyway what is secure and
what not should be defined by the user. For some users may not be a security
hole to store the email decrypted.

But I think notmuch by default should not do so. This kind of things should be
something that the user activate by hand knowing what she is doing.

> I know that sup does this, when it ran over my mail store, it would
> trigger my gpg agent so that it could decrypt the encrypted
> messages. This was annoying because this happened every time it ran,
> which meant that unless I had used gpg recently, my agent would pop up
> and ask me for my passphrase, which was often.

I didn't use sup. Don't know how it works. But that feature is technically
possible. As I said before in my personal opinion that should not be the 
out-of-the-box behavior.

> The way Mutt provides this functionality is by decrypting only when you
> perform the search itself.

Yes, but notmuch can not do that. notmuch indexes the messages and mutt not.



-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Lo hago para no volverme loco cuando noto
que solo me queda un demonio en un hombro
por que se ha cortado las venas
el ?ngel que hab?a en el otro.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20100110/f8548751/attachment.pgp>


Re: [notmuch] indexing encrypted messages (was: OpenPGP support)

2010-01-10 Thread Ruben Pollan
On 14:41, Fri 08 Jan 10, micah anderson wrote:
 On Fri, 8 Jan 2010 10:21:21 +0100, Ruben Pollan mes...@sindominio.net wrote:
  On 15:56, Fri 08 Jan 10, martin f krafft wrote:
   How about indexing GPG-encrypted messages?
  
  I think that would be security hole. You should not store the
  encrypted messages on a decrypted database. A solution whould be to
  encrypt as well the xapian DB, but I think is too complex for the use.
 
 Would you consider it a security hole if you stored your database on
 encrypted media (such as on-disk block encryption)?

No, in this case should be not a security hole. But anyway what is secure and
what not should be defined by the user. For some users may not be a security
hole to store the email decrypted.

But I think notmuch by default should not do so. This kind of things should be
something that the user activate by hand knowing what she is doing.

 I know that sup does this, when it ran over my mail store, it would
 trigger my gpg agent so that it could decrypt the encrypted
 messages. This was annoying because this happened every time it ran,
 which meant that unless I had used gpg recently, my agent would pop up
 and ask me for my passphrase, which was often.

I didn't use sup. Don't know how it works. But that feature is technically
possible. As I said before in my personal opinion that should not be the 
out-of-the-box behavior.

 The way Mutt provides this functionality is by decrypting only when you
 perform the search itself.

Yes, but notmuch can not do that. notmuch indexes the messages and mutt not.



-- 
Rubén Pollán  | jabber:mes...@jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Lo hago para no volverme loco cuando noto
que solo me queda un demonio en un hombro
por que se ha cortado las venas
el ángel que había en el otro.


signature.asc
Description: Digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] indexing encrypted messages (was: OpenPGP support)

2010-01-08 Thread Ruben Pollan
On 15:56, Fri 08 Jan 10, martin f krafft wrote:
> How about indexing GPG-encrypted messages?

I think that would be security hole. You should not store the encrypted messages
on a decrypted database. A solution whould be to encrypt as well the xapian DB,
but I think is too complex for the use.

You should be still able, with the actual notmuch, to search over the headers 
of 
your encrypted messages, or any other non-encrypted part of the message. Is not
like that?

-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 Cuando los que mandan pierden la verg?enza,
los que obedecen pierden el respeto.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 



[notmuch] [PATCH] Added regress option to tags iterator

2010-01-06 Thread Ruben Pollan
On 11:39, Tue 05 Jan 10, Carl Worth wrote:
> Right. So example code using this would be:
> 
>   for (notmuch_messages_to_first (messages);
>  notmuch_messages_has_current (messages);
>  notmuch_messages_to_next (messages))
>   {
>   notmuch_message_t *message;
> 
>   message = notmuch_messages_get_current (messages);
> 
>   ...
>   }
> 
> And for iterating in the opposite direction it's very similar:
> 
>   for (notmuch_messages_to_last (messages);
>  notmuch_messages_has_current (messages);
>  notmuch_messages_to_previous (messages))
>   {
>   notmuch_message_t *message;
> 
>   message = notmuch_messages_get_current (messages);
> 
>   ...
>   }
> 
> Note that if you couldn't get the iterator to point to an invalid item
> before the first, then this second loop would have to look very
> different.

Yes, make sense like that.


I'm not sure what to do about the iterator when is on an invalid item, if you 
reach an invalid item doing to_next should be possible to do to_previous to 
recover the last valid item? Or is better to force the user to use to_last to 
go back?

In some cases implement to_previous will need to store the previous item 
(actually I did that on the patches I sent).

-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
?sta es la historia de una sociedad que se hunde
y mientras cae se repite:
hasta ahora todo va bien, hasta ahora todo va bien ...
Pero lo importante no es la caida sino el aterrizaje.
   el odio
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 



[notmuch] [PATCH] Added regress option to tags iterator

2010-01-05 Thread Ruben Pollan
On 19:16, Mon 21 Dec 09, Carl Worth wrote:
> On Mon, 21 Dec 2009 17:23:55 -0800, Carl Worth  wrote:
> >   New function  Corresponds to existing function (if any)
> >     -
> >   move_to_first 
> >   has_next  has_more
> >   move_to_next  advance
> > 
> >   move_to_last  
> >   has_previous  
> >   move_to_previous  
> > 
> >   get   get
> > 
> > The semantics of those all seem clear enough to me. They provide what's
> > necessary for all three portions of a for loop, (in either direction),
> 
> Except that they don't. :-P
> 
> We don't want has_next and has_previous but something more like "has
> current", (perhaps to pair with get_current?).

Not sure if I understand that. Let's see if I understand well. move_to_first
(or move_to_last) will put the iterator in the first (or last) valid item.
move_to_next (and move_to_previous) will be able to reach an invalid item
outside the list. Is it like that?

In some implementations of iterators (like C++ STD) you can reach invalid items
only in one side of the list, at the end, but not at the beginning. Some people
get use to this idea, but should not be a big deal to do it different.

So you are thinking in a function has_current showing if the current item is
valid. Am I right?

> > The only downside is that the function names are a bit long in some
> > cases, but I'm willing to live with that until someone comes up with
> > better.
> 
> One option is to just drop the "move_ " prefix.

I think that's a good option. The names of the functions are still clear like
that, and the original names are too long.


PS: Sorry for the late reply, Christmas is a busy time.


-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
?sta es la historia de una sociedad que se hunde
y mientras cae se repite:
hasta ahora todo va bien, hasta ahora todo va bien ...
Pero lo importante no es la caida sino el aterrizaje.
   el odio
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 



Re: [notmuch] [PATCH] Added regress option to tags iterator

2010-01-05 Thread Ruben Pollan
On 19:16, Mon 21 Dec 09, Carl Worth wrote:
 On Mon, 21 Dec 2009 17:23:55 -0800, Carl Worth cwo...@cworth.org wrote:
New function  Corresponds to existing function (if any)
  -
move_to_first implicit in iterator creation
has_next  has_more
move_to_next  advance
  
move_to_last  none
has_previous  none
move_to_previous  none
  
get   get
  
  The semantics of those all seem clear enough to me. They provide what's
  necessary for all three portions of a for loop, (in either direction),
 
 Except that they don't. :-P
 
 We don't want has_next and has_previous but something more like has
 current, (perhaps to pair with get_current?).

Not sure if I understand that. Let's see if I understand well. move_to_first
(or move_to_last) will put the iterator in the first (or last) valid item.
move_to_next (and move_to_previous) will be able to reach an invalid item
outside the list. Is it like that?

In some implementations of iterators (like C++ STD) you can reach invalid items
only in one side of the list, at the end, but not at the beginning. Some people
get use to this idea, but should not be a big deal to do it different.

So you are thinking in a function has_current showing if the current item is
valid. Am I right?

  The only downside is that the function names are a bit long in some
  cases, but I'm willing to live with that until someone comes up with
  better.
 
 One option is to just drop the move_  prefix.

I think that's a good option. The names of the functions are still clear like
that, and the original names are too long.


PS: Sorry for the late reply, Christmas is a busy time.


-- 
Rubén Pollán  | jabber:mes...@jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Ésta es la historia de una sociedad que se hunde
y mientras cae se repite:
hasta ahora todo va bien, hasta ahora todo va bien ...
Pero lo importante no es la caida sino el aterrizaje.
   el odio


signature.asc
Description: Digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] [patch] store folder information

2009-12-15 Thread Ruben Pollan
Some errors applying the patch:

[meskio at blackspot:src/notmuch.orig]$ git apply 
~/0001-Preseve-folder-information-when-indexing.patch
/home/meskio/0001-Preseve-folder-information-when-indexing.patch:136: trailing 
whitespace.
status = notmuch_database_add_message (notmuch, next, 
/home/meskio/0001-Preseve-folder-information-when-indexing.patch:137: trailing 
whitespace.
   folder_base_name, 
warning: 2 lines add whitespace errors.

It's just whitespaces at the end of the lines.


The patch works fine for me. I like it handles nicely the .foo.bar directories 
so I can do searches for "folder:foo" and for "folder:bar".

Reviewed-by: Ruben Pollan 

On 14:21, Mon 14 Dec 09, Andreas Kl?ckner wrote:
> I've patched notmuch to retain information on which folder emails are stored 
> in. This makes the transition from a folders-and-procmail model somewhat 
> easier. The resulting changes are attached.

-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Lo que pasa es que tienes envidia
por que las vocecitas me hablan a mi.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20091215/bff06cfc/attachment.pgp>


Re: [notmuch] [patch] store folder information

2009-12-15 Thread Ruben Pollan
Some errors applying the patch:

[mes...@blackspot:src/notmuch.orig]$ git apply 
~/0001-Preseve-folder-information-when-indexing.patch
/home/meskio/0001-Preseve-folder-information-when-indexing.patch:136: trailing 
whitespace.
status = notmuch_database_add_message (notmuch, next, 
/home/meskio/0001-Preseve-folder-information-when-indexing.patch:137: trailing 
whitespace.
   folder_base_name, 
warning: 2 lines add whitespace errors.

It's just whitespaces at the end of the lines.


The patch works fine for me. I like it handles nicely the .foo.bar directories 
so I can do searches for folder:foo and for folder:bar.

Reviewed-by: Ruben Pollan mes...@sindominio.net

On 14:21, Mon 14 Dec 09, Andreas Klöckner wrote:
 I've patched notmuch to retain information on which folder emails are stored 
 in. This makes the transition from a folders-and-procmail model somewhat 
 easier. The resulting changes are attached.

-- 
Rubén Pollán  | jabber:mes...@jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Lo que pasa es que tienes envidia
por que las vocecitas me hablan a mi.


signature.asc
Description: Digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] Quick thoughts on a notmuch daemon

2009-12-09 Thread Ruben Pollan
On 14:27, Thu 03 Dec 09, Carl Worth wrote:
> A simple solution would be a notmuch daemon that can accept commands on
> stdin, (in basically the exact same form as the current notmuch
> command-line interface). If the daemon does the job of periodically
> incorporating new mail, then the only command necessary to solve (1)
> above would be the tag command.

I like the idea. I didn't liked to fork for each command, so I started to play
with the library for create a UI. But with a demon like that I guess will be
nicer to use it than to call directly to the library.

Why use stdin? Why not sockets? With them at could be possible to use several 
concurrent clients with the same server.
(I really love moc for play music, and one of its greatest features is that)


-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 No vamos a reivindicar nada,
no vamos a pedir nada.
Tomaremos, okuparemos.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 



[notmuch] [PATCH] Added regress option to tags iterator

2009-12-09 Thread Ruben Pollan
On 14:21, Wed 09 Dec 09, Mark Anderson wrote:
> advance/retreat

Jeffrey already suggested retreat. I let you (English speakers) decide, my 
English
level is not enough for it.

-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
?sta es la historia de una sociedad que se hunde
y mientras cae se repite:
hasta ahora todo va bien, hasta ahora todo va bien ...
Pero lo importante no es la caida sino el aterrizaje.
   el odio
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 



[notmuch] [PATCH] Added regress option to tags iterator

2009-12-09 Thread Ruben Pollan
On 12:08, Wed 09 Dec 09, Carl Worth wrote:
> On Wed, 9 Dec 2009 14:24:46 +0100, Ruben Pollan  
> wrote:
> > Do you like to call them regress? Should I change that?
> 
> I don't love the name, (since it's so close to the word "regression"
> which has a totally different meaning in software context). But I also
> don't have an immediate suggestion for an improved name yet either.

Me neither, but as I don't have any better idea I just use regress. But we can
try to come up with something better.

> 
> > What about the functions notmuch_*_is_first? Is kind of reversed logic than
> > notmuch_*_has_more, the last are true when is not reach the limit but the
> > first ones are true when the limit is reached. But I think it make sense 
> > like
> > that.
> 
> I'd like a more symmetric API here. Anyone have a favorite set of names
> for iterating a list in two directions?

Yes, but actually are a bit different somehow. When you advance the last
iterator you can reach is a non-valid (outside the list) iterator. When you
'regress' the iterator at the end is a valid iterator, I don't see the need on
get outside of the list like with advance.

So, maybe because of it have sense the functions notmuch_*_is_first. Anyway I
really don't mind, one or other. To change it is trivial. It's harder to find a
good pair of names.




-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
   La felicidad no es hacer lo que deseas
 es desear lo que haces.

-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20091209/687fa4f0/attachment.pgp>


[notmuch] [PATCH] Added regress option to tags iterator

2009-12-09 Thread Ruben Pollan
With the last 4 patches there is more or less all I wanted implemented.

Do you like to call them regress? Should I change that?

What about the functions notmuch_*_is_first? Is kind of reversed logic than
notmuch_*_has_more, the last are true when is not reach the limit but the
first ones are true when the limit is reached. But I think it make sense like
that.


On 14:10, Wed 09 Dec 09, Ruben Pollan wrote:
> Added the functions notmuch_tags_regress and notmuch_tags_is_first to
> notmuch library. With them is possible to iterate backwards on tags.
> 
[...]

-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Sed realistas, exigid lo imposible.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20091209/f9234189/attachment.pgp>


[notmuch] [PATCH] Added regress option to tags iterator

2009-12-09 Thread Ruben Pollan
Added the functions notmuch_tags_regress and notmuch_tags_is_first to
notmuch library. With them is possible to iterate backwards on tags.

* notmuch_tags_regress do the opposite than notmuch_tags_advance,
  getting the tags iterator one position backwards.

* notmuch_tags_is_first return TRUE if the iterator is in the first
  tag.
---
 lib/notmuch.h |8 
 lib/tags.c|   19 +++
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index e28ce46..db051c8 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -917,6 +917,10 @@ notmuch_message_destroy (notmuch_message_t *message);
 notmuch_bool_t
 notmuch_tags_has_more (notmuch_tags_t *tags);

+/* Is the given notmuch_tags_t object on the first tags */
+notmuch_bool_t
+notmuch_tags_is_first (notmuch_tags_t *tags);
+
 /* Get the current tag from 'tags' as a string.
  *
  * Note: The returned string belongs to 'tags' and has a lifetime
@@ -936,6 +940,10 @@ notmuch_tags_get (notmuch_tags_t *tags);
 void
 notmuch_tags_advance (notmuch_tags_t *tags);

+/* Regress the 'tags' iterator to the previous result. */
+void
+notmuch_tags_regress (notmuch_tags_t *tags);
+
 /* Destroy a notmuch_tags_t object.
  *
  * It's not strictly necessary to call this function. All memory from
diff --git a/lib/tags.c b/lib/tags.c
index 85507e9..cf9e030 100644
--- a/lib/tags.c
+++ b/lib/tags.c
@@ -25,6 +25,7 @@
 struct _notmuch_tags {
 int sorted;
 GList *tags;
+GList *previous_node;
 GList *iterator;
 };

@@ -55,6 +56,7 @@ _notmuch_tags_create (void *ctx)

 tags->sorted = 1;
 tags->tags = NULL;
+tags->previous_node = NULL;
 tags->iterator = NULL;

 return tags;
@@ -94,6 +96,12 @@ notmuch_tags_has_more (notmuch_tags_t *tags)
 return tags->iterator != NULL;
 }

+notmuch_bool_t
+notmuch_tags_is_first (notmuch_tags_t *tags)
+{
+return tags->previous_node == NULL;
+}
+
 const char *
 notmuch_tags_get (notmuch_tags_t *tags)
 {
@@ -109,10 +117,21 @@ notmuch_tags_advance (notmuch_tags_t *tags)
 if (tags->iterator == NULL)
return;

+tags->previous_node = tags->iterator;
 tags->iterator = tags->iterator->next;
 }

 void
+notmuch_tags_regress (notmuch_tags_t *tags)
+{
+if (tags->previous_node == NULL)
+   return;
+
+   tags->iterator = tags->previous_node;
+   tags->previous_node = tags->iterator->prev;
+}
+
+void
 notmuch_tags_destroy (notmuch_tags_t *tags)
 {
 talloc_free (tags);
-- 
1.6.5.4



[notmuch] [PATCH] Added regress option to threads iterator

2009-12-09 Thread Ruben Pollan
Added the functions notmuch_threads_regress and notmuch_threads_is_first to
notmuch library. With them is possible to iterate backwards on threads.

* notmuch_threads_regress do the opposite than notmuch_threads_advance,
  getting the threads iterator one position backwards.

* notmuch_threads_is_first return TRUE if the iterator is in the first
  thread.
---
 lib/notmuch.h |8 
 lib/query.cc  |   28 
 2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index 69bd98a..e28ce46 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -429,6 +429,10 @@ notmuch_query_destroy (notmuch_query_t *query);
 notmuch_bool_t
 notmuch_threads_has_more (notmuch_threads_t *threads);

+/* Is the given notmuch_threads_t object on the first threads */
+notmuch_bool_t
+notmuch_threads_is_first (notmuch_threads_t *threads);
+
 /* Get the current thread from 'threads' as a notmuch_thread_t.
  *
  * Note: The returned thread belongs to 'threads' and has a lifetime
@@ -451,6 +455,10 @@ notmuch_threads_get (notmuch_threads_t *threads);
 void
 notmuch_threads_advance (notmuch_threads_t *threads);

+/* Regress the 'threads' iterator to the previous result. */
+void
+notmuch_threads_regress (notmuch_threads_t *threads);
+
 /* Destroy a notmuch_threads_t object.
  *
  * It's not strictly necessary to call this function. All memory from
diff --git a/lib/query.cc b/lib/query.cc
index 94a6860..cade17b 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -310,6 +310,12 @@ notmuch_threads_has_more (notmuch_threads_t *threads)
 return FALSE;
 }

+notmuch_bool_t
+notmuch_threads_is_first (notmuch_threads_t *threads)
+{
+return (g_hash_table_size (threads->threads) <= 1);
+}
+
 notmuch_thread_t *
 notmuch_threads_get (notmuch_threads_t *threads)
 {
@@ -329,6 +335,28 @@ notmuch_threads_advance (notmuch_threads_t *threads)
 }

 void
+notmuch_threads_regress (notmuch_threads_t *threads)
+{
+notmuch_message_t *message;
+   const char *thread_id;
+
+   thread_id = threads->thread_id;
+
+while (!notmuch_messages_is_first (threads->messages))
+{
+   notmuch_messages_regress (threads->messages);
+   message = notmuch_messages_get (threads->messages);
+   threads->thread_id = notmuch_message_get_thread_id (message);
+
+   if (strcmp (threads->thread_id, thread_id))
+   {
+   g_hash_table_remove (threads->threads, thread_id);
+   return;
+   }
+}
+}
+
+void
 notmuch_threads_destroy (notmuch_threads_t *threads)
 {
 talloc_free (threads);
-- 
1.6.5.4



[notmuch] [PATCH] Added regress option to threads iterator

2009-12-09 Thread Ruben Pollan
Added the functions notmuch_threads_regress and notmuch_threads_is_first to
notmuch library. With them is possible to iterate backwards on threads.

* notmuch_threads_regress do the opposite than notmuch_threads_advance,
  getting the threads iterator one position backwards.

* notmuch_threads_is_first return TRUE if the iterator is in the first
  thread.
---
 lib/notmuch.h |8 
 lib/query.cc  |   28 
 2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index 69bd98a..e28ce46 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -429,6 +429,10 @@ notmuch_query_destroy (notmuch_query_t *query);
 notmuch_bool_t
 notmuch_threads_has_more (notmuch_threads_t *threads);
 
+/* Is the given notmuch_threads_t object on the first threads */
+notmuch_bool_t
+notmuch_threads_is_first (notmuch_threads_t *threads);
+
 /* Get the current thread from 'threads' as a notmuch_thread_t.
  *
  * Note: The returned thread belongs to 'threads' and has a lifetime
@@ -451,6 +455,10 @@ notmuch_threads_get (notmuch_threads_t *threads);
 void
 notmuch_threads_advance (notmuch_threads_t *threads);
 
+/* Regress the 'threads' iterator to the previous result. */
+void
+notmuch_threads_regress (notmuch_threads_t *threads);
+
 /* Destroy a notmuch_threads_t object.
  *
  * It's not strictly necessary to call this function. All memory from
diff --git a/lib/query.cc b/lib/query.cc
index 94a6860..cade17b 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -310,6 +310,12 @@ notmuch_threads_has_more (notmuch_threads_t *threads)
 return FALSE;
 }
 
+notmuch_bool_t
+notmuch_threads_is_first (notmuch_threads_t *threads)
+{
+return (g_hash_table_size (threads-threads) = 1);
+}
+
 notmuch_thread_t *
 notmuch_threads_get (notmuch_threads_t *threads)
 {
@@ -329,6 +335,28 @@ notmuch_threads_advance (notmuch_threads_t *threads)
 }
 
 void
+notmuch_threads_regress (notmuch_threads_t *threads)
+{
+notmuch_message_t *message;
+   const char *thread_id;
+
+   thread_id = threads-thread_id;
+
+while (!notmuch_messages_is_first (threads-messages))
+{
+   notmuch_messages_regress (threads-messages);
+   message = notmuch_messages_get (threads-messages);
+   threads-thread_id = notmuch_message_get_thread_id (message);
+
+   if (strcmp (threads-thread_id, thread_id))
+   {
+   g_hash_table_remove (threads-threads, thread_id);
+   return;
+   }
+}
+}
+
+void
 notmuch_threads_destroy (notmuch_threads_t *threads)
 {
 talloc_free (threads);
-- 
1.6.5.4

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] [PATCH] Added regress option to tags iterator

2009-12-09 Thread Ruben Pollan
Added the functions notmuch_tags_regress and notmuch_tags_is_first to
notmuch library. With them is possible to iterate backwards on tags.

* notmuch_tags_regress do the opposite than notmuch_tags_advance,
  getting the tags iterator one position backwards.

* notmuch_tags_is_first return TRUE if the iterator is in the first
  tag.
---
 lib/notmuch.h |8 
 lib/tags.c|   19 +++
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index e28ce46..db051c8 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -917,6 +917,10 @@ notmuch_message_destroy (notmuch_message_t *message);
 notmuch_bool_t
 notmuch_tags_has_more (notmuch_tags_t *tags);
 
+/* Is the given notmuch_tags_t object on the first tags */
+notmuch_bool_t
+notmuch_tags_is_first (notmuch_tags_t *tags);
+
 /* Get the current tag from 'tags' as a string.
  *
  * Note: The returned string belongs to 'tags' and has a lifetime
@@ -936,6 +940,10 @@ notmuch_tags_get (notmuch_tags_t *tags);
 void
 notmuch_tags_advance (notmuch_tags_t *tags);
 
+/* Regress the 'tags' iterator to the previous result. */
+void
+notmuch_tags_regress (notmuch_tags_t *tags);
+
 /* Destroy a notmuch_tags_t object.
  *
  * It's not strictly necessary to call this function. All memory from
diff --git a/lib/tags.c b/lib/tags.c
index 85507e9..cf9e030 100644
--- a/lib/tags.c
+++ b/lib/tags.c
@@ -25,6 +25,7 @@
 struct _notmuch_tags {
 int sorted;
 GList *tags;
+GList *previous_node;
 GList *iterator;
 };
 
@@ -55,6 +56,7 @@ _notmuch_tags_create (void *ctx)
 
 tags-sorted = 1;
 tags-tags = NULL;
+tags-previous_node = NULL;
 tags-iterator = NULL;
 
 return tags;
@@ -94,6 +96,12 @@ notmuch_tags_has_more (notmuch_tags_t *tags)
 return tags-iterator != NULL;
 }
 
+notmuch_bool_t
+notmuch_tags_is_first (notmuch_tags_t *tags)
+{
+return tags-previous_node == NULL;
+}
+
 const char *
 notmuch_tags_get (notmuch_tags_t *tags)
 {
@@ -109,10 +117,21 @@ notmuch_tags_advance (notmuch_tags_t *tags)
 if (tags-iterator == NULL)
return;
 
+tags-previous_node = tags-iterator;
 tags-iterator = tags-iterator-next;
 }
 
 void
+notmuch_tags_regress (notmuch_tags_t *tags)
+{
+if (tags-previous_node == NULL)
+   return;
+
+   tags-iterator = tags-previous_node;
+   tags-previous_node = tags-iterator-prev;
+}
+
+void
 notmuch_tags_destroy (notmuch_tags_t *tags)
 {
 talloc_free (tags);
-- 
1.6.5.4

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] [PATCH] Added regress option to tags iterator

2009-12-09 Thread Ruben Pollan
With the last 4 patches there is more or less all I wanted implemented.

Do you like to call them regress? Should I change that?

What about the functions notmuch_*_is_first? Is kind of reversed logic than
notmuch_*_has_more, the last are true when is not reach the limit but the
first ones are true when the limit is reached. But I think it make sense like
that.


On 14:10, Wed 09 Dec 09, Ruben Pollan wrote:
 Added the functions notmuch_tags_regress and notmuch_tags_is_first to
 notmuch library. With them is possible to iterate backwards on tags.
 
[...]

-- 
Rubén Pollán  | jabber:mes...@jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Sed realistas, exigid lo imposible.


signature.asc
Description: Digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] [PATCH] Added regress option to tags iterator

2009-12-09 Thread Ruben Pollan
On 12:08, Wed 09 Dec 09, Carl Worth wrote:
 On Wed, 9 Dec 2009 14:24:46 +0100, Ruben Pollan mes...@sindominio.net wrote:
  Do you like to call them regress? Should I change that?
 
 I don't love the name, (since it's so close to the word regression
 which has a totally different meaning in software context). But I also
 don't have an immediate suggestion for an improved name yet either.

Me neither, but as I don't have any better idea I just use regress. But we can
try to come up with something better.

 
  What about the functions notmuch_*_is_first? Is kind of reversed logic than
  notmuch_*_has_more, the last are true when is not reach the limit but the
  first ones are true when the limit is reached. But I think it make sense 
  like
  that.
 
 I'd like a more symmetric API here. Anyone have a favorite set of names
 for iterating a list in two directions?

Yes, but actually are a bit different somehow. When you advance the last
iterator you can reach is a non-valid (outside the list) iterator. When you
'regress' the iterator at the end is a valid iterator, I don't see the need on
get outside of the list like with advance.

So, maybe because of it have sense the functions notmuch_*_is_first. Anyway I
really don't mind, one or other. To change it is trivial. It's harder to find a
good pair of names.




-- 
Rubén Pollán  | jabber:mes...@jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
   La felicidad no es hacer lo que deseas
 es desear lo que haces.



signature.asc
Description: Digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] [PATCH] Added regress option to tags iterator

2009-12-09 Thread Ruben Pollan
On 14:21, Wed 09 Dec 09, Mark Anderson wrote:
 advance/retreat

Jeffrey already suggested retreat. I let you (English speakers) decide, my 
English
level is not enough for it.

-- 
Rubén Pollán  | jabber:mes...@jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Ésta es la historia de una sociedad que se hunde
y mientras cae se repite:
hasta ahora todo va bien, hasta ahora todo va bien ...
Pero lo importante no es la caida sino el aterrizaje.
   el odio


signature.asc
Description: Digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] Quick thoughts on a notmuch daemon

2009-12-09 Thread Ruben Pollan
On 14:27, Thu 03 Dec 09, Carl Worth wrote:
 A simple solution would be a notmuch daemon that can accept commands on
 stdin, (in basically the exact same form as the current notmuch
 command-line interface). If the daemon does the job of periodically
 incorporating new mail, then the only command necessary to solve (1)
 above would be the tag command.

I like the idea. I didn't liked to fork for each command, so I started to play
with the library for create a UI. But with a demon like that I guess will be
nicer to use it than to call directly to the library.

Why use stdin? Why not sockets? With them at could be possible to use several 
concurrent clients with the same server.
(I really love moc for play music, and one of its greatest features is that)


-- 
Rubén Pollán  | jabber:mes...@jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 No vamos a reivindicar nada,
no vamos a pedir nada.
Tomaremos, okuparemos.


signature.asc
Description: Digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] regress option to messages iterator

2009-12-08 Thread ruben pollan
Attached to this email I add a small code that use this functions, as an
example.

On 10:41, Tue 08 Dec 09, meskio at sindominio.net wrote:
> Two patches for implement the regress functions on messages. With them 
> notmuch_messages_t can be use as an iterator forwards and backwards.
> 
> Up to now not really useful, nothing use them. I send them mainly to review.
> I'll do the same to threads and tags, so the UIs can use them.
> 
> PS: It's the first time I'm using git-send-email, I hope I do everything well.
> 
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
> 

-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  Si luchas puedes perder
 Si no luchas estas perdido

-- next part --
A non-text attachment was scrubbed...
Name: foo.c
Type: text/x-csrc
Size: 886 bytes
Desc: not available
URL: 

-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 



[notmuch] notmuch_threads_back and notmuch_messages_back

2009-12-06 Thread Ruben Pollan
On 19:57, Fri 27 Nov 09, Carl Worth wrote:
> (I'd like a verb that pairs better
> with "advance" than the non-verb "back"---any suggestions)?

What about regress?
I'm not a native English speaker, so maybe someone can suggest something better.

> So those won't need any new code. The one case that will need new code
> is that for notmuch_message_get_replies and
> notmuch_message_get_toplevel_messages the messages iterator is currently
> built on a singly-linked list. Making it doubly linked would obviously
> not be hard though.

I'm trying to convert it to a doubly linked list, but I'm not sure if I
understand well how they work.

I don't see how _notmuch_message_list_append works. It says "node can of course
point to an arbitrarily long list of nodes", but the code is:

void
_notmuch_message_list_append (notmuch_message_list_t *list,
  notmuch_message_node_t *node)
{   
*(list->tail) = node;
list->tail = >next;
}

Should not be something like:

void
_notmuch_message_list_append (notmuch_message_list_t *list,
  notmuch_message_node_t *node)
{   
notmuch_message_node_t *next_node;

*(list->tail) = node;
for (next_node = node->next; next_node->next != NULL;
 next_node = next_node->next);
list->tail = _node->next;
}

Do I miss something? Or the function is just designed to work on a single node
not a list of them?


-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 No vamos a reivindicar nada,
no vamos a pedir nada.
Tomaremos, okuparemos.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 



[notmuch] notsomuch, a dummy curses ui

2009-11-26 Thread Ruben Pollan
On 10:30, Thu 26 Nov 09, Carl Worth wrote:
> I'm glad to see work like this going on. If you do decide to keep going
> with it at all, I'd be glad to add this to contrib. I'm happy to have
> all kinds of different interfaces available.

Ok, I'll see what I'm doing about it in the future. Right now it don't do 
nothing, 
I'm just playing with the code. But as soon as I have something working I'll ask
to be on contrib.

> We can decide later if it makes sense to separate various interfaces
> into their own repositories/tar-files etc. For now, while the library
> and command-line keeps changing rapidly, I think it makes sense to keep
> things together.

I do agree. Up to now is a good idea to have everything together. I guess in the
future the library API will become more standard and will be possible to split
the interfaces.

-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Lo hago para no volverme loco cuando noto
que solo me queda un demonio en un hombro
por que se ha cortado las venas
el ?ngel que hab?a en el otro.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 



[notmuch] notmuch_threads_back and notmuch_messages_back

2009-11-26 Thread Ruben Pollan
Is it possible to implement notmuch_threads_back and notmuch_messages_back?
And I guess will make sense to have also notmuch_tags_back.

This functions will do the oposite than notmuch_threads_advance and
notmuch_messages_advance. So I can use them as iterators going back and forward.

I didn't check the implementation of notmuch. I don't know if will be easy or
will need to redesign a lot of code.

-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
   La felicidad no es hacer lo que deseas
 es desear lo que haces.

-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 



[notmuch] Search results now start appearing "instantly"

2009-11-26 Thread Ruben Pollan
On 11:17, Wed 25 Nov 09, Carl Worth wrote:
> And for the authors of the other interfaces, let us know when you've got
> similar support for streaming searches, (or if you didn't get this
> automatically as soon as "notmuch search" was fixed).

Yes, actually is faster now.

I had to rewrite some of the code, because before I used the
notmuch_query_search_threads for pagging with the parameters for number of
threads and index. But I like it more now.

Thank you.

-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
?sta es la historia de una sociedad que se hunde
y mientras cae se repite:
hasta ahora todo va bien, hasta ahora todo va bien ...
Pero lo importante no es la caida sino el aterrizaje.
   el odio
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: 



[notmuch] notsomuch, a dummy curses ui

2009-11-23 Thread Ruben Pollan
Hi notmuch community,

As I'm not an emacs user, I started to play with the code to see what are the
power of notmuch. I create a simple ncurses ui:
http://gitorious.org/notsomuch

Up to now it don't do much, just display searches and threads. It don't even
display the content of the emails. I guess I'll be playing with it for some
weeks, but not sure jet if I'll try to create a proper program or I'll drop it
soon.


PS: I have to try the vim pluggin, maybe that could be my email reader in the
future.

-- 
Rub?n Poll?n  | jabber:meskio at jabber.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 No vamos a reivindicar nada,
no vamos a pedir nada.
Tomaremos, okuparemos.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: