core cleanup: separate code for sipe_backend_account_status_and_note()
[siplcs.git] / src / core / sipe-status.c
blob3da4bb6e2ee710a8a7122d6a6bac8ffdb36df5d9
1 /**
2 * @file sipe-status.c
4 * pidgin-sipe
6 * Copyright (C) 2011 SIPE Project <http://sipe.sourceforge.net/>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include <time.h>
26 #include <glib.h>
28 #include "sipe-backend.h"
29 #include "sipe-core.h"
30 #include "sipe-core-private.h"
31 #include "sipe-ocs2005.h"
32 #include "sipe-ocs2007.h"
33 #include "sipe-status.h"
34 #define _SIPE_NEED_ACTIVITIES
35 #include "sipe.h"
37 void sipe_core_reset_status(struct sipe_core_public *sipe_public)
39 struct sipe_core_private *sipe_private = SIPE_CORE_PRIVATE;
40 if (SIPE_CORE_PRIVATE_FLAG_IS(OCS2007))
41 sipe_ocs2007_reset_status(sipe_private);
42 else
43 sipe_ocs2005_reset_status(sipe_private);
46 void sipe_status_and_note(struct sipe_core_private *sipe_private,
47 const gchar *status_id)
49 struct sipe_account_data *sip = SIPE_ACCOUNT_DATA_PRIVATE;
50 gboolean changed = sipe_backend_status_and_note(SIPE_CORE_PUBLIC,
51 status_id,
52 sip->note);
54 if (changed) {
55 sipe_activity activity = sipe_activity_from_token(status_id);
57 sip->do_not_publish[activity] = time(NULL);
58 SIPE_DEBUG_INFO("sipe_status_and_note: do_not_publish[%s]=%d [now]",
59 status_id,
60 (int) sip->do_not_publish[activity]);
65 Local Variables:
66 mode: c
67 c-file-style: "bsd"
68 indent-tabs-mode: t
69 tab-width: 8
70 End: