mirror of https://github.com/djcb/mu.git
mu/lib: merge mu-contacts.h => mu-contacts.hh
This commit is contained in:
parent
848b888573
commit
125176d397
|
@ -1,71 +0,0 @@
|
||||||
/*
|
|
||||||
** Copyright (C) 2012-2016 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
|
||||||
**
|
|
||||||
** This program is free software; you can redistribute it and/or modify it
|
|
||||||
** under the terms of the GNU General Public License as published by the
|
|
||||||
** Free Software Foundation; either version 3, or (at your option) any
|
|
||||||
** later version.
|
|
||||||
**
|
|
||||||
** This program is distributed in the hope that it will be useful,
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
** GNU General Public License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with this program; if not, write to the Free Software Foundation,
|
|
||||||
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
**
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __MU_CONTACTS_H__
|
|
||||||
#define __MU_CONTACTS_H__
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
struct _MuContacts;
|
|
||||||
typedef struct _MuContacts MuContacts;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* return the number of contacts
|
|
||||||
*
|
|
||||||
* @param self a contacts object
|
|
||||||
*
|
|
||||||
* @return the number of contacts
|
|
||||||
*/
|
|
||||||
size_t mu_contacts_count (MuContacts *self);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function called for mu_contacts_foreach; returns the e-mail address, name
|
|
||||||
* (which may be NULL) , whether the message is 'personal', the timestamp for
|
|
||||||
* the address (when it was last seen), and the frequency (in how many message
|
|
||||||
* did this contact participate) and the tstamp (last modification)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
typedef void (*MuContactsForeachFunc) (const char *full_address,
|
|
||||||
const char *email, const char *name,
|
|
||||||
gboolean personal,
|
|
||||||
time_t last_seen, unsigned freq,
|
|
||||||
gint64 tstamp, gpointer user_data);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* call a function for either each contact, or each contact satisfying
|
|
||||||
* a regular expression,
|
|
||||||
*
|
|
||||||
* @param self contacts object
|
|
||||||
* @param func callback function to be called for each
|
|
||||||
* @param user_data user data to pass to the callback
|
|
||||||
*
|
|
||||||
* @return TRUE if the function succeeded, or FALSE if the provide regular
|
|
||||||
* expression was invalid (and not NULL)
|
|
||||||
*/
|
|
||||||
gboolean mu_contacts_foreach (MuContacts *self,
|
|
||||||
MuContactsForeachFunc func,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /*__MU_CONTACTS_H__*/
|
|
|
@ -20,6 +20,14 @@
|
||||||
#ifndef __MU_CONTACTS_HH__
|
#ifndef __MU_CONTACTS_HH__
|
||||||
#define __MU_CONTACTS_HH__
|
#define __MU_CONTACTS_HH__
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
struct _MuContacts;
|
||||||
|
typedef struct _MuContacts MuContacts;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
@ -27,9 +35,6 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
|
||||||
#include "mu-contacts.h"
|
|
||||||
|
|
||||||
namespace Mu {
|
namespace Mu {
|
||||||
|
|
||||||
/// Data-structure representing information about some contact.
|
/// Data-structure representing information about some contact.
|
||||||
|
@ -151,6 +156,50 @@ private:
|
||||||
std::unique_ptr<Private> priv_;
|
std::unique_ptr<Private> priv_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // namespace Mu
|
} // namespace Mu
|
||||||
|
|
||||||
|
#endif /*__cplusplus*/
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return the number of contacts
|
||||||
|
*
|
||||||
|
* @param self a contacts object
|
||||||
|
*
|
||||||
|
* @return the number of contacts
|
||||||
|
*/
|
||||||
|
size_t mu_contacts_count (MuContacts *self);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function called for mu_contacts_foreach; returns the e-mail address, name
|
||||||
|
* (which may be NULL) , whether the message is 'personal', the timestamp for
|
||||||
|
* the address (when it was last seen), and the frequency (in how many message
|
||||||
|
* did this contact participate) and the tstamp (last modification)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
typedef void (*MuContactsForeachFunc) (const char *full_address,
|
||||||
|
const char *email, const char *name,
|
||||||
|
gboolean personal,
|
||||||
|
time_t last_seen, unsigned freq,
|
||||||
|
gint64 tstamp, gpointer user_data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* call a function for either each contact, or each contact satisfying
|
||||||
|
* a regular expression,
|
||||||
|
*
|
||||||
|
* @param self contacts object
|
||||||
|
* @param func callback function to be called for each
|
||||||
|
* @param user_data user data to pass to the callback
|
||||||
|
*
|
||||||
|
* @return TRUE if the function succeeded, or FALSE if the provide regular
|
||||||
|
* expression was invalid (and not NULL)
|
||||||
|
*/
|
||||||
|
gboolean mu_contacts_foreach (MuContacts *self,
|
||||||
|
MuContactsForeachFunc func,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __MU_CONTACTS_HH__ */
|
#endif /* __MU_CONTACTS_HH__ */
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
#include "mu-str.h"
|
#include "mu-str.h"
|
||||||
#include "mu-date.h"
|
#include "mu-date.h"
|
||||||
#include "mu-flags.h"
|
#include "mu-flags.h"
|
||||||
#include "mu-contacts.h"
|
#include "mu-contacts.hh"
|
||||||
|
|
||||||
|
|
||||||
// note: not re-entrant
|
// note: not re-entrant
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
#include "mu-str.h"
|
#include "mu-str.h"
|
||||||
#include "mu-date.h"
|
#include "mu-date.h"
|
||||||
#include "mu-flags.h"
|
#include "mu-flags.h"
|
||||||
#include "mu-contacts.h"
|
#include "mu-contacts.hh"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <mu-msg.h>
|
#include <mu-msg.h>
|
||||||
#include <mu-util.h> /* for MuError, MuError */
|
#include <mu-util.h> /* for MuError, MuError */
|
||||||
#include <mu-contacts.h>
|
#include <mu-contacts.hh>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "mu-util.h"
|
#include "mu-util.h"
|
||||||
#include "mu-str.h"
|
#include "mu-str.h"
|
||||||
#include "mu-date.h"
|
#include "mu-date.h"
|
||||||
#include "mu-contacts.h"
|
#include "mu-contacts.hh"
|
||||||
#include "mu-runtime.h"
|
#include "mu-runtime.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
#include "mu-index.h"
|
#include "mu-index.h"
|
||||||
#include "mu-store.h"
|
#include "mu-store.h"
|
||||||
#include "mu-msg-part.h"
|
#include "mu-msg-part.h"
|
||||||
#include "mu-contacts.h"
|
#include "mu-contacts.hh"
|
||||||
|
|
||||||
/* signal handling *****************************************************/
|
/* signal handling *****************************************************/
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include "mu-str.h"
|
#include "mu-str.h"
|
||||||
#include "mu-date.h"
|
#include "mu-date.h"
|
||||||
#include "mu-maildir.h"
|
#include "mu-maildir.h"
|
||||||
#include "mu-contacts.h"
|
#include "mu-contacts.hh"
|
||||||
#include "mu-runtime.h"
|
#include "mu-runtime.h"
|
||||||
#include "mu-flags.h"
|
#include "mu-flags.h"
|
||||||
#include "mu-store.h"
|
#include "mu-store.h"
|
||||||
|
@ -583,7 +583,6 @@ with_store (store_func func, MuConfig *opts, gboolean read_only,
|
||||||
else
|
else
|
||||||
store = mu_store_new_writable
|
store = mu_store_new_writable
|
||||||
(mu_runtime_path(MU_RUNTIME_PATH_XAPIANDB),
|
(mu_runtime_path(MU_RUNTIME_PATH_XAPIANDB),
|
||||||
mu_runtime_path(MU_RUNTIME_PATH_CONTACTS),
|
|
||||||
opts->rebuild, err);
|
opts->rebuild, err);
|
||||||
if (!store)
|
if (!store)
|
||||||
return MU_G_ERROR_CODE(err);
|
return MU_G_ERROR_CODE(err);
|
||||||
|
|
Loading…
Reference in New Issue