Changeset 0d8a9bb0
- Timestamp:
- 2015-11-15T23:19:13Z (9 years ago)
- Branches:
- master
- Children:
- 80c2f3c
- Parents:
- d6e2aa8
- git-author:
- dequis <dx@…> (15-11-15 22:10:19)
- git-committer:
- dequis <dx@…> (15-11-15 23:19:13)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
irc_send.c
rd6e2aa8 r0d8a9bb0 248 248 } 249 249 250 /* msg1 and msg2 are output parameters. If msg2 is non-null, msg1 is guaranteed to be non-null too. 251 The idea is to defer the formatting of "$msg1 ($msg2)" to later calls to avoid a g_strdup_printf() here. */ 252 static void get_status_message(bee_user_t *bu, char **msg1, char **msg2) 253 { 254 *msg1 = NULL; 255 *msg2 = NULL; 256 257 if (!(bu->flags & BEE_USER_ONLINE)) { 258 *msg1 = "User is offline"; 259 260 } else if ((bu->status && *bu->status) || 261 (bu->status_msg && *bu->status_msg)) { 262 263 if (bu->status && bu->status_msg) { 264 *msg1 = bu->status; 265 *msg2 = bu->status_msg; 266 } else { 267 *msg1 = bu->status ? : bu->status_msg; 268 } 269 } 270 271 if (*msg1 && !**msg1) { 272 *msg1 = (bu->flags & BEE_USER_AWAY) ? "Away" : NULL; 273 } 274 } 275 250 276 void irc_send_whois(irc_user_t *iu) 251 277 { … … 257 283 if (iu->bu) { 258 284 bee_user_t *bu = iu->bu; 285 char *msg1, *msg2; 286 int num; 259 287 260 288 irc_send_num(irc, 312, "%s %s.%s :%s network", iu->nick, bu->ic->acc->user, … … 262 290 bu->ic->acc->prpl->name); 263 291 264 if ((bu->status && *bu->status) || 265 (bu->status_msg && *bu->status_msg)) { 266 int num = bu->flags & BEE_USER_AWAY ? 301 : 320; 267 268 if (bu->status && bu->status_msg) { 269 irc_send_num(irc, num, "%s :%s (%s)", iu->nick, bu->status, bu->status_msg); 270 } else { 271 irc_send_num(irc, num, "%s :%s", iu->nick, bu->status ? : bu->status_msg); 272 } 273 } else if (!(bu->flags & BEE_USER_ONLINE)) { 274 irc_send_num(irc, 301, "%s :%s", iu->nick, "User is offline"); 292 num = (bu->flags & BEE_USER_AWAY || !(bu->flags & BEE_USER_ONLINE)) ? 301 : 320; 293 294 get_status_message(bu, &msg1, &msg2); 295 296 if (msg1 && msg2) { 297 irc_send_num(irc, num, "%s :%s (%s)", iu->nick, msg1, msg2); 298 } else if (msg1) { 299 irc_send_num(irc, num, "%s :%s", iu->nick, msg1); 275 300 } 276 301
Note: See TracChangeset
for help on using the changeset viewer.