Lumail - The console email client


Lua primitives: maildirs_matching()

NOTE: Lumail-legacy has been superseded by Lumail 2.x, which has a wholly unified Lua API.

The maildirs_matching function returns a table which contains the names of each maildir matching a given regular expression.

This can be used to automate tasks.

For example:

--
-- Mark all messages in the current folder as read.
--
function mark_all_read()
   count = count_messages()
   i = 0
   while( i < count ) do
      jump_index_to( i )
      mark_read()
      i = i + 1
   end
end

--
-- Mark all the mails in all maildirs matching the pattern "/.machines."
-- as being read.
--
function mark_machines_read()
   test = maildirs_matching( "/.machines." );

   -- for each matching maildir
   for index,name in ipairs( test ) do
      -- select it
      if ( select_maildir( name ) ) then
         -- open it.
         clear_selected_folders();
         add_selected_folder()
         -- mark them read, using the previously defined function.
         mark_all_read();
      end
   end
end

Availability

This function has been available since version 0.08.

See Also

See also current_maildir, current_maildirs, jump_maildir_to, scroll_maildir_down, scroll_maildir_to, scroll_maildir_up, select_maildir.