Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/commands.c @ 1162:39b20ea22ce9
/room names: add options --short, --quiet
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 17 Feb 2007 10:35:12 +0100 |
parents | c30c315dc447 |
children | 2913310a7be6 |
comparison
equal
deleted
inserted
replaced
1161:45d3b9dda43d | 1162:39b20ea22ce9 |
---|---|
1411 static void room_names(gpointer bud, char *arg) | 1411 static void room_names(gpointer bud, char *arg) |
1412 { | 1412 { |
1413 const char *bjid; | 1413 const char *bjid; |
1414 char *buffer; | 1414 char *buffer; |
1415 GSList *resources, *p_res; | 1415 GSList *resources, *p_res; |
1416 enum { style_normal = 0, style_short, style_quiet } style = 0; | |
1416 | 1417 |
1417 if (*arg) { | 1418 if (*arg) { |
1418 scr_LogPrint(LPRINT_NORMAL, "This action does not require a parameter."); | 1419 if (!strcasecmp(arg, "--short")) |
1419 return; | 1420 style = style_short; |
1421 else if (!strcasecmp(arg, "--quiet")) | |
1422 style = style_quiet; | |
1423 else { | |
1424 scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!"); | |
1425 return; | |
1426 } | |
1420 } | 1427 } |
1421 | 1428 |
1422 // Enter chat mode | 1429 // Enter chat mode |
1423 scr_set_chatmode(TRUE); | 1430 scr_set_chatmode(TRUE); |
1424 scr_ShowBuddyWindow(); | 1431 scr_ShowBuddyWindow(); |
1435 const char *rst_msg; | 1442 const char *rst_msg; |
1436 | 1443 |
1437 rstatus = buddy_getstatus(bud, p_res->data); | 1444 rstatus = buddy_getstatus(bud, p_res->data); |
1438 rst_msg = buddy_getstatusmsg(bud, p_res->data); | 1445 rst_msg = buddy_getstatusmsg(bud, p_res->data); |
1439 | 1446 |
1440 snprintf(buffer, 4095, "[%c] %s", imstatus2char[rstatus], | 1447 if (style == style_short) { |
1441 (char*)p_res->data); | 1448 snprintf(buffer, 4095, "[%c] %s%s%s", imstatus2char[rstatus], |
1442 scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO); | 1449 (char*)p_res->data, |
1443 if (rst_msg) { | 1450 rst_msg ? " -- " : "", rst_msg ? rst_msg : ""); |
1444 snprintf(buffer, 4095, "Status message: %s", rst_msg); | 1451 scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO); |
1445 scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_NONE); | 1452 } else { |
1453 // (Style "normal" or "quiet") | |
1454 snprintf(buffer, 4095, "[%c] %s", imstatus2char[rstatus], | |
1455 (char*)p_res->data); | |
1456 scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO); | |
1457 if (rst_msg && style == style_normal) { | |
1458 snprintf(buffer, 4095, "Status message: %s", rst_msg); | |
1459 scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_NONE); | |
1460 } | |
1446 } | 1461 } |
1447 g_free(p_res->data); | 1462 g_free(p_res->data); |
1448 } | 1463 } |
1449 g_slist_free(resources); | 1464 g_slist_free(resources); |
1450 g_free(buffer); | 1465 g_free(buffer); |