Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/settings.c @ 294:871e53769084
Allow one status message per Jabber status
Messages can be defined with the following options:
message (overrides any of the others),
message_avail,
message_free,
message_dnd,
message_notavail,
message_away
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 09 Jul 2005 12:44:57 +0100 |
parents | d0295e735768 |
children | eb994ee40029 33b8e801ffa6 |
comparison
equal
deleted
inserted
replaced
293:d0295e735768 | 294:871e53769084 |
---|---|
187 gchar asciikey[16]; | 187 gchar asciikey[16]; |
188 g_snprintf(asciikey, 15, "%d", key); | 188 g_snprintf(asciikey, 15, "%d", key); |
189 return settings_get(SETTINGS_TYPE_BINDING, asciikey); | 189 return settings_get(SETTINGS_TYPE_BINDING, asciikey); |
190 } | 190 } |
191 | 191 |
192 // settings_get_status_msg(status) | |
193 // Return a string with the current status message: | |
194 // - if there is a user-defined message ("message" option), | |
195 // return this message | |
196 // - if there is a user-defined message for the given status (and no | |
197 // generic user message), it is returned | |
198 // - if no user-defined message is found, return the mcabber default msg | |
199 // - if there is no default (offline, invisible), return an empty string | |
200 const gchar *settings_get_status_msg(enum imstatus status) | |
201 { | |
202 const gchar *rstatus = settings_opt_get("message"); | |
203 | |
204 if (rstatus) return rstatus; | |
205 | |
206 switch(status) { | |
207 case available: | |
208 if ((rstatus = settings_opt_get("message_avail")) == NULL) | |
209 rstatus = MSG_AVAIL; | |
210 break; | |
211 | |
212 case freeforchat: | |
213 if ((rstatus = settings_opt_get("message_free")) == NULL) | |
214 rstatus = MSG_FREE; | |
215 break; | |
216 | |
217 case dontdisturb: | |
218 if ((rstatus = settings_opt_get("message_dnd")) == NULL) | |
219 rstatus = MSG_DND; | |
220 break; | |
221 | |
222 case notavail: | |
223 if ((rstatus = settings_opt_get("message_notavail")) == NULL) | |
224 rstatus = MSG_NOTAVAIL; | |
225 break; | |
226 | |
227 case away: | |
228 if ((rstatus = settings_opt_get("message_away")) == NULL) | |
229 rstatus = MSG_AWAY; | |
230 break; | |
231 | |
232 default: | |
233 rstatus = ""; | |
234 } | |
235 return rstatus; | |
236 } |