aboutsummaryrefslogtreecommitdiff
path: root/contactList.h
blob: 9051f416448c40c673162aebf59e3a0dae85b914 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef CONTACT_LIST_H
#define CONTACT_LIST_H

#include <ncurses.h>
#include <stdio.h>
#include <string.h>
#include "basic_curses.h"

typedef struct conversation conversation;

typedef struct contact {
    char name[100];
    char display_name[100];
    char number[50];
    int hasNewMessage;
    conversation* conversation;
} contact ;

#define DEFAULT_CONTACT_FILENAME "/var/spool/sms/contacts.csv"



// Params: The CSV filename (separator ';', unexcaped string, so ';' is forbiden in value)
// Return: 0 if success, >0 if error
int fillContactList(const char* cvs_file_in);


// Params: A valide filename
// Return: 0 if success, >0 if error
int writeContactList(const char* cvs_file_in);

// Find a contact
// Params: A SIM Number
// Return: 0 if success, >0 otherwise
int findContact(const char*, contact**);

// Find a contact
// Params: A name
// Return: 0 if success, >0 otherwise
int findContactFromName(const char*, contact**,contact*);




// Add a contact
// Params: A contact struct
// Return: 0 if success,  >0 otherwise
int addContact(const contact*);

// Delete a contact
// Params: A String which is a valide contact SIM number
// Return: 0 if success,  >0 otherwise
int deleteContact(contact*);

// Sort the contact list
// Params : Nothing
// Return : Nothing
void sortContacts(void);


///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////


// Window contact
#endif