annotate src/xmlnode.h @ 9584:fe35f55ee984

[gaim-migrate @ 10427] " When joining a jabber conference many jabber servers send a recap of the last 20 or so messages. If you have sounds enabled, this will result in either 20 sounds in row, or worse if mixing is available, a horrible mix of 20 overlapping sounds. These recap messages can be identifed be the presence of the "jabber:x:delay". This patch identifies delayed messages, passes that information through flags from the prpl to the core, and then on to the gui. Detailed changes: Add GAIM_MESSAGE_DELAYED to GaimMessageFlags to indicate a delayed message. Change gtkconv.c to not play sounds when either GAIM_MESSAGE_DELAYED or GAIM_MESSAGE_SYSTEM are set. Add GaimConvChatFlags, parallel to GaimConvImFlags, to pass flags from protocols to core. Currently contains two flags: GAIM_CONV_CHAT_WHISPER GAIM_CONV_CHAT_DELAYED Change fourth arg of serv_got_chat_in() from "int whisper" to "GaimConvChatFlags chatflags". Change jabber prpl to set delayed flag when the "jabber:x:delay" element is present. Change toc protocol since it uses the whisper flag." --Nathan Fredrickson Date: 2004-07-24 00:49 Sender: marv_sfAccepting Donations Logged In: YES user_id=790708 I'm not sure I like naming the flags "DELAYED". I mean that's okay inside jabber since that's what the jabber protocol refers to it as, but for the the GAIM_*_DELAYED flags, I think they should be named something else. I thought about NOSOUND, but I decided that was wrong, because the flag should say what kind of message it is, not what to do with it, that's up to the UI to decide. What's up with not playing sounds on GAIM_MESSAGE_SYSTEM? This sounds unrelated to this. Are there times when we want to play sounds on system messages? Date: 2004-07-24 09:13 Sender: noif Logged In: YES user_id=365548 I purposely did not use a name that implied what the UI should do with the flag. The only characteristic that makes these messages unique is that they've been stored in the server for some period of time and are not current. I'm open to a better flag name than "DELAYED"... I thought about "RECAP", but that seemed less generalized than "DELAYED". As for not playing sounds on GAIM_MESSAGE_SYSTEM, that can be removed if it's controversial. I think I slipped that in since the setting of the topic was still playing a sound every time you joined a jabber conference. I think we can change the flag name ourselves if something else is better. committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sat, 24 Jul 2004 15:18:32 +0000
parents b5dbd1839716
children dafebadcf8d2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
1 /**
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
2 * @file xmlnode.h XML DOM functions
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
3 *
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
4 * gaim
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
5 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7642
diff changeset
6 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7642
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7642
diff changeset
8 * source distribution.
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
9 *
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
13 * (at your option) any later version.
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
14 *
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
18 * GNU General Public License for more details.
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
19 *
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
23 */
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
24 #ifndef _GAIM_XMLNODE_H_
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
25 #define _GAIM_XMLNODE_H_
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
26
8135
8f4ce853e685 [gaim-migrate @ 8840]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
27 typedef enum _XMLNodeType
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
28 {
8135
8f4ce853e685 [gaim-migrate @ 8840]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
29 XMLNODE_TYPE_TAG,
8f4ce853e685 [gaim-migrate @ 8840]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
30 XMLNODE_TYPE_ATTRIB,
8f4ce853e685 [gaim-migrate @ 8840]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
31 XMLNODE_TYPE_DATA
8f4ce853e685 [gaim-migrate @ 8840]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
32 } XMLNodeType;
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
33
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
34 typedef struct _xmlnode
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
35 {
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
36 char *name;
8135
8f4ce853e685 [gaim-migrate @ 8840]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
37 XMLNodeType type;
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
38 char *data;
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
39 size_t data_sz;
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
40 struct _xmlnode *parent;
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
41 struct _xmlnode *child;
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
42 struct _xmlnode *next;
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
43 } xmlnode;
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
44
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
45 xmlnode *xmlnode_new(const char *name);
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
46 xmlnode *xmlnode_new_child(xmlnode *parent, const char *name);
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
47 void xmlnode_insert_child(xmlnode *parent, xmlnode *child);
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
48 xmlnode *xmlnode_get_child(xmlnode *parent, const char *name);
8262
b5dbd1839716 [gaim-migrate @ 8985]
Nathan Walp <nwalp@pidgin.im>
parents: 8167
diff changeset
49 xmlnode *xmlnode_get_child_with_namespace(xmlnode *parent, const char *name, const char *xmlns);
8135
8f4ce853e685 [gaim-migrate @ 8840]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
50 xmlnode *xmlnode_get_next_twin(xmlnode *node);
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
51 void xmlnode_insert_data(xmlnode *parent, const char *data, size_t size);
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
52 char *xmlnode_get_data(xmlnode *node);
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
53 void xmlnode_set_attrib(xmlnode *node, const char *attr, const char *value);
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
54 const char *xmlnode_get_attrib(xmlnode *node, const char *attr);
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
55 void xmlnode_remove_attrib(xmlnode *node, const char *attr);
7642
9008b5be4275 [gaim-migrate @ 8285]
Nathan Walp <nwalp@pidgin.im>
parents: 7131
diff changeset
56 char *xmlnode_to_str(xmlnode *node, int *len);
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
57 xmlnode *xmlnode_from_str(const char *str, size_t size);
8167
b55b70aef314 [gaim-migrate @ 8880]
Nathan Walp <nwalp@pidgin.im>
parents: 8135
diff changeset
58 xmlnode *xmlnode_copy(xmlnode *src);
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
59
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
60 void xmlnode_free(xmlnode *node);
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
61
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
62 #endif /* _GAIM_XMLNODE_H_ */