Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/chat.c @ 26817:3912f55a1633
propagate from branch 'im.pidgin.pidgin' (head fbb4fe5da444943eecc76bdcd6c8ba967790b6c8)
to branch 'im.pidgin.cpw.darkrain42.xmpp.bosh' (head 601bc627c9430320848361f0ed81c6c4c6ee53e0)
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Tue, 28 Apr 2009 18:43:57 +0000 |
parents | 06da00c70eae |
children | af2b87aa82ee |
comparison
equal
deleted
inserted
replaced
26743:de9816c970fe | 26817:3912f55a1633 |
---|---|
595 } | 595 } |
596 | 596 |
597 /* merge this with the function below when we get everyone on the same page wrt /commands */ | 597 /* merge this with the function below when we get everyone on the same page wrt /commands */ |
598 void jabber_chat_change_topic(JabberChat *chat, const char *topic) | 598 void jabber_chat_change_topic(JabberChat *chat, const char *topic) |
599 { | 599 { |
600 if(topic && *topic) { | 600 JabberMessage *jm; |
601 JabberMessage *jm; | 601 |
602 jm = g_new0(JabberMessage, 1); | 602 jm = g_new0(JabberMessage, 1); |
603 jm->js = chat->js; | 603 jm->js = chat->js; |
604 jm->type = JABBER_MESSAGE_GROUPCHAT; | 604 jm->type = JABBER_MESSAGE_GROUPCHAT; |
605 jm->to = g_strdup_printf("%s@%s", chat->room, chat->server); | |
606 | |
607 if (topic && *topic) | |
605 jm->subject = purple_markup_strip_html(topic); | 608 jm->subject = purple_markup_strip_html(topic); |
606 jm->to = g_strdup_printf("%s@%s", chat->room, chat->server); | 609 else |
607 jabber_message_send(jm); | 610 jm->subject = g_strdup(""); |
608 jabber_message_free(jm); | 611 |
609 } else { | 612 jabber_message_send(jm); |
610 const char *cur = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(chat->conv)); | 613 jabber_message_free(jm); |
611 char *buf, *tmp, *tmp2; | |
612 | |
613 if(cur) { | |
614 tmp = g_markup_escape_text(cur, -1); | |
615 tmp2 = purple_markup_linkify(tmp); | |
616 buf = g_strdup_printf(_("current topic is: %s"), tmp2); | |
617 g_free(tmp); | |
618 g_free(tmp2); | |
619 } else | |
620 buf = g_strdup(_("No topic is set")); | |
621 purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), "", buf, | |
622 PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, time(NULL)); | |
623 g_free(buf); | |
624 } | |
625 | |
626 } | 614 } |
627 | 615 |
628 void jabber_chat_set_topic(PurpleConnection *gc, int id, const char *topic) | 616 void jabber_chat_set_topic(PurpleConnection *gc, int id, const char *topic) |
629 { | 617 { |
630 JabberStream *js = gc->proto_data; | 618 JabberStream *js = purple_connection_get_protocol_data(gc); |
631 JabberChat *chat = jabber_chat_find_by_id(js, id); | 619 JabberChat *chat = jabber_chat_find_by_id(js, id); |
632 | 620 |
633 if(!chat) | 621 if(!chat) |
634 return; | 622 return; |
635 | 623 |