buddy: refresh photos on provisioning v2 notification
[siplcs.git] / src / core / sipe-buddy.h
blob02afe8e94d25d78657321b76b8661db4f1de9146
1 /**
2 * @file sipe-buddy.h
4 * pidgin-sipe
6 * Copyright (C) 2010 SIPE Project <http://sipe.sourceforge.net/>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 /* Forward declarations */
24 struct sipe_core_private;
25 struct sipe_cal_working_hours;
27 struct sipe_buddy {
28 gchar *name;
29 gchar *activity;
30 gchar *meeting_subject;
31 gchar *meeting_location;
32 /* Sipe internal format for Note is HTML.
33 * All incoming plain text should be html-escaped
34 * for example by g_markup_escape_text()
36 gchar *note;
37 gboolean is_oof_note;
38 time_t note_since;
40 /* Calendar related fields */
41 gchar *cal_start_time;
42 int cal_granularity;
43 gchar *cal_free_busy_base64;
44 gchar *cal_free_busy;
45 time_t cal_free_busy_published;
46 /* for 2005 systems */
47 int user_avail;
48 time_t user_avail_since;
49 time_t activity_since;
50 const char *last_non_cal_status_id;
51 gchar *last_non_cal_activity;
53 struct sipe_cal_working_hours *cal_working_hours;
55 gchar *device_name;
56 GSList *groups;
57 /** flag to control sending 'context' element in 2007 subscriptions */
58 gboolean just_added;
61 /**
62 * Creates @c sipe_buddy structure for a new buddy and adds it into the buddy
63 * list of given account. If buddy is already in the list, its existing
64 * structure is returned.
66 * @param sipe_private SIPE core data
67 * @param uri SIP URI of a buddy
69 * @return @c sipe_buddy structure
71 struct sipe_buddy *sipe_buddy_add(struct sipe_core_private *sipe_private,
72 const gchar *uri);
74 /**
75 * Free all buddy information
77 * @param sipe_private SIPE core data
79 void sipe_buddy_free_all(struct sipe_core_private *sipe_private);
81 /**
82 * Tries to retrieve a real user's name associated with given SIP URI.
84 * Result must be g_free'd after use.
86 * @param sipe_private SIPE core data
87 * @param with a SIP URI
89 * @return Name of the user if the URI is found in buddy list, otherwise @c NULL
91 gchar *sipe_buddy_get_alias(struct sipe_core_private *sipe_private,
92 const gchar *with);
94 /**
95 * Update the value of a buddy property with given SIP URI
97 * @param sipe_private SIPE core data
98 * @param uri a SIP URI
99 * @param propkey property id (see sipe-backend.h)
100 * @param property_value new value for the property
102 void sipe_buddy_update_property(struct sipe_core_private *sipe_private,
103 const gchar *uri,
104 sipe_buddy_info_fields propkey,
105 gchar *property_value);
108 * Triggers a download of all buddy photos that were changed on the server.
110 * @param sipe_private SIPE core data
112 void sipe_buddy_refresh_photos(struct sipe_core_private *sipe_private);