equal
deleted
inserted
replaced
18 |
18 |
19 #include <glib.h> |
19 #include <glib.h> |
20 #include <gmodule.h> |
20 #include <gmodule.h> |
21 #include <time.h> |
21 #include <time.h> |
22 #include <stdio.h> |
22 #include <stdio.h> |
|
23 #include <string.h> |
23 |
24 |
24 #include <mcabber/modules.h> |
25 #include <mcabber/modules.h> |
25 #include <mcabber/logprint.h> |
26 #include <mcabber/logprint.h> |
26 #include <mcabber/commands.h> |
27 #include <mcabber/commands.h> |
27 #include <mcabber/settings.h> |
28 #include <mcabber/settings.h> |
105 } |
106 } |
106 g_io_channel_unref (channel); |
107 g_io_channel_unref (channel); |
107 gchar *p = strrchr (line -> str, ')'); // end of command |
108 gchar *p = strrchr (line -> str, ')'); // end of command |
108 if (!p) { |
109 if (!p) { |
109 g_string_free (line, TRUE); |
110 g_string_free (line, TRUE); |
110 return "Missing ) in own stats" |
111 return "Missing ) in own stats"; |
111 } |
112 } |
112 while (*p && isspace (*p)) p++; |
113 while (*p && isspace (*p)) p++; |
113 while (*p && isalpha (*p)) p++; // state (%c) |
114 while (*p && isalpha (*p)) p++; // state (%c) |
114 while (*p && isspace (*p)) p++; |
115 while (*p && isspace (*p)) p++; |
115 while (*p && isdigit (*p)) p++; // ppid (this and next are %d) |
116 while (*p && isdigit (*p)) p++; // ppid (this and next are %d) |
182 |
183 |
183 g_string_free (line, TRUE); |
184 g_string_free (line, TRUE); |
184 |
185 |
185 guint hz = settings_opt_get_int ("uptime_hz"); |
186 guint hz = settings_opt_get_int ("uptime_hz"); |
186 if (!hz) |
187 if (!hz) |
187 hz = 250; |
188 hz = 100; |
188 starttime = kbtime + (mstime / hz); |
189 starttime = kbtime + (mstime / hz); |
189 } else { |
190 } else |
190 starttime = time (NULL); |
191 starttime = time (NULL); |
191 |
192 |
192 cmd_add ("uptime", "", 0, 0, do_uptime, NULL); |
193 cmd_add ("uptime", "", 0, 0, do_uptime, NULL); |
193 return NULL; |
194 return NULL; |
194 } |
195 } |