mcabber/src/screen.c
changeset 1295 33cb828282d5
parent 1294 86caabe72f3a
child 1296 7a0eaa53bd53
equal deleted inserted replaced
1294:86caabe72f3a 1295:33cb828282d5
   239 
   239 
   240   scr_LogPrint(LPRINT_LOGNORM, "ERROR: Wrong color: %s", name);
   240   scr_LogPrint(LPRINT_LOGNORM, "ERROR: Wrong color: %s", name);
   241   return -1;
   241   return -1;
   242 }
   242 }
   243 
   243 
       
   244 static int get_user_color(const char *color)
       
   245 {
       
   246   bool isbright = false;
       
   247   int cl;
       
   248   if (!strncmp(color, "bright", 6)) {
       
   249     isbright = true;
       
   250     color += 6;
       
   251   }
       
   252   cl = color_to_color_fg(FindColorInternal(color));
       
   253   if (cl < 0)
       
   254     return cl;
       
   255   if (isbright)
       
   256     cl += COLOR_BLACK_BOLD_FG - COLOR_BLACK_FG;
       
   257   return cl;
       
   258 }
       
   259 
   244 static void ensure_string_htable(GHashTable **table,
   260 static void ensure_string_htable(GHashTable **table,
   245     GDestroyNotify value_destroy_func)
   261     GDestroyNotify value_destroy_func)
   246 {
   262 {
   247   if (*table)//Have it already
   263   if (*table)//Have it already
   248     return;
   264     return;
   300     }
   316     }
   301     g_free(snick);//They are not saved in the hash
   317     g_free(snick);//They are not saved in the hash
   302     g_free(mnick);
   318     g_free(mnick);
   303     need_update = true;
   319     need_update = true;
   304   } else {
   320   } else {
   305     int cl = color_to_color_fg(FindColorInternal(color));
   321     int cl = get_user_color(color);
   306     if (cl < 0) {
   322     if (cl < 0) {
   307       scr_LogPrint(LPRINT_NORMAL, "No such color name");
   323       scr_LogPrint(LPRINT_NORMAL, "No such color name");
   308       g_free(snick);
   324       g_free(snick);
   309       g_free(mnick);
   325       g_free(mnick);
   310     } else {
   326     } else {
   371     } else {
   387     } else {
   372       scr_LogPrint(LPRINT_NORMAL, "No such color rule, nothing removed");
   388       scr_LogPrint(LPRINT_NORMAL, "No such color rule, nothing removed");
   373       return FALSE;
   389       return FALSE;
   374     }
   390     }
   375   } else {
   391   } else {
   376     bool isbright = false;
   392     int cl = get_user_color(color);
   377     int cl;
       
   378     if (!strncmp(color, "bright", 6)) {
       
   379       isbright = true;
       
   380       color += 6;
       
   381     }
       
   382     cl = color_to_color_fg(FindColorInternal(color));
       
   383     if (isbright)
       
   384       cl += COLOR_BLACK_BOLD_FG - COLOR_BLACK_FG;
       
   385     if (cl < 0 ) {
   393     if (cl < 0 ) {
   386       scr_LogPrint(LPRINT_NORMAL, "No such color name");
   394       scr_LogPrint(LPRINT_NORMAL, "No such color name");
   387       return FALSE;
   395       return FALSE;
   388     }
   396     }
   389     if (found) {
   397     if (found) {