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

smileys.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  protocol_smiley_struct
struct  smiley_struct

Typedefs

typedef protocol_smiley_struct protocol_smiley
typedef smiley_struct smiley

Functions

void init_smileys (void)
gchar * eb_smilify (gchar *text, GList *protocol_smileys)
GList * eb_default_smileys (void)
GList * add_smiley (GList *list, char *name, gchar **data)
GList * add_protocol_smiley (GList *list, char *text, char *name)
GList * eb_smileys (void)
smileyget_smiley_by_name (char *name)

Variables

GList * smileys
int do_smiley


Typedef Documentation

typedef struct protocol_smiley_struct protocol_smiley
 

Definition at line 11 of file smileys.h.

typedef struct smiley_struct smiley
 

Definition at line 20 of file smileys.h.


Function Documentation

GList* add_protocol_smiley GList *    list,
char *    text,
char *    name
 

Definition at line 187 of file smileys.c.

References protocol_smiley_struct::name, and protocol_smiley_struct::text.

Referenced by init_smileys().

00188 {
00189   protocol_smiley * psmile;
00190 
00191   psmile=g_new0(protocol_smiley, 1);
00192   strcpy(psmile->text, text);
00193   strcpy(psmile->name, name);
00194   return g_list_append(list, psmile);
00195 }

GList* add_smiley GList *    list,
char *    name,
gchar **    data
 

Definition at line 197 of file smileys.c.

References smiley_struct::name, and smiley_struct::pixmap.

Referenced by init_smileys().

00198 {
00199   smiley * psmile;
00200 
00201   psmile=g_new0(smiley, 1);
00202   strcpy(psmile->name, name);
00203   psmile->pixmap=data;
00204   return g_list_append(list, psmile);
00205 }

GList* eb_default_smileys void   
 

Definition at line 182 of file smileys.c.

References default_smileys.

00183 {
00184   return default_smileys;
00185 }

GList* eb_smileys void   
 

Definition at line 46 of file smileys.c.

References _eb_smileys.

00047 {
00048   return _eb_smileys;
00049 }

gchar* eb_smilify gchar *    text,
GList *    protocol_smileys
 

Definition at line 112 of file smileys.c.

References protocol_smiley_struct::name, no_smileys, and protocol_smiley_struct::text.

Referenced by eb_chat_room_show_message(), eb_chat_window_display_remote_message(), and send_message().

00113 {
00114   int ipos=0;
00115   int found;
00116   int i;
00117   GList * l=protocol_smileys;
00118   GString * newstr;
00119   char * result;
00120 
00121   if(!do_smiley)
00122   {
00123       return text;
00124   }
00125 
00126   newstr=g_string_sized_new(2048);
00127 
00128   while(text[ipos]!='\0')
00129   {
00130     /* ignore anything in < > */
00131     if(text[ipos] == '<') {
00132       while(text[ipos] && text[ipos] != '>') {
00133         g_string_append_c(newstr, text[ipos++]);
00134       }
00135       if(text[ipos] == '>')
00136         g_string_append_c(newstr, text[ipos++]);
00137       else  /* text[ipos] is null */
00138         break;
00139     }
00140 
00141     /* ignore anything in the ignore list (http://, ftp://, etc.) */
00142     for(i=0; no_smileys[i]; i++) {
00143       int len = strlen(no_smileys[i]);
00144       if( !strncmp( text + ipos, no_smileys[i], len ) ) {
00145         g_string_append(newstr, no_smileys[i]);
00146     ipos += len;
00147       }
00148     }
00149 
00150     
00151     l=protocol_smileys;
00152 
00153     found=0;
00154 
00155     while(l!=NULL)
00156     {
00157       protocol_smiley * ps=(protocol_smiley *)l->data;
00158       if(!strncmp(text+ipos, ps->text, strlen(ps->text)))
00159       {
00160         g_string_append(newstr, "<smiley name=\"");
00161         g_string_append(newstr, ps->name);
00162     g_string_append(newstr, "\" alt=\"");
00163     g_string_append(newstr, ps->text);
00164         g_string_append(newstr, "\">");
00165         ipos += strlen(ps->text);
00166         found=1;
00167         break;
00168       }
00169       l=l->next;
00170     }
00171     if(!found) { g_string_append_c(newstr, text[ipos++]); }
00172   }
00173 
00174 
00175   free(text);
00176   result = newstr->str;
00177   g_string_free(newstr, FALSE);
00178 
00179   return result;
00180 }

smiley* get_smiley_by_name char *    name
 

Definition at line 207 of file smileys.c.

References smiley_struct::name, and smileys.

Referenced by show_smileys_callback().

