Mercurial > pidgin
comparison src/protocols/jabber/message.c @ 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 | 933a19e3a6b3 |
children | 3f97624e7753 |
comparison
equal
deleted
inserted
replaced
9583:91c9e060111b | 9584:fe35f55ee984 |
---|---|
178 } | 178 } |
179 } | 179 } |
180 | 180 |
181 if(jm->xhtml || jm->body) { | 181 if(jm->xhtml || jm->body) { |
182 if(jid->resource) | 182 if(jid->resource) |
183 serv_got_chat_in(jm->js->gc, chat->id, jid->resource, 0, | 183 serv_got_chat_in(jm->js->gc, chat->id, jid->resource, |
184 jm->delayed ? GAIM_CONV_CHAT_DELAYED : 0, | |
184 jm->xhtml ? jm->xhtml : jm->body, jm->sent); | 185 jm->xhtml ? jm->xhtml : jm->body, jm->sent); |
185 else if(chat->muc) | 186 else if(chat->muc) |
186 gaim_conv_chat_write(GAIM_CONV_CHAT(chat->conv), "", | 187 gaim_conv_chat_write(GAIM_CONV_CHAT(chat->conv), "", |
187 jm->xhtml ? jm->xhtml : jm->body, | 188 jm->xhtml ? jm->xhtml : jm->body, |
188 GAIM_MESSAGE_SYSTEM, jm->sent); | 189 GAIM_MESSAGE_SYSTEM, jm->sent); |
241 return; | 242 return; |
242 | 243 |
243 jm = g_new0(JabberMessage, 1); | 244 jm = g_new0(JabberMessage, 1); |
244 jm->js = js; | 245 jm->js = js; |
245 jm->sent = time(NULL); | 246 jm->sent = time(NULL); |
247 jm->delayed = FALSE; | |
246 | 248 |
247 type = xmlnode_get_attrib(packet, "type"); | 249 type = xmlnode_get_attrib(packet, "type"); |
248 | 250 |
249 if(type) { | 251 if(type) { |
250 if(!strcmp(type, "normal")) | 252 if(!strcmp(type, "normal")) |
301 if(xmlns && !strcmp(xmlns, "jabber:x:event")) { | 303 if(xmlns && !strcmp(xmlns, "jabber:x:event")) { |
302 if(xmlnode_get_child(child, "composing")) | 304 if(xmlnode_get_child(child, "composing")) |
303 jm->events |= JABBER_MESSAGE_EVENT_COMPOSING; | 305 jm->events |= JABBER_MESSAGE_EVENT_COMPOSING; |
304 } else if(xmlns && !strcmp(xmlns, "jabber:x:delay")) { | 306 } else if(xmlns && !strcmp(xmlns, "jabber:x:delay")) { |
305 const char *timestamp = xmlnode_get_attrib(child, "stamp"); | 307 const char *timestamp = xmlnode_get_attrib(child, "stamp"); |
308 jm->delayed = TRUE; | |
306 if(timestamp) | 309 if(timestamp) |
307 jm->sent = gaim_str_to_time(timestamp, TRUE); | 310 jm->sent = gaim_str_to_time(timestamp, TRUE); |
308 } else if(xmlns && !strcmp(xmlns, "jabber:x:conference") && | 311 } else if(xmlns && !strcmp(xmlns, "jabber:x:conference") && |
309 jm->type != JABBER_MESSAGE_GROUPCHAT_INVITE) { | 312 jm->type != JABBER_MESSAGE_GROUPCHAT_INVITE) { |
310 const char *jid = xmlnode_get_attrib(child, "jid"); | 313 const char *jid = xmlnode_get_attrib(child, "jid"); |