Fri, 20 Aug 2004 03:40:33 +0000
[gaim-migrate @ 10655]
after an utter failure to get comments on this since it was updated, and
thinking that the functionality is worth having, i present to you:
" This is a patch to blist.c and blist.h to modify the
GaimBuddy structure to add a field for flags. It also
adds a single flag GAIM_BUDDY_NO_SAVE, which can be
used to indicate that a particular buddy should not be
saved to file. This will be particularly useful for
prpls with dynamic group support (which I am working on
adding to Meanwhile), such as Oscar's recent buddies group.
I used a negative flag (NO_SAVE rather than SAVE)
because the default should be for saving to happen, and
I didn't want to have to initiate the buddy with a save
flag set. To counteract this, there is a macro called
GAIM_BUDDY_SHOULD_SAVE which checks for the absense of
the flag. Woo-hoo double negative!!
The beefy part of this patch also factors out the
deeply nested loops of the saving code into separate
functions.
This code also fixes a minor possible bug wherein when
saving only a particular account, a group could be
written containing empty contacts (due to checking for
the specific account only at the group and buddy levels)
Here's a version that places the flags field in the
BlistNode, and checks for it at each stage (group, chat,
contact, buddy). It didn't erase my buddy list when I tried
it, so that's nice at least." --Christopher (siege) O'Brien
committer: Luke Schierer <lschiere@pidgin.im>
| 7131 | 1 | /** |
| 2 | * @file xmlnode.h XML DOM functions | |
| 3 | * | |
| 4 | * gaim | |
| 5 | * | |
| 8046 | 6 | * Gaim is the legal property of its developers, whose names are too numerous |
| 7 | * to list here. Please refer to the COPYRIGHT file distributed with this | |
| 8 | * source distribution. | |
| 7131 | 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify | |
| 11 | * it under the terms of the GNU General Public License as published by | |
| 12 | * the Free Software Foundation; either version 2 of the License, or | |
| 13 | * (at your option) any later version. | |
| 14 | * | |
| 15 | * This program is distributed in the hope that it will be useful, | |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 | * GNU General Public License for more details. | |
| 19 | * | |
| 20 | * You should have received a copy of the GNU General Public License | |
| 21 | * along with this program; if not, write to the Free Software | |
| 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 23 | */ | |
| 24 | #ifndef _GAIM_XMLNODE_H_ | |
| 25 | #define _GAIM_XMLNODE_H_ | |
| 26 | ||
| 8135 | 27 | typedef enum _XMLNodeType |
| 7131 | 28 | { |
| 8135 | 29 | XMLNODE_TYPE_TAG, |
| 30 | XMLNODE_TYPE_ATTRIB, | |
| 31 | XMLNODE_TYPE_DATA | |
| 32 | } XMLNodeType; | |
| 7131 | 33 | |
| 34 | typedef struct _xmlnode | |
| 35 | { | |
| 36 | char *name; | |
| 8135 | 37 | XMLNodeType type; |
| 7131 | 38 | char *data; |
| 39 | size_t data_sz; | |
| 40 | struct _xmlnode *parent; | |
| 41 | struct _xmlnode *child; | |
| 42 | struct _xmlnode *next; | |
| 43 | } xmlnode; | |
| 44 | ||
| 45 | xmlnode *xmlnode_new(const char *name); | |
| 46 | xmlnode *xmlnode_new_child(xmlnode *parent, const char *name); | |
| 47 | void xmlnode_insert_child(xmlnode *parent, xmlnode *child); | |
| 48 | xmlnode *xmlnode_get_child(xmlnode *parent, const char *name); | |
| 8262 | 49 | xmlnode *xmlnode_get_child_with_namespace(xmlnode *parent, const char *name, const char *xmlns); |
| 8135 | 50 | xmlnode *xmlnode_get_next_twin(xmlnode *node); |
| 7131 | 51 | void xmlnode_insert_data(xmlnode *parent, const char *data, size_t size); |
| 52 | char *xmlnode_get_data(xmlnode *node); | |
| 53 | void xmlnode_set_attrib(xmlnode *node, const char *attr, const char *value); | |
| 54 | const char *xmlnode_get_attrib(xmlnode *node, const char *attr); | |
| 55 | void xmlnode_remove_attrib(xmlnode *node, const char *attr); | |
| 7642 | 56 | char *xmlnode_to_str(xmlnode *node, int *len); |
| 7131 | 57 | xmlnode *xmlnode_from_str(const char *str, size_t size); |
| 8167 | 58 | xmlnode *xmlnode_copy(xmlnode *src); |
| 7131 | 59 | |
| 60 | void xmlnode_free(xmlnode *node); | |
| 61 | ||
| 62 | #endif /* _GAIM_XMLNODE_H_ */ |