tuple.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef __TUPLE_H
  2. #define __TUPLE_H
  3. /* PA tuple functions (data structures are defined in presentity.h) */
  4. #include "presentity.h"
  5. /* Create a new presence_tuple */
  6. int new_presence_tuple(str* _contact, time_t expires,
  7. presence_tuple_t ** _t, int is_published, str *id,
  8. str *published_id, str *etag);
  9. /* add presence tuple to presentity and to database */
  10. void add_presence_tuple(presentity_t *_p, presence_tuple_t *_t);
  11. /* Remove tuple from presentity and from database too */
  12. void remove_presence_tuple(presentity_t *_p, presence_tuple_t *_t);
  13. /* Free all memory associated with a presence_tuple */
  14. void free_presence_tuple(presence_tuple_t * _t);
  15. /* Find a tuple for contact _contact on presentity _p - only registered contacts ! */
  16. int find_registered_presence_tuple(str* _contact, presentity_t *_p, presence_tuple_t ** _t);
  17. /* Find tuple with given id */
  18. int find_presence_tuple_id(str* id, presentity_t *_p, presence_tuple_t ** _t);
  19. /* Find published tuple with given ID (ID used for publication, not tuple ID!) */
  20. presence_tuple_t *find_published_tuple(presentity_t *presentity, str *etag, str *id);
  21. /** Function reads all tuples from DB for given presentity */
  22. int db_read_tuples(presentity_t *_p, db_con_t* db);
  23. /* update tuple status in database */
  24. int db_update_presence_tuple(presentity_t *_p, presence_tuple_t *t, int update_notes_and_ext);
  25. /* creates new tuple from given information (needed for publishing */
  26. presence_tuple_t *presence_tuple_info2pa(presence_tuple_info_t *i, str *etag, time_t expires);
  27. /* updates published information */
  28. void update_tuple(presentity_t *p, presence_tuple_t *t, presence_tuple_info_t *i, time_t expires);
  29. #endif