- Timestamp:
- 2015-05-28T04:04:54Z (10 years ago)
- Branches:
- master
- Children:
- 3d31618
- Parents:
- fe63ed3
- git-author:
- Artem Savkov <artem.savkov@…> (25-05-15 18:49:59)
- git-committer:
- dequis <dx@…> (28-05-15 04:04:54)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/presence.c
rfe63ed3 r24f113b 181 181 } 182 182 183 static char *choose_priority(struct im_connection *ic) 184 { 185 struct jabber_data *jd = ic->proto_data; 186 char *prio = set_getstr(&ic->acc->set, "priority"); 187 188 if (jd->away_state->code != NULL) { 189 int new_prio = (atoi(prio) - 5); 190 if (new_prio < 0) { 191 new_prio = 0; 192 } 193 return g_strdup_printf("%d", new_prio); 194 } 195 196 return g_strdup(prio); 197 } 198 183 199 /* Whenever presence information is updated, call this function to inform the 184 200 server. */ … … 189 205 GSList *l; 190 206 int st; 207 char *prio = choose_priority(ic); 191 208 192 209 node = jabber_make_packet("presence", NULL, NULL, NULL); 193 xt_add_child(node, xt_new_node("priority", set_getstr(&ic->acc->set, "priority"), NULL));210 xt_add_child(node, xt_new_node("priority", prio, NULL)); 194 211 if (jd->away_state) { 195 212 xt_add_child(node, xt_new_node("show", jd->away_state->code, NULL)); … … 222 239 223 240 xt_free_node(node); 241 g_free(prio); 224 242 return st; 225 243 }
Note: See TracChangeset
for help on using the changeset viewer.