- Timestamp:
- Jun 10, 2003, 3:14:59 PM (22 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- f14a7ee
- Parents:
- 6e05655
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
owl.c
r6bf73ce rbd3f232 37 37 char *configfile, *tty, *perlout, **argvsave, buff[LINE], startupmsg[LINE]; 38 38 owl_filter *f; 39 owl_style *s; 39 40 time_t nexttime, now; 40 41 struct tm *today; … … 46 47 tty=NULL; 47 48 debug=0; 49 initialsubs=1; 48 50 if (argc>0) { 49 51 argv++; … … 128 130 129 131 130 /* owl init */132 /* owl global init */ 131 133 owl_global_init(&g); 132 134 if (debug) owl_global_set_debug_on(&g); … … 145 147 } 146 148 149 /* setup the built-in styles */ 150 s=owl_malloc(sizeof(owl_style)); 151 owl_style_create_internal(s, "default", &owl_stylefunc_default); 152 owl_global_add_style(&g, s); 153 154 s=owl_malloc(sizeof(owl_style)); 155 owl_style_create_internal(s, "basic", &owl_stylefunc_basic); 156 owl_global_add_style(&g, s); 157 147 158 /* setup the default filters */ 148 159 /* the personal filter will need to change again when AIM chat's are 149 160 * included. Also, there should be an %aimme% */ 150 f= malloc(sizeof(owl_filter));161 f=owl_malloc(sizeof(owl_filter)); 151 162 owl_filter_init_fromstring(f, "personal", "( type ^zephyr$ " 152 163 "and class ^message$ and instance ^personal$ " … … 155 166 owl_list_append_element(owl_global_get_filterlist(&g), f); 156 167 157 f= malloc(sizeof(owl_filter));168 f=owl_malloc(sizeof(owl_filter)); 158 169 owl_filter_init_fromstring(f, "trash", "class ^mail$ or opcode ^ping$ or type ^admin$ or class ^login$"); 159 170 owl_list_append_element(owl_global_get_filterlist(&g), f); 160 171 161 f= malloc(sizeof(owl_filter));172 f=owl_malloc(sizeof(owl_filter)); 162 173 owl_filter_init_fromstring(f, "ping", "opcode ^ping$"); 163 174 owl_list_append_element(owl_global_get_filterlist(&g), f); 164 175 165 f= malloc(sizeof(owl_filter));176 f=owl_malloc(sizeof(owl_filter)); 166 177 owl_filter_init_fromstring(f, "auto", "opcode ^auto$"); 167 178 owl_list_append_element(owl_global_get_filterlist(&g), f); 168 179 169 f= malloc(sizeof(owl_filter));180 f=owl_malloc(sizeof(owl_filter)); 170 181 owl_filter_init_fromstring(f, "login", "class ^login$"); 171 182 owl_list_append_element(owl_global_get_filterlist(&g), f); 172 183 173 f= malloc(sizeof(owl_filter));184 f=owl_malloc(sizeof(owl_filter)); 174 185 owl_filter_init_fromstring(f, "reply-lockout", "class ^noc or class ^mail$"); 175 186 owl_list_append_element(owl_global_get_filterlist(&g), f); 176 187 177 f= malloc(sizeof(owl_filter));188 f=owl_malloc(sizeof(owl_filter)); 178 189 owl_filter_init_fromstring(f, "out", "direction ^out$"); 179 190 owl_list_append_element(owl_global_get_filterlist(&g), f); 180 191 181 f= malloc(sizeof(owl_filter));192 f=owl_malloc(sizeof(owl_filter)); 182 193 owl_filter_init_fromstring(f, "aim", "type ^aim$"); 183 194 owl_list_append_element(owl_global_get_filterlist(&g), f); 184 195 185 f= malloc(sizeof(owl_filter));196 f=owl_malloc(sizeof(owl_filter)); 186 197 owl_filter_init_fromstring(f, "zephyr", "type ^zephyr$"); 187 198 owl_list_append_element(owl_global_get_filterlist(&g), f); 188 199 189 f= malloc(sizeof(owl_filter));200 f=owl_malloc(sizeof(owl_filter)); 190 201 owl_filter_init_fromstring(f, "none", "false"); 191 202 owl_list_append_element(owl_global_get_filterlist(&g), f); 192 203 193 f= malloc(sizeof(owl_filter));204 f=owl_malloc(sizeof(owl_filter)); 194 205 owl_filter_init_fromstring(f, "all", "true"); 195 206 owl_list_append_element(owl_global_get_filterlist(&g), f); … … 211 222 printf("\nError parsing configfile\n"); 212 223 exit(1); 224 } 225 226 /* if the config defaults a formatting function, add 'perl' as a style */ 227 if (owl_global_is_config_format(&g)) { 228 owl_function_debugmsg("Found perl formatting"); 229 s=owl_malloc(sizeof(owl_style)); 230 owl_style_create_perl(s, "perl", "owl::format_msg"); 231 owl_global_add_style(&g, s); 213 232 } 214 233 … … 228 247 229 248 /* load zephyr subs */ 230 ret=owl_zephyr_loadsubs(NULL); 231 if (ret!=-1) { 232 owl_global_add_userclue(&g, OWL_USERCLUE_CLASSES); 233 } 234 235 /* load login subs */ 236 if (owl_global_is_loginsubs(&g)) { 237 owl_function_loadloginsubs(NULL); 249 if (initialsubs) { 250 /* load normal subscriptions */ 251 ret=owl_zephyr_loadsubs(NULL); 252 if (ret!=-1) { 253 owl_global_add_userclue(&g, OWL_USERCLUE_CLASSES); 254 } 255 256 /* load login subscriptions */ 257 if (owl_global_is_loginsubs(&g)) { 258 owl_function_loadloginsubs(NULL); 259 } 238 260 } 239 261 … … 241 263 if (owl_global_is_startuplogin(&g)) { 242 264 owl_zephyr_zlog_in(); 265 } 266 267 /* set the default style, based on userclue and presence of a 268 * formatting function */ 269 if (owl_global_is_config_format(&g)) { 270 owl_global_set_style(&g, "perl"); 271 } else if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES)) { 272 owl_global_set_style(&g, "default"); 273 } else { 274 owl_global_set_style(&g, "basic"); 243 275 } 244 276 … … 275 307 276 308 followlast=owl_global_should_followlast(&g); 277 278 309 279 310 /* If we're logged into AIM, do AIM stuff */ … … 306 337 owl_message *m; 307 338 owl_filter *f; 308 339 340 /* grab the new message, stick it in 'm' */ 309 341 if (ZPending()) { 310 342 /* grab a zephyr notice, but if we've done 20 without stopping, … … 332 364 } 333 365 334 /* if it's on the puntlist then, nuke it and continue */366 /* if this message it on the puntlist, nuke it and continue */ 335 367 if (owl_global_message_is_puntable(&g, m)) { 336 368 owl_message_free(m); … … 343 375 344 376 /* let the config know the new message has been received */ 345 owl_config_getmsg(m, 0);377 owl_config_getmsg(m, "owl::receive_msg();"); 346 378 347 379 /* add it to any necessary views; right now there's only the current view */ … … 432 464 } 433 465 434 /* Handle all keypresses. 435 * If no key has been pressed sleep for a little bit, but 436 * otherwise do not, this lets input be grabbed as quickly 437 * as possbile */ 466 /* Handle all keypresses. If no key has been pressed, sleep for a 467 * little bit, but otherwise do not. This lets input be grabbed 468 * as quickly as possbile */ 438 469 j=wgetch(typwin); 439 470 if (j==ERR) { … … 471 502 void sig_handler(int sig) { 472 503 if (sig==SIGWINCH) { 473 /* we can't inturrupt a malloc here, so it just sets a flag */ 504 /* we can't inturrupt a malloc here, so it just sets a flag 505 * schedulding a resize for later 506 */ 474 507 owl_function_resize(); 475 508 }
Note: See TracChangeset
for help on using the changeset viewer.