1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Replaced NO_EOL_DATE with bitwise or

This commit is contained in:
James Booth 2014-07-16 22:20:23 +01:00
parent ddb6eee18d
commit a607b29d4a
4 changed files with 46 additions and 48 deletions

View File

@ -65,7 +65,7 @@ static void
_cons_show_word(const char * const word)
{
ProfWin *console = wins_get_console();
win_save_print(console, '-', NULL, NO_EOL_DATE, 0, "", word);
win_save_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", word);
if (wins_is_current(console)) {
win_update_virtual(console);
@ -255,8 +255,8 @@ _cons_show_login_success(ProfAccount *account)
const char *presence_str = string_from_resource_presence(presence);
int presence_colour = win_presence_colour(presence_str);
win_save_vprint(console, '-', NULL, NO_EOL_DATE, presence_colour, "", "%s", presence_str);
win_save_vprint(console, '-', NULL, NO_EOL_DATE, 0, "", " (priority %d)",
win_save_vprint(console, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", "%s", presence_str);
win_save_vprint(console, '-', NULL, NO_DATE | NO_EOL, 0, "", " (priority %d)",
accounts_get_priority_for_presence_type(account->name, presence));
win_save_print(console, '-', NULL, NO_DATE, 0, "", ".");
if (wins_is_current(console)) {
@ -338,19 +338,19 @@ _cons_show_caps(const char * const contact, Resource *resource)
if ((caps->category != NULL) || (caps->type != NULL) || (caps->name != NULL)) {
win_save_print(console, '-', NULL, NO_EOL, 0, "", "Identity: ");
if (caps->name != NULL) {
win_save_print(console, '-', NULL, NO_EOL_DATE, 0, "", caps->name);
win_save_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->name);
if ((caps->category != NULL) || (caps->type != NULL)) {
win_save_print(console, '-', NULL, NO_EOL_DATE, 0, "", " ");
win_save_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", " ");
}
}
if (caps->type != NULL) {
win_save_print(console, '-', NULL, NO_EOL_DATE, 0, "", caps->type);
win_save_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->type);
if (caps->category != NULL) {
win_save_print(console, '-', NULL, NO_EOL_DATE, 0, "", " ");
win_save_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", " ");
}
}
if (caps->category != NULL) {
win_save_print(console, '-', NULL, NO_EOL_DATE, 0, "", caps->category);
win_save_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->category);
}
win_save_print(console, '-', NULL, NO_DATE, 0, "", "");
}
@ -358,7 +358,7 @@ _cons_show_caps(const char * const contact, Resource *resource)
win_save_vprint(console, '-', NULL, NO_EOL, 0, "", "Software: %s", caps->software);
}
if (caps->software_version != NULL) {
win_save_vprint(console, '-', NULL, NO_EOL_DATE, 0, "", ", %s", caps->software_version);
win_save_vprint(console, '-', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->software_version);
}
if ((caps->software != NULL) || (caps->software_version != NULL)) {
win_save_print(console, '-', NULL, NO_DATE, 0, "", "");
@ -367,7 +367,7 @@ _cons_show_caps(const char * const contact, Resource *resource)
win_save_vprint(console, '-', NULL, NO_EOL, 0, "", "OS: %s", caps->os);
}
if (caps->os_version != NULL) {
win_save_vprint(console, '-', NULL, NO_EOL_DATE, 0, "", ", %s", caps->os_version);
win_save_vprint(console, '-', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->os_version);
}
if ((caps->os != NULL) || (caps->os_version != NULL)) {
win_save_print(console, '-', NULL, NO_DATE, 0, "", "");
@ -467,7 +467,7 @@ _cons_show_room_list(GSList *rooms, const char * const conference_node)
DiscoItem *room = rooms->data;
win_save_vprint(console, '-', NULL, NO_EOL, 0, "", " %s", room->jid);
if (room->name != NULL) {
win_save_vprint(console, '-', NULL, NO_EOL_DATE, 0, "", ", (%s)", room->name);
win_save_vprint(console, '-', NULL, NO_DATE | NO_EOL, 0, "", ", (%s)", room->name);
}
win_save_print(console, '-', NULL, NO_DATE, 0, "", "");
rooms = g_slist_next(rooms);
@ -504,19 +504,19 @@ _cons_show_bookmarks(const GList *list)
}
win_save_vprint(console, '-', NULL, NO_EOL, presence_colour, "", " %s", item->jid);
if (item->nick != NULL) {
win_save_vprint(console, '-', NULL, NO_EOL_DATE, presence_colour, "", "/%s", item->nick);
win_save_vprint(console, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", "/%s", item->nick);
}
if (item->autojoin) {
win_save_print(console, '-', NULL, NO_EOL_DATE, presence_colour, "", " (autojoin)");
win_save_print(console, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " (autojoin)");
}
if (item->password != NULL) {
win_save_print(console, '-', NULL, NO_EOL_DATE, presence_colour, "", " (private)");
win_save_print(console, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " (private)");
}
if (muc_room_is_active(item->jid)) {
ProfWin *roomwin = wins_get_by_recipient(item->jid);
if (roomwin != NULL) {
int num = wins_get_num(roomwin);
win_save_vprint(console, '-', NULL, NO_EOL_DATE, presence_colour, "", " (%d)", num);
win_save_vprint(console, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " (%d)", num);
}
}
win_save_print(console, '-', NULL, NO_DATE, 0, "", "");
@ -587,7 +587,7 @@ _cons_show_disco_items(GSList *items, const char * const jid)
DiscoItem *item = items->data;
win_save_vprint(console, '-', NULL, NO_EOL, 0, "", " %s", item->jid);
if (item->name != NULL) {
win_save_vprint(console, '-', NULL, NO_EOL_DATE, 0, "", ", (%s)", item->name);
win_save_vprint(console, '-', NULL, NO_DATE | NO_EOL, 0, "", ", (%s)", item->name);
}
win_save_vprint(console, '-', NULL, NO_DATE, 0, "", "");
items = g_slist_next(items);
@ -799,7 +799,7 @@ _cons_show_account(ProfAccount *account)
win_save_vprint(console, '-', NULL, NO_EOL, presence_colour, "", " %s (%d), %s", resource->name, resource->priority, resource_presence);
if (resource->status != NULL) {
win_save_vprint(console, '-', NULL, NO_EOL_DATE, presence_colour, "", ", \"%s\"", resource->status);
win_save_vprint(console, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", resource->status);
}
win_save_vprint(console, '-', NULL, NO_DATE, 0, "", "");
@ -810,19 +810,19 @@ _cons_show_account(ProfAccount *account)
if ((caps->category != NULL) || (caps->type != NULL) || (caps->name != NULL)) {
win_save_print(console, '-', NULL, NO_EOL, 0, "", " Identity: ");
if (caps->name != NULL) {
win_save_print(console, '-', NULL, NO_EOL_DATE, 0, "", caps->name);
win_save_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->name);
if ((caps->category != NULL) || (caps->type != NULL)) {
win_save_print(console, '-', NULL, NO_EOL_DATE, 0, "", " ");
win_save_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", " ");
}
}
if (caps->type != NULL) {
win_save_print(console, '-', NULL, NO_EOL_DATE, 0, "", caps->type);
win_save_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->type);
if (caps->category != NULL) {
win_save_print(console, '-', NULL, NO_EOL_DATE, 0, "", " ");
win_save_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", " ");
}
}
if (caps->category != NULL) {
win_save_print(console, '-', NULL, NO_EOL_DATE, 0, "", caps->category);
win_save_print(console, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->category);
}
win_save_print(console, '-', NULL, NO_DATE, 0, "", "");
}
@ -830,7 +830,7 @@ _cons_show_account(ProfAccount *account)
win_save_vprint(console, '-', NULL, NO_EOL, 0, "", " Software: %s", caps->software);
}
if (caps->software_version != NULL) {
win_save_vprint(console, '-', NULL, NO_EOL_DATE, 0, "", ", %s", caps->software_version);
win_save_vprint(console, '-', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->software_version);
}
if ((caps->software != NULL) || (caps->software_version != NULL)) {
win_save_print(console, '-', NULL, NO_DATE, 0, "", "");
@ -839,7 +839,7 @@ _cons_show_account(ProfAccount *account)
win_save_vprint(console, '-', NULL, NO_EOL, 0, "", " OS: %s", caps->os);
}
if (caps->os_version != NULL) {
win_save_vprint(console, '-', NULL, NO_EOL_DATE, 0, "", ", %s", caps->os_version);
win_save_vprint(console, '-', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->os_version);
}
if ((caps->os != NULL) || (caps->os_version != NULL)) {
win_save_print(console, '-', NULL, NO_DATE, 0, "", "");

View File

@ -1378,7 +1378,7 @@ _ui_duck_result(const char * const result)
} else {
gchar *string = g_ucs4_to_utf8(&unichar, 1, NULL, NULL, NULL);
if (string != NULL) {
win_save_print(window, '-', NULL, NO_EOL_DATE, 0, "", string);
win_save_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", string);
g_free(string);
}
}
@ -1477,7 +1477,7 @@ _ui_room_roster(const char * const room, GList *roster, const char * const prese
if (presence == NULL) {
length++;
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "%d participants: ", length);
win_save_vprint(window, '!', NULL, NO_EOL_DATE, COLOUR_ONLINE, "", "%s, ", muc_get_room_nick(room));
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ONLINE, "", "%s, ", muc_get_room_nick(room));
} else {
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "%d %s: ", length, presence);
}
@ -1488,10 +1488,10 @@ _ui_room_roster(const char * const room, GList *roster, const char * const prese
const char *show = p_contact_presence(member);
int presence_colour = win_presence_colour(show);
win_save_vprint(window, '!', NULL, NO_EOL_DATE, COLOUR_ONLINE|presence_colour, "", "%s", nick);
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ONLINE|presence_colour, "", "%s", nick);
if (roster->next != NULL) {
win_save_print(window, '!', NULL, NO_EOL_DATE, COLOUR_ONLINE, "", ", ");
win_save_print(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ONLINE, "", ", ");
}
roster = g_list_next(roster);

