diff options
author | Eion Robb <eion@robbmob.com> | 2015-06-27 01:15:20 +0300 |
---|---|---|
committer | Eion Robb <eion@robbmob.com> | 2015-06-27 01:15:20 +0300 |
commit | 9dcb0c112b94050603b6e46c19a6fa0c2ddd61d5 (patch) | |
tree | 046e4b2793c5b38966661340f2ae370f1624d1fe | |
parent | a6d7cb7e36248ced5a25f3873f14b21e3f17687f (diff) |
SkypeWeb : Don't unset the chat topic when using a blank /topic
-rw-r--r-- | skypeweb/libskypeweb.c | 25 | ||||
-rw-r--r-- | skypeweb/libskypeweb.h | 1 |
2 files changed, 25 insertions, 1 deletions
diff --git a/skypeweb/libskypeweb.c b/skypeweb/libskypeweb.c index 4e0c947..dfad301 100644 --- a/skypeweb/libskypeweb.c +++ b/skypeweb/libskypeweb.c @@ -441,13 +441,36 @@ static PurpleCmdRet skypeweb_cmd_topic(PurpleConversation *conv, const gchar *cmd, gchar **args, gchar **error, void *data)
{
PurpleConnection *pc = NULL;
+ PurpleChatConversation *chat;
int id = -1;
pc = purple_conversation_get_connection(conv);
- id = purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(conv));
+ chat = PURPLE_CHAT_CONVERSATION(conv);
+ id = purple_chat_conversation_get_id(chat);
if (pc == NULL || id == -1)
return PURPLE_CMD_RET_FAILED;
+
+ if (!args || !args[0]) {
+ gchar *buf;
+ const gchar *topic = purple_chat_conversation_get_topic(chat);
+
+ if (topic) {
+ gchar *tmp, *tmp2;
+ tmp = g_markup_escape_text(topic, -1);
+ tmp2 = purple_markup_linkify(tmp);
+ buf = g_strdup_printf(_("current topic is: %s"), tmp2);
+ g_free(tmp);
+ g_free(tmp2);
+ } else {
+ buf = g_strdup(_("No topic is set"));
+ }
+
+ purple_conv_chat_write(chat, NULL, buf, PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, time(NULL));
+
+ g_free(buf);
+ return PURPLE_CMD_RET_OK;
+ }
skypeweb_chat_set_topic(pc, id, args ? args[0] : NULL);
diff --git a/skypeweb/libskypeweb.h b/skypeweb/libskypeweb.h index 7d6d0df..0a613b4 100644 --- a/skypeweb/libskypeweb.h +++ b/skypeweb/libskypeweb.h @@ -127,6 +127,7 @@ #define purple_serv_got_joined_chat(pc, id, name) PURPLE_CONV_CHAT(serv_got_joined_chat(pc, id, name)) #define purple_serv_got_chat_invite serv_got_chat_invite #define purple_serv_got_chat_in serv_got_chat_in + #define purple_chat_conversation_get_topic purple_conv_chat_get_topic #define purple_chat_conversation_set_topic purple_conv_chat_set_topic #define purple_chat_conversation_find_user(chat, name) purple_conv_chat_cb_find(chat, name) #define purple_chat_conversation_add_user purple_conv_chat_add_user |