void fe_userlist_insert (session *sess, struct User *newuser, int row, int sel) { GtkTreeModel *model = sess->res->user_model; GdkPixbuf *pix = get_user_icon (sess->server, newuser); GtkTreeIter iter; gboolean do_away = TRUE; if (prefs.away_timeout < 1 || !prefs.away_track) do_away = FALSE; gtk_list_store_insert_with_values (GTK_LIST_STORE (model), &iter, row, 0, pix, 1, newuser->nick, 2, newuser->hostname, 3, newuser, 4, (do_away) ? (newuser->away ? &colors[COL_AWAY] : NULL) : (NULL), -1); #if 0 if (prefs.hilitenotify && notify_isnotify (sess, newuser->nick)) { gtk_clist_set_foreground ((GtkCList *) sess->gui->user_clist, row, &colors[prefs.nu_color]); } #endif /* is it the front-most tab? */ if (gtk_tree_view_get_model (GTK_TREE_VIEW (sess->gui->user_tree)) == model) { if (sel) gtk_tree_selection_select_iter (gtk_tree_view_get_selection (GTK_TREE_VIEW (sess->gui->user_tree)), &iter); } }
void fe_userlist_insert (session *sess, struct User *newuser, int row, int sel) { GtkTreeModel *model = sess->res->user_model; GdkPixbuf *pix = get_user_icon (sess->server, newuser); GtkTreeIter iter; char *nick; int nick_color = 0; if (prefs.hex_away_track && newuser->away) nick_color = COL_AWAY; else if (prefs.hex_gui_ulist_color) nick_color = text_color_of(newuser->nick); nick = newuser->nick; if (!prefs.hex_gui_ulist_icons) { nick = malloc (strlen (newuser->nick) + 2); nick[0] = newuser->prefix[0]; if (!nick[0] || nick[0] == ' ') strcpy (nick, newuser->nick); else strcpy (nick + 1, newuser->nick); pix = NULL; } gtk_list_store_insert_with_values (GTK_LIST_STORE (model), &iter, row, COL_PIX, pix, COL_NICK, nick, COL_HOST, newuser->hostname, COL_USER, newuser, COL_GDKCOLOR, nick_color ? &colors[nick_color] : NULL, -1); if (!prefs.hex_gui_ulist_icons) { free (nick); } /* is it me? */ if (newuser->me && sess->gui->nick_box) { if (!sess->gui->is_tab || sess == current_tab) mg_set_access_icon (sess->gui, pix, sess->server->is_away); } #if 0 if (prefs.hilitenotify && notify_isnotify (sess, newuser->nick)) { gtk_clist_set_foreground ((GtkCList *) sess->gui->user_clist, row, &colors[prefs.nu_color]); } #endif /* is it the front-most tab? */ if (gtk_tree_view_get_model (GTK_TREE_VIEW (sess->gui->user_tree)) == model) { if (sel) gtk_tree_selection_select_iter (gtk_tree_view_get_selection (GTK_TREE_VIEW (sess->gui->user_tree)), &iter); } }