Yattm - unified GTK instant-messaging client logo
   [Generated for version 0.2-17 - Mon Jan 6 19:01:23 GMT+1 2003]

Home - Main Page - Data Structures - File List - Data Fields - Globals

trigger.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Data Structures

struct  _trigger

Typedefs

typedef _trigger trigger_struct

Enumerations

enum  trigger_type { NO_TYPE, USER_ONLINE, USER_OFFLINE, USER_ON_OFF_LINE }
enum  trigger_action {
  NO_ACTION, PLAY_SOUND, EXECUTE, DIALOG,
  POUNCE
}

Functions

void destroy_window ()
trigger_type get_trigger_type_num (char *text)
trigger_action get_trigger_action_num (char *text)
char * get_trigger_type_text (trigger_type type)
char * get_trigger_action_text (trigger_action action)
void show_trigger_window ()
void do_trigger_online (struct contact *con)
void do_trigger_offline (struct contact *con)
void do_trigger_action (struct contact *con, int trigger_type)


Typedef Documentation

typedef struct _trigger trigger_struct
 


Enumeration Type Documentation

enum trigger_action
 

Enumeration values:
NO_ACTION 
PLAY_SOUND 
EXECUTE 
DIALOG 
POUNCE 

Definition at line 34 of file trigger.h.

Referenced by get_trigger_action_num(), and get_trigger_action_text().

enum trigger_type
 

Enumeration values:
NO_TYPE 
USER_ONLINE 
USER_OFFLINE 
USER_ON_OFF_LINE 

Definition at line 33 of file trigger.h.

Referenced by do_trigger_action(), get_trigger_type_num(), and get_trigger_type_text().


Function Documentation

void destroy_window  
 

Definition at line 184 of file trigger.c.

References edit_trigger_window, and window_open.

Referenced by set_button_callback(), and show_trigger_window().

00185 {
00186   window_open = 0;
00187     
00188   gtk_widget_destroy(edit_trigger_window);
00189 }

void do_trigger_action struct contact   con,
int    trigger_type
 

Definition at line 87 of file trigger.c.

References _, _trigger::action, DBG_CORE, DIALOG, eb_debug, EXECUTE, NO_ACTION, _trigger::param, PLAY_SOUND, playsoundfile(), POUNCE, pounce_contact(), quick_message(), contact::trigger, trigger_type, _trigger::type, and USER_ONLINE.

Referenced by do_trigger_offline(), and do_trigger_online().

00088 {
00089     gchar param_string[2048];
00090     gchar *substr;
00091     gchar *basestr;
00092     
00093     strcpy(param_string, "\0");
00094     substr = NULL;
00095     
00096     if(con->trigger.action == NO_ACTION)
00097     return;
00098     if(strlen(con->trigger.param) >= (sizeof(param_string)/2))
00099     {
00100     eb_debug(DBG_CORE, "Trigger parameter too long - ignoring");
00101     return;
00102     }
00103     /* replace all occurrences of %t with "online" or "offline" */
00104     basestr = con->trigger.param;
00105     while ((substr = strstr(basestr, "%t")) != NULL)
00106     {
00107     if (substr[-1] == '%')
00108     {
00109         strncat(param_string, basestr, (size_t)(substr-basestr + 2));
00110         basestr=substr + 2;
00111         continue;
00112     }
00113     else
00114     {
00115         strncat(param_string, basestr, (size_t)(substr-basestr));
00116         strcat(param_string, ((trigger_type == USER_ONLINE) ?
00117                     _("online") : _("offline")));
00118         basestr = substr + 2;
00119         }
00120         if((strlen(param_string) + strlen(basestr) + 8) >
00121         sizeof(param_string))
00122         {
00123         eb_debug(DBG_CORE, "Result string may be too long, no substitution done\n");
00124         basestr = con->trigger.param;
00125         strcpy(param_string, "");
00126         break;
00127         }
00128     }
00129     /* copy remainder (or all if no subst done) */
00130     strcat(param_string, basestr);
00131     
00132     if(con->trigger.action == PLAY_SOUND)
00133     {
00134         playsoundfile(param_string);
00135     } else if(con->trigger.action == EXECUTE)
00136     {
00137         system(param_string);
00138     } else if(con->trigger.action == DIALOG)
00139     {
00140         quick_message(param_string);
00141     } else if(con->trigger.action == POUNCE && con->trigger.type == USER_ONLINE)
00142     {
00143         pounce_contact(con, param_string);
00144     }
00145 
00146 }

void do_trigger_offline struct contact   con
 

Definition at line 156 of file trigger.c.

References do_trigger_action(), contact::trigger, _trigger::type, USER_OFFLINE, and USER_ON_OFF_LINE.

Referenced by contact_logoff().

00157 {
00158     if((con->trigger.type == USER_OFFLINE) || (con->trigger.type == USER_ON_OFF_LINE))
00159     {
00160     do_trigger_action(con, USER_OFFLINE);
00161     }
00162 }

void do_trigger_online struct contact   con
 

Definition at line 148 of file trigger.c.

References do_trigger_action(), contact::trigger, _trigger::type, USER_ON_OFF_LINE, and USER_ONLINE.

Referenced by set_account_icon().

00149 {
00150     if ((con->trigger.type == USER_ONLINE) || (con->trigger.type == USER_ON_OFF_LINE))
00151     {
00152     do_trigger_action(con, USER_ONLINE);
00153     }
00154 }

trigger_action get_trigger_action_num char *    text
 

Referenced by yyparse().

char* get_trigger_action_text trigger_action    action
 

Definition at line 254 of file trigger.c.

References DIALOG, EXECUTE, PLAY_SOUND, POUNCE, and trigger_action.

00255 {
00256   if(action == PLAY_SOUND)
00257     return "PLAY_SOUND";
00258   else if(action == EXECUTE)
00259     return "EXECUTE";
00260   else if(action == DIALOG)
00261     return "DIALOG";
00262   else if(action == POUNCE) 
00263     return "POUNCE";
00264   else
00265     return "\0";
00266 }

trigger_type get_trigger_type_num char *    text
 

Referenced by yyparse().

char* get_trigger_type_text trigger_type    type
 

Definition at line 241 of file trigger.c.

References trigger_type, USER_OFFLINE, USER_ON_OFF_LINE, and USER_ONLINE.

Referenced by write_contact_list().

00242 {
00243   if(type == USER_ONLINE)
00244     return "USER_ONLINE";
00245   else if(type == USER_OFFLINE)
00246     return "USER_OFFLINE";
00247     else if(type == USER_ON_OFF_LINE)
00248     return "USER_ON_OFF_LINE";
00249     else
00250     return "\0";
00251         
00252 }

void show_trigger_window  
 

Referenced by edit_trigger_callback().


Contact: Andy Maloney     [Documentation generated by doxygen]