Changes in functions.c [99ac28a:287c634]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
functions.c
r99ac28a r287c634 1223 1223 void G_GNUC_PRINTF(1, 2) owl_function_debugmsg(const char *fmt, ...) 1224 1224 { 1225 char *tmpbuff; 1225 1226 FILE *file; 1226 1227 time_t now; … … 1237 1238 now = time(NULL); 1238 1239 1239 fprintf(file, "[%d - %.24s - %lds]: ", 1240 (int) getpid(), ctime(&now), now - owl_global_get_starttime(&g)); 1240 tmpbuff = owl_util_time_to_timestr(localtime(&now)); 1241 fprintf(file, "[%d - %s - %lds]: ", 1242 (int) getpid(), tmpbuff, now - owl_global_get_starttime(&g)); 1243 g_free(tmpbuff); 1241 1244 vfprintf(file, fmt, ap); 1242 1245 putc('\n', file); … … 1430 1433 #ifdef HAVE_LIBZEPHYR 1431 1434 if (owl_message_is_direction_in(m)) { 1432 char *tmpbuff ;1435 char *tmpbuff, *tmpbuff2; 1433 1436 int i, fields; 1434 1437 … … 1476 1479 1477 1480 for (i = 0; i < fields; i++) { 1478 tmpbuff = owl_zephyr_get_field_as_utf8(n, i + 1); 1479 1480 g_strdelimit(tmpbuff, "\n", '~'); 1481 g_strdelimit(tmpbuff, "\r", '!'); 1482 1483 owl_fmtext_appendf_normal(&fm, " Field %i : %s\n", i + 1, tmpbuff); 1484 g_free(tmpbuff); 1481 tmpbuff = owl_zephyr_get_field_as_utf8(n, i + 1); 1482 tmpbuff2 = owl_text_indent(tmpbuff, 14, false); 1483 owl_fmtext_appendf_normal(&fm, " Field %i : %s\n", i + 1, tmpbuff2); 1484 g_free(tmpbuff2); 1485 g_free(tmpbuff); 1485 1486 } 1486 owl_fmtext_appendf_normal(&fm, " Default Fm: %s\n", n->z_default_format); 1487 tmpbuff = owl_text_indent(n->z_default_format, 14, false); 1488 owl_fmtext_appendf_normal(&fm, " Default Fm: %s\n", tmpbuff); 1489 g_free(tmpbuff); 1487 1490 } 1488 1491 … … 1761 1764 void owl_function_status(void) 1762 1765 { 1766 char *tmpbuff; 1763 1767 char buff[MAXPATHLEN+1]; 1764 1768 time_t start; … … 1788 1792 owl_fmtext_append_normal(&fm, "\n"); 1789 1793 1790 owl_fmtext_appendf_normal(&fm, " Startup Time: %s", ctime(&start)); 1794 tmpbuff = owl_util_time_to_timestr(localtime(&start)); 1795 owl_fmtext_appendf_normal(&fm, " Startup Time: %s\n", tmpbuff); 1796 g_free(tmpbuff); 1791 1797 1792 1798 up=owl_global_get_runtime(&g); … … 2126 2132 2127 2133 /* Create a new filter, or replace an existing one 2128 * with a new definition. 2134 * with a new definition. Returns true on success. 2129 2135 */ 2130 voidowl_function_create_filter(int argc, const char *const *argv)2136 bool owl_function_create_filter(int argc, const char *const *argv) 2131 2137 { 2132 2138 owl_filter *f; … … 2136 2142 if (argc < 2) { 2137 2143 owl_function_error("Wrong number of arguments to filter command"); 2138 return ;2144 return false; 2139 2145 } 2140 2146 … … 2146 2152 if (!strcmp(argv[1], "all")) { 2147 2153 owl_function_error("You may not change the 'all' filter."); 2148 return ;2154 return false; 2149 2155 } 2150 2156 … … 2154 2160 if (!f) { 2155 2161 owl_function_error("The filter '%s' does not exist.", argv[1]); 2156 return ;2162 return false; 2157 2163 } 2158 2164 if (owl_util_string_to_color(argv[3])==OWL_COLOR_INVALID) { 2159 2165 owl_function_error("The color '%s' is not available.", argv[3]); 2160 return ;2166 return false; 2161 2167 } 2162 2168 owl_filter_set_fgcolor(f, owl_util_string_to_color(argv[3])); 2163 2169 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 2164 return ;2170 return false; 2165 2171 } 2166 2172 if (argc==4 && !strcmp(argv[2], "-b")) { … … 2168 2174 if (!f) { 2169 2175 owl_function_error("The filter '%s' does not exist.", argv[1]); 2170 return ;2176 return false; 2171 2177 } 2172 2178 if (owl_util_string_to_color(argv[3])==OWL_COLOR_INVALID) { 2173 2179 owl_function_error("The color '%s' is not available.", argv[3]); 2174 return ;2180 return false; 2175 2181 } 2176 2182 owl_filter_set_bgcolor(f, owl_util_string_to_color(argv[3])); 2177 2183 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 2178 return ;2184 return true; 2179 2185 } 2180 2186 … … 2183 2189 if (f == NULL) { 2184 2190 owl_function_error("Invalid filter"); 2185 return ;2191 return false; 2186 2192 } 2187 2193 … … 2204 2210 } 2205 2211 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 2212 return true; 2206 2213 } 2207 2214 … … 2455 2462 /* if it already exists then go with it. This lets users override */ 2456 2463 if (owl_global_get_filter(&g, filtname)) { 2457 return (g_strdup(filtname));2464 return filtname; 2458 2465 } 2459 2466 … … 3409 3416 char *buff; 3410 3417 3411 now=time(NULL); 3412 date=g_strdup(ctime(&now)); 3413 date[strlen(date)-1]='\0'; 3418 now = time(NULL); 3419 date = owl_util_time_to_timestr(localtime(&now)); 3414 3420 3415 3421 buff = g_strdup_printf("%s %s", date, string);
Note: See TracChangeset
for help on using the changeset viewer.