source: context.c @ 75e3879

barnowl_perlaimdebianowlrelease-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since 75e3879 was ecd5dc5, checked in by James M. Kretchmar <kretch@mit.edu>, 18 years ago
M-p is bound to 'view personal' by default loadsubs and loadloginsubs only print messages if in interactive mode added the 'alert_filter' variable, defaults to 'none'. added the 'alert_action' variable, which is an owl command that will be executed when new messages arive that match the alert_filter added the 'term' command which takes the 'raise' and 'deiconify' options. It assumes xterm for now.
  • Property mode set to 100644
File size: 1.9 KB
Line 
1#include <string.h>
2#include "owl.h"
3
4static const char fileIdent[] = "$Id$";
5
6#define SET_ACTIVE(ctx, new) ctx->mode = ((ctx->mode)&~OWL_CTX_ACTIVE_BITS)|new
7#define SET_MODE(ctx, new) ctx->mode = ((ctx->mode)&~OWL_CTX_MODE_BITS)|new
8
9int owl_context_init(owl_context *ctx) {
10  ctx->mode = OWL_CTX_STARTUP;
11  ctx->data = NULL;
12  return 0;
13}
14
15
16/* returns whether test matches the current context */
17int owl_context_matches(owl_context *ctx, int test) {
18  /*owl_function_debugmsg(", current: 0x%04x test: 0x%04x\n", ctx->mode, test);*/
19  if ((((ctx->mode&OWL_CTX_MODE_BITS) & test)
20       || !(test&OWL_CTX_MODE_BITS))
21      && 
22      (((ctx->mode&OWL_CTX_ACTIVE_BITS) & test) 
23       || !(test&OWL_CTX_ACTIVE_BITS))) {
24    return 1;
25  } else {
26    return 0;
27  }
28}
29
30void *owl_context_get_data(owl_context *ctx) {
31  return ctx->data;
32}
33
34int owl_context_get_mode(owl_context *ctx) {
35  return ctx->mode & OWL_CTX_MODE_BITS;
36}
37
38int owl_context_get_active(owl_context *ctx) {
39  return ctx->mode & OWL_CTX_ACTIVE_BITS;
40}
41
42int owl_context_is_startup(owl_context *ctx) {
43  return (ctx->mode & OWL_CTX_STARTUP)?1:0;
44}
45
46int owl_context_is_interactive(owl_context *ctx) {
47  return(ctx->mode & OWL_CTX_INTERACTIVE)?1:0;
48}
49
50void owl_context_set_startup(owl_context *ctx) {
51  SET_MODE(ctx, OWL_CTX_STARTUP);
52}
53
54void owl_context_set_readconfig(owl_context *ctx) {
55  SET_MODE(ctx, OWL_CTX_READCONFIG);
56}
57
58void owl_context_set_interactive(owl_context *ctx) {
59  SET_MODE(ctx, OWL_CTX_INTERACTIVE);
60}
61
62void owl_context_set_popless(owl_context *ctx, owl_viewwin *vw) {
63  ctx->data = (void*)vw;
64  SET_ACTIVE(ctx, OWL_CTX_POPLESS);
65}
66
67void owl_context_set_recv(owl_context *ctx) {
68  SET_ACTIVE(ctx, OWL_CTX_RECV);
69}
70
71void owl_context_set_editmulti(owl_context *ctx, owl_editwin *ew) {
72  ctx->data = (void*)ew;
73  SET_ACTIVE(ctx, OWL_CTX_EDITMULTI);
74}
75
76void owl_context_set_editline(owl_context *ctx, owl_editwin *ew) {
77  ctx->data = (void*)ew;
78  SET_ACTIVE(ctx, OWL_CTX_EDITLINE);
79}
80
Note: See TracBrowser for help on using the repository browser.