comparison mcabber/src/screen.c @ 1333:e30a9d907105

Minor coding style adjustments
author Mikael Berthe <mikael@lilotux.net>
date Sat, 27 Oct 2007 11:10:18 +0200
parents 248e3f69dd9e
children 8e4e741787be
comparison
equal deleted inserted replaced
1332:bde2dc51c06b 1333:e30a9d907105
291 glob_muccol = type; 291 glob_muccol = type;
292 g_free(muclow); 292 g_free(muclow);
293 } 293 }
294 } 294 }
295 //Need to redraw? 295 //Need to redraw?
296 if (chatmode && ((buddy_search_jid(muc) == current_buddy) || !strcmp(muc, "*"))) 296 if (chatmode &&
297 ((buddy_search_jid(muc) == current_buddy) || !strcmp(muc, "*")))
297 scr_UpdateBuddyWindow(); 298 scr_UpdateBuddyWindow();
298 } 299 }
299 300
300 // Sets the color for nick in MUC 301 // Sets the color for nick in MUC
301 // If color is "-", the color is marked as automaticly assigned and is 302 // If color is "-", the color is marked as automaticly assigned and is
302 // not used if the room is in the "preset" mode 303 // not used if the room is in the "preset" mode
303 void scr_MucNickColor(const char *nick, const char *color) 304 void scr_MucNickColor(const char *nick, const char *color)
304 { 305 {
305 char *snick = g_strdup_printf("<%s>", nick), *mnick = g_strdup_printf("*%s ", nick); 306 char *snick, *mnick;
306 bool need_update = false; 307 bool need_update = false;
308 snick = g_strdup_printf("<%s>", nick);
309 mnick = g_strdup_printf("*%s ", nick);
307 if (!strcmp(color, "-")) {//Remove the color 310 if (!strcmp(color, "-")) {//Remove the color
308 if (nickcolors) { 311 if (nickcolors) {
309 nickcolor *nc = g_hash_table_lookup(nickcolors, snick); 312 nickcolor *nc = g_hash_table_lookup(nickcolors, snick);
310 if (nc) {//Have this nick already 313 if (nc) {//Have this nick already
311 nc->manual = false; 314 nc->manual = false;
1096 line->text[line->mucnicklen] = tmp; 1099 line->text[line->mucnicklen] = tmp;
1097 //Return the color back 1100 //Return the color back
1098 wattrset(win_entry->win, get_color(color)); 1101 wattrset(win_entry->win, get_color(color));
1099 } 1102 }
1100 1103
1101 wprintw(win_entry->win, "%s", line->text+line->mucnicklen); // Display text line 1104 // Display text line
1105 wprintw(win_entry->win, "%s", line->text+line->mucnicklen);
1102 wclrtoeol(win_entry->win); 1106 wclrtoeol(win_entry->win);
1103 1107
1104 // Return the color back 1108 // Return the color back
1105 if (color != COLOR_GENERAL) 1109 if (color != COLOR_GENERAL)
1106 wattrset(win_entry->win, get_color(COLOR_GENERAL)); 1110 wattrset(win_entry->win, get_color(COLOR_GENERAL));
1250 mucnicklen = strlen(nicklocaltmp); 1254 mucnicklen = strlen(nicklocaltmp);
1251 g_free(nicklocaltmp); 1255 g_free(nicklocaltmp);
1252 g_free(nicktmp); 1256 g_free(nicktmp);
1253 } 1257 }
1254 hbuf_add_line(&win_entry->bd->hbuf, text_locale, timestamp, prefix_flags, 1258 hbuf_add_line(&win_entry->bd->hbuf, text_locale, timestamp, prefix_flags,
1255 maxX - Roster_Width - getprefixwidth(), num_history_blocks, mucnicklen); 1259 maxX - Roster_Width - getprefixwidth(), num_history_blocks,
1260 mucnicklen);
1256 g_free(text_locale); 1261 g_free(text_locale);
1257 1262
1258 if (win_entry->bd->cleared) { 1263 if (win_entry->bd->cleared) {
1259 win_entry->bd->cleared = FALSE; 1264 win_entry->bd->cleared = FALSE;
1260 if (g_list_next(win_entry->bd->top)) 1265 if (g_list_next(win_entry->bd->top))
1934 { 1939 {
1935 GSList *roster_elt; 1940 GSList *roster_elt;
1936 roster_elt = roster_find(jidto, jidsearch, 1941 roster_elt = roster_find(jidto, jidsearch,
1937 ROSTER_TYPE_USER|ROSTER_TYPE_AGENT|ROSTER_TYPE_ROOM); 1942 ROSTER_TYPE_USER|ROSTER_TYPE_AGENT|ROSTER_TYPE_ROOM);
1938 1943
1939 scr_WriteMessage(jidto, text, 0, prefix|HBB_PREFIX_OUT|HBB_PREFIX_HLIGHT_OUT, 0); 1944 scr_WriteMessage(jidto, text,
1945 0, prefix|HBB_PREFIX_OUT|HBB_PREFIX_HLIGHT_OUT, 0);
1940 1946
1941 // Show jidto's buffer unless the buddy is not in the buddylist 1947 // Show jidto's buffer unless the buddy is not in the buddylist
1942 if (roster_elt && g_list_position(buddylist, roster_elt->data) != -1) 1948 if (roster_elt && g_list_position(buddylist, roster_elt->data) != -1)
1943 scr_ShowWindow(jidto, FALSE); 1949 scr_ShowWindow(jidto, FALSE);
1944 } 1950 }
2943 2949
2944 if (iswalnum(get_char(ptr_inputline)) && 2950 if (iswalnum(get_char(ptr_inputline)) &&
2945 !iswalnum(get_char(prev_char(ptr_inputline, inputLine)))) 2951 !iswalnum(get_char(prev_char(ptr_inputline, inputLine))))
2946 i--; 2952 i--;
2947 2953
2948 for( ; 2954 for ( ;
2949 ptr_inputline > inputLine; 2955 ptr_inputline > inputLine;
2950 ptr_inputline = prev_char(ptr_inputline, inputLine)) { 2956 ptr_inputline = prev_char(ptr_inputline, inputLine)) {
2951 if (!iswalnum(get_char(ptr_inputline))) { 2957 if (!iswalnum(get_char(ptr_inputline))) {
2952 if (i) { 2958 if (i) {
2953 ptr_inputline = next_char(ptr_inputline); 2959 ptr_inputline = next_char(ptr_inputline);
2954 break; 2960 break;
2955 } 2961 }