]> git.0d.be Git - empathy.git/commitdiff
Because we like whales
authorXavier Claessens <xclaesse@gmail.com>
Fri, 9 Sep 2011 10:29:35 +0000 (12:29 +0200)
committerXavier Claessens <xclaesse@gmail.com>
Fri, 9 Sep 2011 11:02:13 +0000 (13:02 +0200)
libempathy-gtk/empathy-chat.c

index 032dd246417dcc3e16b0b175a9201414f8b00296..b9313a9e3ba624e66b1211b443b76abaf62393c6 100644 (file)
@@ -1012,6 +1012,34 @@ chat_command_whois (EmpathyChat *chat,
                whois_got_contact_cb, NULL, NULL, G_OBJECT (chat));
 }
 
+static void
+chat_command_whale (EmpathyChat *chat,
+                   GStrv        strv)
+{
+       EmpathyChatPriv *priv = GET_PRIV (chat);
+       TpMessage *message;
+
+       message = tp_client_message_new_text (TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL,
+               "\n\n\n"
+               "•_______________•");
+       empathy_tp_chat_send (priv->tp_chat, message);
+       g_object_unref (message);
+}
+
+static void
+chat_command_babywhale (EmpathyChat *chat,
+                       GStrv        strv)
+{
+       EmpathyChatPriv *priv = GET_PRIV (chat);
+       TpMessage *message;
+
+       message = tp_client_message_new_text (TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL,
+               "\n"
+               "•_____•");
+       empathy_tp_chat_send (priv->tp_chat, message);
+       g_object_unref (message);
+}
+
 static void chat_command_help (EmpathyChat *chat, GStrv strv);
 
 typedef void (*ChatCommandFunc) (EmpathyChat *chat, GStrv strv);
@@ -1066,6 +1094,9 @@ static ChatCommandItem commands[] = {
        {"help", 1, 2, chat_command_help, NULL,
         N_("/help [<command>]: show all supported commands. "
            "If <command> is defined, show its usage.")},
+
+       {"whale", 1, 1, chat_command_whale, NULL, NULL},
+       {"babywhale", 1, 1, chat_command_babywhale, NULL, NULL},
 };
 
 static void
@@ -1074,6 +1105,10 @@ chat_command_show_help (EmpathyChat     *chat,
 {
        gchar *str;
 
+       if (item->help == NULL) {
+               return;
+       }
+
        str = g_strdup_printf (_("Usage: %s"), _(item->help));
        empathy_chat_view_append_event (chat->view, str);
        g_free (str);
@@ -1094,8 +1129,11 @@ chat_command_help (EmpathyChat *chat,
                                        continue;
                                }
                        }
-                   empathy_chat_view_append_event (chat->view,
-                           _(commands[i].help));
+                       if (commands[i].help == NULL) {
+                               continue;
+                       }
+                       empathy_chat_view_append_event (chat->view,
+                               _(commands[i].help));
                }
                return;
        }
@@ -1107,6 +1145,9 @@ chat_command_help (EmpathyChat *chat,
                                        break;
                                }
                        }
+                       if (commands[i].help == NULL) {
+                               break;
+                       }
                        chat_command_show_help (chat, &commands[i]);
                        return;
                }