/[weechat]/weechat/src/common/weeconfig.c
ViewVC logotype

Diff of /weechat/src/common/weeconfig.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.65 by kolter, Thu Jun 30 19:22:01 2005 UTC revision 1.66 by flashcode, Sat Jul 9 15:30:51 2005 UTC
# Line 53  t_config_section config_sections[CONFIG_ Line 53  t_config_section config_sections[CONFIG_
53    { CONFIG_SECTION_IRC, "irc" },    { CONFIG_SECTION_IRC, "irc" },
54    { CONFIG_SECTION_DCC, "dcc" },    { CONFIG_SECTION_DCC, "dcc" },
55    { CONFIG_SECTION_PROXY, "proxy" },    { CONFIG_SECTION_PROXY, "proxy" },
56      { CONFIG_SECTION_KEYS, "keys" },
57    { CONFIG_SECTION_ALIAS, "alias" },    { CONFIG_SECTION_ALIAS, "alias" },
58    { CONFIG_SECTION_SERVER, "server" }    { CONFIG_SECTION_SERVER, "server" }
59  };  };
# Line 82  char *cfg_look_no_nickname; Line 83  char *cfg_look_no_nickname;
83  char *cfg_look_completor;  char *cfg_look_completor;
84  int cfg_look_infobar;  int cfg_look_infobar;
85  char *cfg_look_infobar_timestamp;  char *cfg_look_infobar_timestamp;
86    int cfg_look_infobar_seconds;
87  int cfg_look_infobar_delay_highlight;  int cfg_look_infobar_delay_highlight;
88    
89  t_config_option weechat_options_look[] =  t_config_option weechat_options_look[] =
# Line 170  t_config_option weechat_options_look[] = Line 172  t_config_option weechat_options_look[] =
172    { "look_infobar_timestamp", N_("timestamp for time in infobar"),    { "look_infobar_timestamp", N_("timestamp for time in infobar"),
173      N_("timestamp for time in infobar"),      N_("timestamp for time in infobar"),
174      OPTION_TYPE_STRING, 0, 0, 0,      OPTION_TYPE_STRING, 0, 0, 0,
175      "%B, %A %d %Y - %H:%M", NULL, NULL, &cfg_look_infobar_timestamp, config_change_buffer_content },      "%B, %A %d %Y", NULL, NULL, &cfg_look_infobar_timestamp, config_change_buffer_content },
176      { "look_infobar_seconds", N_("display seconds in infobar time"),
177        N_("display seconds in infobar time"),
178        OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
179        NULL, NULL, &cfg_look_infobar_seconds, NULL, config_change_buffer_content },
180    { "look_infobar_delay_highlight", N_("delay (in seconds) for highlight messages in infobar"),    { "look_infobar_delay_highlight", N_("delay (in seconds) for highlight messages in infobar"),
181      N_("delay (in seconds) for highlight messages in infobar "      N_("delay (in seconds) for highlight messages in infobar "
182      "(0 = disable highlight notifications in infobar)"),      "(0 = disable highlight notifications in infobar)"),
# Line 202  int cfg_col_status_data_other; Line 208  int cfg_col_status_data_other;
208  int cfg_col_status_more;  int cfg_col_status_more;
209  int cfg_col_status_bg;  int cfg_col_status_bg;
210  int cfg_col_infobar;  int cfg_col_infobar;
211    int cfg_col_infobar_delimiters;
212  int cfg_col_infobar_highlight;  int cfg_col_infobar_highlight;
213  int cfg_col_infobar_bg;  int cfg_col_infobar_bg;
214  int cfg_col_input;  int cfg_col_input;
# Line 320  t_config_option weechat_options_colors[] Line 327  t_config_option weechat_options_colors[]
327      N_("color for info bar text"),      N_("color for info bar text"),
328      OPTION_TYPE_COLOR, 0, 0, 0,      OPTION_TYPE_COLOR, 0, 0, 0,
329      "black", NULL, &cfg_col_infobar, NULL, &config_change_color },      "black", NULL, &cfg_col_infobar, NULL, &config_change_color },
330      { "col_infobar_delimiters", N_("color for infobar delimiters"),
331        N_("color for infobar delimiters"),
332        OPTION_TYPE_COLOR, 0, 0, 0,
333        "blue", NULL, &cfg_col_infobar_delimiters, NULL, &config_change_color },
334    { "col_infobar_highlight", N_("color for info bar highlight notification"),    { "col_infobar_highlight", N_("color for info bar highlight notification"),
335      N_("color for info bar highlight notification"),      N_("color for info bar highlight notification"),
336      OPTION_TYPE_COLOR, 0, 0, 0,      OPTION_TYPE_COLOR, 0, 0, 0,
# Line 727  t_config_option weechat_options_server[] Line 738  t_config_option weechat_options_server[]
738  t_config_option *weechat_options[CONFIG_NUMBER_SECTIONS] =  t_config_option *weechat_options[CONFIG_NUMBER_SECTIONS] =
739  { weechat_options_look, weechat_options_colors, weechat_options_history,  { weechat_options_look, weechat_options_colors, weechat_options_history,
740    weechat_options_log, weechat_options_irc, weechat_options_dcc,    weechat_options_log, weechat_options_irc, weechat_options_dcc,
741    weechat_options_proxy, NULL, weechat_options_server    weechat_options_proxy, NULL, NULL, weechat_options_server
742  };  };
743    
744    
# Line 763  config_get_section (t_config_option *ptr Line 774  config_get_section (t_config_option *ptr
774            
775      for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)      for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
776      {      {
777          if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))          if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
778                && (i != CONFIG_SECTION_SERVER))
779          {          {
780              for (j = 0; weechat_options[i][j].option_name; j++)              for (j = 0; weechat_options[i][j].option_name; j++)
781              {              {
# Line 1057  config_option_search (char *option_name) Line 1069  config_option_search (char *option_name)
1069            
1070      for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)      for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
1071      {      {
1072          if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))          if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
1073                && (i != CONFIG_SECTION_SERVER))
1074          {          {
1075              for (j = 0; weechat_options[i][j].option_name; j++)              for (j = 0; weechat_options[i][j].option_name; j++)
1076              {              {
# Line 1220  config_default_values () Line 1233  config_default_values ()
1233            
1234      for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)      for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
1235      {      {
1236          if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))          if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
1237                && (i != CONFIG_SECTION_SERVER))
1238          {          {
1239              for (j = 0; weechat_options[i][j].option_name; j++)              for (j = 0; weechat_options[i][j].option_name; j++)
1240              {              {
# Line 1375  config_read () Line 1389  config_read ()
1389                              if (pos2 != NULL)                              if (pos2 != NULL)
1390                                  pos2[0] = '\0';                                  pos2[0] = '\0';
1391                                                            
1392                              if (section == CONFIG_SECTION_ALIAS)                              if (section == CONFIG_SECTION_KEYS)
1393                              {                              {
1394                                    if (pos[0])
1395                                    {
1396                                        /* bind key (overwrite any binding with same key) */
1397                                        gui_key_bind (line, pos);
1398                                    }
1399                                    else
1400                                    {
1401                                        /* unbin key if no value given */
1402                                        gui_key_unbind (line);
1403                                    }
1404                                }
1405                                else if (section == CONFIG_SECTION_ALIAS)
1406                                {
1407                                    /* create new alias */
1408                                  if (alias_new (line, pos))                                  if (alias_new (line, pos))
1409                                      weelist_add (&index_commands, &last_index_command, line);                                      weelist_add (&index_commands, &last_index_command, line);
1410                              }                              }
# Line 1493  config_create_default () Line 1521  config_create_default ()
1521      time_t current_time;      time_t current_time;
1522      struct passwd *my_passwd;      struct passwd *my_passwd;
1523      char *realname, *pos;      char *realname, *pos;
1524        t_gui_key *ptr_key;
1525        char *expanded_name, *function_name;
1526    
1527      filename_length = strlen (weechat_home) + 64;      filename_length = strlen (weechat_home) + 64;
1528      filename =      filename =
# Line 1520  config_create_default () Line 1550  config_create_default ()
1550    
1551      for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)      for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
1552      {      {
1553          if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))          if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
1554                && (i != CONFIG_SECTION_SERVER))
1555          {          {
1556              fprintf (file, "\n[%s]\n", config_sections[i].section_name);              fprintf (file, "\n[%s]\n", config_sections[i].section_name);
1557              for (j = 0; weechat_options[i][j].option_name; j++)              for (j = 0; weechat_options[i][j].option_name; j++)
# Line 1550  config_create_default () Line 1581  config_create_default ()
1581          }          }
1582      }      }
1583            
1584        /* default key bindings */
1585        fprintf (file, "\n[keys]\n");
1586        for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
1587        {
1588            expanded_name = gui_key_get_expanded_name (ptr_key->key);
1589            if (ptr_key->function)
1590            {
1591                function_name = gui_key_function_search_by_ptr (ptr_key->function);
1592                if (function_name)
1593                    fprintf (file, "%s=%s\n",
1594                             (expanded_name) ? expanded_name : ptr_key->key,
1595                             function_name);
1596            }
1597            else
1598                fprintf (file, "%s=%s\n",
1599                         (expanded_name) ? expanded_name : ptr_key->key,
1600                         ptr_key->command);
1601            if (expanded_name)
1602                free (expanded_name);
1603        }
1604        
1605      /* default aliases */      /* default aliases */
1606      /* TODO: remove comments when missing commands will be ok */      /* TODO: remove comments when missing commands will be ok */
1607      fprintf (file, "\n[alias]\n");      fprintf (file, "\n[alias]\n");
# Line 1560  config_create_default () Line 1612  config_create_default ()
1612      fprintf (file, "C=clear\n");      fprintf (file, "C=clear\n");
1613      fprintf (file, "CL=clear\n");      fprintf (file, "CL=clear\n");
1614      fprintf (file, "CLOSE=buffer close\n");      fprintf (file, "CLOSE=buffer close\n");
1615      fprintf (file, "# CHAT=dcc chat\n");      fprintf (file, "CHAT=dcc chat\n");
1616      fprintf (file, "# GET=dcc get\n");      fprintf (file, "# GET=dcc get\n");
1617      fprintf (file, "# IG=ignore\n");      fprintf (file, "# IG=ignore\n");
1618      fprintf (file, "J=join\n");      fprintf (file, "J=join\n");
1619      fprintf (file, "K=kick\n");      fprintf (file, "K=kick\n");
1620      fprintf (file, "# KB=kickban\n");      fprintf (file, "KB=kickban\n");
1621      fprintf (file, "# KN=knockout\n");      fprintf (file, "# KN=knockout\n");
1622      fprintf (file, "LEAVE=part\n");      fprintf (file, "LEAVE=part\n");
1623      fprintf (file, "M=msg\n");      fprintf (file, "M=msg\n");
1624      fprintf (file, "# MUB=unban *\n");      fprintf (file, "MUB=unban *\n");
1625      fprintf (file, "N=names\n");      fprintf (file, "N=names\n");
1626      fprintf (file, "Q=query\n");      fprintf (file, "Q=query\n");
1627      fprintf (file, "T=topic\n");      fprintf (file, "T=topic\n");
1628      fprintf (file, "# UB=unban\n");      fprintf (file, "UB=unban\n");
1629      fprintf (file, "# UNIG=unignore\n");      fprintf (file, "# UNIG=unignore\n");
1630      fprintf (file, "W=who\n");      fprintf (file, "W=who\n");
1631      fprintf (file, "WC=part\n");      fprintf (file, "WC=part\n");
# Line 1658  config_write (char *config_name) Line 1710  config_write (char *config_name)
1710      time_t current_time;      time_t current_time;
1711      t_irc_server *ptr_server;      t_irc_server *ptr_server;
1712      t_weechat_alias *ptr_alias;      t_weechat_alias *ptr_alias;
1713        t_gui_key *ptr_key;
1714        char *expanded_name, *function_name;
1715    
1716      if (config_name)      if (config_name)
1717          filename = strdup (config_name);          filename = strdup (config_name);
# Line 1690  config_write (char *config_name) Line 1744  config_write (char *config_name)
1744    
1745      for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)      for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
1746      {      {
1747          if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))          if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
1748                && (i != CONFIG_SECTION_SERVER))
1749          {          {
1750              fprintf (file, "\n[%s]\n", config_sections[i].section_name);              fprintf (file, "\n[%s]\n", config_sections[i].section_name);
1751              for (j = 0; weechat_options[i][j].option_name; j++)              for (j = 0; weechat_options[i][j].option_name; j++)
# Line 1737  config_write (char *config_name) Line 1792  config_write (char *config_name)
1792          }          }
1793      }      }
1794            
1795        /* keys section */
1796        fprintf (file, "\n[keys]\n");
1797        for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
1798        {
1799            expanded_name = gui_key_get_expanded_name (ptr_key->key);
1800            if (ptr_key->function)
1801            {
1802                function_name = gui_key_function_search_by_ptr (ptr_key->function);
1803                if (function_name)
1804                    fprintf (file, "%s=%s\n",
1805                             (expanded_name) ? expanded_name : ptr_key->key,
1806                             function_name);
1807            }
1808            else
1809                fprintf (file, "%s=%s\n",
1810                         (expanded_name) ? expanded_name : ptr_key->key,
1811                         ptr_key->command);
1812            if (expanded_name)
1813                free (expanded_name);
1814        }
1815        
1816      /* alias section */      /* alias section */
1817      fprintf (file, "\n[alias]\n");      fprintf (file, "\n[alias]\n");
1818      for (ptr_alias = weechat_alias; ptr_alias;      for (ptr_alias = weechat_alias; ptr_alias;

Legend:
Removed from v.1.65  
changed lines
  Added in v.1.66

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26