Sun, 26 Dec 2004 05:23:51 +0000
[gaim-migrate @ 11671]
The ability to add, modify and _save_ new statuses. This hopefully
brings our functionality slightly past where it is in oldstatus.
This could use a bit of testing, but I think it's pretty good.
We still can't edit substatuses.
Primitive types like "unset" should be hidden from the status selector
dropdown. "Online" and "offline" should maybe be hidden... but someone
in #gaim mentioned that it might be a good way to choose which accounts
are offline for a given status. Eh.
| 10418 | 1 | /** |
| 2 | * @file savedstatuses.h Saved Status API | |
| 3 | * @ingroup core | |
| 4 | * | |
| 5 | * gaim | |
| 6 | * | |
| 7 | * Gaim is the legal property of its developers, whose names are too numerous | |
| 8 | * to list here. Please refer to the COPYRIGHT file distributed with this | |
| 9 | * source distribution. | |
| 10 | * | |
| 11 | * This program is free software; you can redistribute it and/or modify | |
| 12 | * it under the terms of the GNU General Public License as published by | |
| 13 | * the Free Software Foundation; either version 2 of the License, or | |
| 14 | * (at your option) any later version. | |
| 15 | * | |
| 16 | * This program is distributed in the hope that it will be useful, | |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 | * GNU General Public License for more details. | |
| 20 | * | |
| 21 | * You should have received a copy of the GNU General Public License | |
| 22 | * along with this program; if not, write to the Free Software | |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 24 | */ | |
| 25 | #ifndef _GAIM_SAVEDSTATUSES_H_ | |
| 26 | #define _GAIM_SAVEDSTATUSES_H_ | |
| 27 | ||
| 28 | /** | |
| 29 | * Saved statuses don't really interact much with the rest of Gaim. It | |
| 30 | * could really be a plugin. It's just a list of away states. When | |
| 31 | * a user chooses one of the saved states, their Gaim accounts are set | |
| 32 | * to the settings of that state. | |
| 33 | */ | |
| 34 | ||
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
35 | typedef struct _GaimSavedStatus GaimSavedStatus; |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
36 | typedef struct _GaimSavedStatusSub GaimSavedStatusSub; |
| 10418 | 37 | |
| 38 | /**************************************************************************/ | |
| 39 | /** @name Saved status subsystem */ | |
| 40 | /**************************************************************************/ | |
| 41 | /*@{*/ | |
| 42 | ||
| 43 | /** | |
| 44 | * Create a new saved status. This will add the saved status to the | |
| 45 | * list of saved statuses and writes the revised list to status.xml. | |
| 46 | * | |
| 47 | * @param title The title of the saved status. This must be unique. | |
| 48 | * @param type The type of saved status. | |
| 49 | * | |
|
10420
7277ae4229e9
[gaim-migrate @ 11671]
Mark Doliner <markdoliner@pidgin.im>
parents:
10419
diff
changeset
|
50 | * @return The newly created saved status, or NULL if the title you |
|
7277ae4229e9
[gaim-migrate @ 11671]
Mark Doliner <markdoliner@pidgin.im>
parents:
10419
diff
changeset
|
51 | * used was already taken. |
| 10418 | 52 | */ |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
53 | GaimSavedStatus *gaim_savedstatus_new(const char *title, |
|
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
54 | GaimStatusPrimitive type); |
| 10418 | 55 | |
| 56 | /** | |
|
10420
7277ae4229e9
[gaim-migrate @ 11671]
Mark Doliner <markdoliner@pidgin.im>
parents:
10419
diff
changeset
|
57 | * Set the message for the given saved status. |
|
7277ae4229e9
[gaim-migrate @ 11671]
Mark Doliner <markdoliner@pidgin.im>
parents:
10419
diff
changeset
|
58 | * |
|
7277ae4229e9
[gaim-migrate @ 11671]
Mark Doliner <markdoliner@pidgin.im>
parents:
10419
diff
changeset
|
59 | * @param status The saved status. |
|
7277ae4229e9
[gaim-migrate @ 11671]
Mark Doliner <markdoliner@pidgin.im>
parents:
10419
diff
changeset
|
60 | * @param message The message, or NULL if you want to unset the |
|
7277ae4229e9
[gaim-migrate @ 11671]
Mark Doliner <markdoliner@pidgin.im>
parents:
10419
diff
changeset
|
61 | * message for this status. |
|
7277ae4229e9
[gaim-migrate @ 11671]
Mark Doliner <markdoliner@pidgin.im>
parents:
10419
diff
changeset
|
62 | */ |
|
7277ae4229e9
[gaim-migrate @ 11671]
Mark Doliner <markdoliner@pidgin.im>
parents:
10419
diff
changeset
|
63 | void gaim_savedstatus_set_message(GaimSavedStatus *status, |
|
7277ae4229e9
[gaim-migrate @ 11671]
Mark Doliner <markdoliner@pidgin.im>
parents:
10419
diff
changeset
|
64 | const char *message); |
|
7277ae4229e9
[gaim-migrate @ 11671]
Mark Doliner <markdoliner@pidgin.im>
parents:
10419
diff
changeset
|
65 | |
|
7277ae4229e9
[gaim-migrate @ 11671]
Mark Doliner <markdoliner@pidgin.im>
parents:
10419
diff
changeset
|
66 | /** |
| 10418 | 67 | * Delete a saved status. This removes the saved status from the list |
| 68 | * of saved statuses, and writes the revised list to status.xml. | |
| 69 | * | |
| 70 | * @param title The title of the saved status. | |
| 71 | * | |
| 72 | * @return TRUE if the status was successfully deleted. FALSE if the | |
| 73 | * status could not be deleted because no saved status exists | |
| 74 | * with the given title. | |
| 75 | */ | |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
76 | gboolean gaim_savedstatus_delete(const char *title); |
| 10418 | 77 | |
| 78 | /** | |
| 79 | * Returns all saved statuses. | |
| 80 | * | |
| 81 | * @return A list of saved statuses. | |
| 82 | */ | |
| 83 | const GList *gaim_savedstatuses_get_all(void); | |
| 84 | ||
| 85 | /** | |
| 86 | * Finds a saved status with the specified title. | |
| 87 | * | |
| 88 | * @param title The name of the saved status. | |
| 89 | * | |
| 90 | * @return The saved status if found, or NULL. | |
| 91 | */ | |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
92 | GaimSavedStatus *gaim_savedstatus_find(const char *title); |
| 10418 | 93 | |
| 94 | /** | |
| 95 | * Return the name of a given saved status. | |
| 96 | * | |
| 97 | * @param saved_status The saved status. | |
| 98 | * | |
| 99 | * @return The title. | |
| 100 | */ | |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
101 | const char *gaim_savedstatus_get_title(const GaimSavedStatus *saved_status); |
| 10418 | 102 | |
| 103 | /** | |
| 104 | * Return the name of a given saved status. | |
| 105 | * | |
| 106 | * @param saved_status The saved status. | |
| 107 | * | |
| 108 | * @return The name. | |
| 109 | */ | |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
110 | GaimStatusPrimitive gaim_savedstatus_get_type(const GaimSavedStatus *saved_status); |
| 10418 | 111 | |
| 112 | /** | |
| 113 | * Return the name of a given saved status. | |
| 114 | * | |
| 115 | * @param saved_status The saved status. | |
| 116 | * | |
| 117 | * @return The name. | |
| 118 | */ | |
|
10419
cb6b7316fdba
[gaim-migrate @ 11670]
Mark Doliner <markdoliner@pidgin.im>
parents:
10418
diff
changeset
|
119 | const char *gaim_savedstatus_get_message(const GaimSavedStatus *saved_status); |
| 10418 | 120 | |
| 121 | /** | |
| 122 | * Get the handle for the status subsystem. | |
| 123 | * | |
| 124 | * @return the handle to the status subsystem | |
| 125 | */ | |
| 126 | void *gaim_savedstatuses_get_handle(); | |
| 127 | ||
| 128 | /** | |
| 129 | * Initializes the status subsystem. | |
| 130 | */ | |
| 131 | void gaim_savedstatuses_init(void); | |
| 132 | ||
| 133 | /** | |
| 134 | * Uninitializes the status subsystem. | |
| 135 | */ | |
| 136 | void gaim_savedstatuses_uninit(void); | |
| 137 | ||
| 138 | /*@}*/ | |
| 139 | ||
| 140 | #endif /* _GAIM_SAVEDSTATUSES_H_ */ |