View File

@ -126,7 +126,7 @@ win_show_contact(ProfWin *window, PContact contact)
win_save_print(window, '-', NULL, NO_EOL, presence_colour, "", barejid);
}
win_save_vprint(window, '-', NULL, NO_EOL_DATE, presence_colour, "", " is %s", presence);
win_save_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", presence);
if (last_activity != NULL) {
GDateTime *now = g_date_time_new_now_local();
@ -139,15 +139,15 @@ win_show_contact(ProfWin *window, PContact contact)
int seconds = span / G_TIME_SPAN_SECOND;
if (hours > 0) {
win_save_vprint(window, '-', NULL, NO_EOL_DATE, presence_colour, "", ", idle %dh%dm%ds", hours, minutes, seconds);
win_save_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", idle %dh%dm%ds", hours, minutes, seconds);
}
else {
win_save_vprint(window, '-', NULL, NO_EOL_DATE, presence_colour, "", ", idle %dm%ds", minutes, seconds);
win_save_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", idle %dm%ds", minutes, seconds);
}
}
if (status != NULL) {
win_save_vprint(window, '-', NULL, NO_EOL_DATE, presence_colour, "", ", \"%s\"", p_contact_status(contact));
win_save_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", p_contact_status(contact));
}
win_save_print(window, '-', NULL, NO_DATE, presence_colour, "", "");
@ -169,7 +169,7 @@ win_show_info(ProfWin *window, PContact contact)
win_save_print(window, '-', NULL, 0, 0, "", "");
win_save_print(window, '-', NULL, NO_EOL, presence_colour, "", barejid);
if (name != NULL) {
win_save_vprint(window, '-', NULL, NO_EOL_DATE, presence_colour, "", " (%s)", name);
win_save_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " (%s)", name);
}
win_save_print(window, '-', NULL, NO_DATE, 0, "", ":");
@ -215,7 +215,7 @@ win_show_info(ProfWin *window, PContact contact)
int presence_colour = win_presence_colour(resource_presence);
win_save_vprint(window, '-', NULL, NO_EOL, presence_colour, "", " %s (%d), %s", resource->name, resource->priority, resource_presence);
if (resource->status != NULL) {
win_save_vprint(window, '-', NULL, NO_EOL_DATE, presence_colour, "", ", \"%s\"", resource->status);
win_save_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", resource->status);
}
win_save_print(window, '-', NULL, NO_DATE, 0, "", "");
@ -226,19 +226,19 @@ win_show_info(ProfWin *window, PContact contact)
if ((caps->category != NULL) || (caps->type != NULL) || (caps->name != NULL)) {
win_save_print(window, '-', NULL, NO_EOL, 0, "", " Identity: ");
if (caps->name != NULL) {
win_save_print(window, '-', NULL, NO_EOL_DATE, 0, "", caps->name);
win_save_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->name);
if ((caps->category != NULL) || (caps->type != NULL)) {
win_save_print(window, '-', NULL, NO_EOL_DATE, 0, "", " ");
win_save_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", " ");
}
}
if (caps->type != NULL) {
win_save_print(window, '-', NULL, NO_EOL_DATE, 0, "", caps->type);
win_save_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->type);
if (caps->category != NULL) {
win_save_print(window, '-', NULL, NO_EOL_DATE, 0, "", " ");
win_save_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", " ");
}
}
if (caps->category != NULL) {
win_save_print(window, '-', NULL, NO_EOL_DATE, 0, "", caps->category);
win_save_print(window, '-', NULL, NO_DATE | NO_EOL, 0, "", caps->category);
}
win_save_print(window, '-', NULL, NO_DATE, 0, "", "");
}
@ -246,7 +246,7 @@ win_show_info(ProfWin *window, PContact contact)
win_save_vprint(window, '-', NULL, NO_EOL, 0, "", " Software: %s", caps->software);
}
if (caps->software_version != NULL) {
win_save_vprint(window, '-', NULL, NO_EOL_DATE, 0, "", ", %s", caps->software_version);
win_save_vprint(window, '-', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->software_version);
}
if ((caps->software != NULL) || (caps->software_version != NULL)) {
win_save_print(window, '-', NULL, NO_DATE, 0, "", "");
@ -255,7 +255,7 @@ win_show_info(ProfWin *window, PContact contact)
win_save_vprint(window, '-', NULL, NO_EOL, 0, "", " OS: %s", caps->os);
}
if (caps->os_version != NULL) {
win_save_vprint(window, '-', NULL, NO_EOL_DATE, 0, "", ", %s", caps->os_version);
win_save_vprint(window, '-', NULL, NO_DATE | NO_EOL, 0, "", ", %s", caps->os_version);
}
if ((caps->os != NULL) || (caps->os_version != NULL)) {
win_save_print(window, '-', NULL, NO_DATE, 0, "", "");
@ -287,9 +287,9 @@ win_show_status_string(ProfWin *window, const char * const from,
win_save_vprint(window, '-', NULL, NO_EOL, presence_colour, "", "%s %s", pre, from);
if (show != NULL)
win_save_vprint(window, '-', NULL, NO_EOL_DATE, presence_colour, "", " is %s", show);
win_save_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", show);
else
win_save_vprint(window, '-', NULL, NO_EOL_DATE, presence_colour, "", " is %s", default_show);
win_save_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", " is %s", default_show);
if (last_activity != NULL) {
GDateTime *now = g_date_time_new_now_local();
@ -302,15 +302,15 @@ win_show_status_string(ProfWin *window, const char * const from,
int seconds = span / G_TIME_SPAN_SECOND;
if (hours > 0) {
win_save_vprint(window, '-', NULL, NO_EOL_DATE, presence_colour, "", ", idle %dh%dm%ds", hours, minutes, seconds);
win_save_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", idle %dh%dm%ds", hours, minutes, seconds);
}
else {
win_save_vprint(window, '-', NULL, NO_EOL_DATE, presence_colour, "", ", idle %dm%ds", minutes, seconds);
win_save_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", idle %dm%ds", minutes, seconds);
}
}
if (status != NULL)
win_save_vprint(window, '-', NULL, NO_EOL_DATE, presence_colour, "", ", \"%s\"", status);
win_save_vprint(window, '-', NULL, NO_DATE | NO_EOL, presence_colour, "", ", \"%s\"", status);
win_save_print(window, '-', NULL, NO_DATE, presence_colour, "", "");

View File

@ -39,8 +39,6 @@
#define NO_EOL 4
#define NO_COLOUR_FROM 8
#define NO_EOL_DATE 6
#define PAD_SIZE 1000
typedef enum {