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

value_pair.h File Reference

#include <stdio.h>
#include "prefs.h"

Include dependency graph for value_pair.h:

Include dependency graph

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  _value_pair

Typedefs

typedef _value_pair value_pair

Functions

char * value_pair_get_value (GList *pairs, char *key)
void value_pair_print_values (GList *pairs, FILE *file, int indent)
void value_pair_free (GList *pairs)
GList * value_pair_update (GList *pairs, GList *new_list)
GList * value_pair_add (GList *list, char *key, char *value)
GList * value_pair_remove (GList *list, char *key)


Typedef Documentation

typedef struct _value_pair value_pair
 


Function Documentation

GList* value_pair_add GList *    list,
char *    key,
char *    value
 

Definition at line 67 of file value_pair.c.

References escape_string(), _value_pair::key, and _value_pair::value.

Referenced by eb_input_to_value_pair(), eb_read_prefs(), ok_callback(), refresh_service_contacts(), value_pair_update(), and write_module_prefs().

00068 {
00069     char * tmp = escape_string(value);
00070     value_pair * vp = g_new0(value_pair, 1);
00071     strcpy(vp->key, key);
00072     strcpy(vp->value,tmp);
00073     g_free(tmp);
00074     return g_list_append(list, vp);
00075 }

void value_pair_free GList *    pairs
 

Definition at line 39 of file value_pair.c.

Referenced by eb_read_prefs(), read_contacts(), refresh_service_contacts(), write_module_prefs(), and yyparse().

00040 {
00041     GList * node;
00042     for( node = pairs; node; node = node->next )
00043     {
00044         g_free(node->data);
00045     }
00046     g_list_free(pairs);
00047 }

char* value_pair_get_value GList *    pairs,
char *    key
 

Definition at line 27 of file value_pair.c.

References _value_pair::key, unescape_string(), and _value_pair::value.

Referenced by eb_nomodule_read_local_config(), eb_update_from_value_pair(), read_contacts(), save_account_info(), and yyparse().

00028 {
00029     GList * node;
00030     for( node = pairs; node; node=node->next)
00031     {
00032         value_pair * vp = node->data;
00033         if(!strcasecmp(key, vp->key))
00034             return unescape_string(vp->value);
00035     }
00036     return NULL;
00037 }

void value_pair_print_values GList *    pairs,
FILE *    file,
int    indent
 

Definition at line 49 of file value_pair.c.

References _value_pair::key, and _value_pair::value.

Referenced by ok_callback(), write_account_list(), and write_module_prefs().

00050 {
00051     GList * node;
00052     int i;
00053     
00054     for( node = pairs; node; node = node->next )
00055     {
00056         value_pair * vp = node->data;
00057 
00058         for( i = 0; i < indent; i++ )
00059         {
00060             fprintf( file, "\t" );
00061         }
00062 
00063         fprintf(file, "%s=\"%s\"\n", vp->key, vp->value);
00064     }
00065 }

GList* value_pair_remove GList *    list,
char *    key
 

Definition at line 77 of file value_pair.c.

References _value_pair::key.

Referenced by ok_callback(), value_pair_update(), and write_module_prefs().

00078 {
00079     GList * node, *new_list;
00080     void *ptr=NULL;
00081     for( node = pairs; node; node=node->next)
00082     {
00083         value_pair * vp = node->data;
00084         if(vp && !strcasecmp(key, vp->key)) {
00085             ptr=node->data;
00086             new_list= g_list_remove(pairs, node->data);
00087             g_free(ptr);
00088             return(new_list);
00089         }
00090     }
00091     return pairs;
00092 }

GList* value_pair_update GList *    pairs,
GList *    new_list
 

Definition at line 94 of file value_pair.c.

References _value_pair::key, _value_pair::value, value_pair_add(), and value_pair_remove().

Referenced by write_module_prefs().

00095 {
00096 
00097     GList * node;
00098     for( node = new_list; node; node=node->next)
00099     {
00100         value_pair * vp = node->data;
00101         pairs = value_pair_remove(pairs, vp->key);
00102         pairs = value_pair_add(pairs, vp->key, vp->value);
00103     }
00104     return(pairs);
00105 }


Contact: Andy Maloney     [Documentation generated by doxygen]