00207                                          {
00208   smiley * psmile;
00209   GList * l = smileys;
00210   while(l != NULL) {
00211     psmile = (smiley *)(l->data);
00212     if(!strcmp(psmile->name,name)) 
00213        return psmile;
00214     l=g_list_next(l);
00215   }
00216   return NULL;
00217 }

void init_smileys void   
 

Definition at line 51 of file smileys.c.

References _eb_smileys, add_protocol_smiley(), add_smiley(), default_smileys, and smileys.

Referenced by main().

00052 {
00053   smileys=add_smiley(smileys, "smile", smile_xpm);
00054   smileys=add_smiley(smileys, "sad", sad_xpm);
00055   smileys=add_smiley(smileys, "wink", wink_xpm);
00056   smileys=add_smiley(smileys, "biglaugh", biglaugh_xpm);
00057   smileys=add_smiley(smileys, "laugh", laugh_xpm);
00058   smileys=add_smiley(smileys, "cry", cry_xpm);
00059   smileys=add_smiley(smileys, "tongue", tongue_xpm);
00060   smileys=add_smiley(smileys, "cooldude", cooldude_xpm);
00061   smileys=add_smiley(smileys, "note", note_xpm);
00062   smileys=add_smiley(smileys, "dude", dude_xpm);
00063   smileys=add_smiley(smileys, "worried", worried_xpm);
00064   smileys=add_smiley(smileys, "grin", grin_xpm);
00065   smileys=add_smiley(smileys, "confused", confused_xpm);
00066   smileys=add_smiley(smileys, "blank", blankface_xpm);
00067   smileys=add_smiley(smileys, "blush", blush_xpm);
00068   smileys=add_smiley(smileys, "oh", oh_xpm);
00069   smileys=add_smiley(smileys, "heyyy", heyyy_xpm);
00070   smileys=add_smiley(smileys, "lovey", lovey_xpm);
00071   smileys=add_smiley(smileys, "angry", angry_xpm);
00072   smileys=add_smiley(smileys, "wine", wine_xpm);
00073   smileys=add_smiley(smileys, "beer", beer_xpm);
00074 
00075   _eb_smileys = smileys;
00076 
00077   default_smileys=add_protocol_smiley(default_smileys, ":-)", "smile");
00078   default_smileys=add_protocol_smiley(default_smileys, ":)", "smile");
00079   default_smileys=add_protocol_smiley(default_smileys, "=)", "smile");
00080 
00081   default_smileys=add_protocol_smiley(default_smileys, ":-(", "sad");
00082   default_smileys=add_protocol_smiley(default_smileys, ":(", "sad");
00083 
00084   default_smileys=add_protocol_smiley(default_smileys, ";-)", "wink");
00085   default_smileys=add_protocol_smiley(default_smileys, ";)", "wink");
00086 
00087   default_smileys=add_protocol_smiley(default_smileys, ":-D", "biglaugh");
00088   default_smileys=add_protocol_smiley(default_smileys, ":D", "biglaugh");
00089 
00090   default_smileys=add_protocol_smiley(default_smileys, ":-P", "tongue");
00091   default_smileys=add_protocol_smiley(default_smileys, ":P", "tongue");
00092 
00093   default_smileys=add_protocol_smiley(default_smileys, ":-p", "tongue");
00094   default_smileys=add_protocol_smiley(default_smileys, ":p", "tongue");
00095 
00096   default_smileys=add_protocol_smiley(default_smileys, ":-S", "worried");
00097   default_smileys=add_protocol_smiley(default_smileys, ":S", "worried");
00098   default_smileys=add_protocol_smiley(default_smileys, ":-s", "worried");
00099   default_smileys=add_protocol_smiley(default_smileys, ":s", "worried");
00100 
00101   default_smileys=add_protocol_smiley(default_smileys, ":-/", "worried");
00102   default_smileys=add_protocol_smiley(default_smileys, ":/", "worried");
00103 
00104   default_smileys=add_protocol_smiley(default_smileys, ">:-O", "angry");
00105   default_smileys=add_protocol_smiley(default_smileys, ">:O", "angry");
00106   default_smileys=add_protocol_smiley(default_smileys, ">:-o", "angry");
00107   default_smileys=add_protocol_smiley(default_smileys, ">:o", "angry");
00108 
00109   default_smileys=add_protocol_smiley(default_smileys, ":'(", "cry");
00110 }


Variable Documentation

int do_smiley
 

Definition at line 45 of file smileys.h.

Referenced by build_chat_prefs(), cancel_chat_prefs(), eb_read_prefs(), and write_chat_prefs().

GList* smileys
 

Definition at line 25 of file smileys.h.

Referenced by get_smiley_by_name(), and init_smileys().


Contact: Andy Maloney     [Documentation generated by doxygen]