Ejemplo n.º 1
0
void
weechat_aspell_speller_remove_unused_cb (void *data,
                                         struct t_hashtable *hashtable,
                                         const void *key, const void *value)
{
    struct t_hashtable *used_spellers;

    /* make C compiler happy */
    (void) value;

    used_spellers = (struct t_hashtable *)data;

    /* if speller is not in "used_spellers", remove it (not used any more) */
    if (!weechat_hashtable_has_key (used_spellers, key))
        weechat_hashtable_remove (hashtable, key);
}
Ejemplo n.º 2
0
void
irc_redirect_message_add (struct t_irc_redirect *redirect, const char *message,
                          const char *command)
{
    char *output2;

    /*
     * if command is not for output, then don't add message
     * (it is silently ignored)
     */
    if (redirect->cmd_filter
        && !weechat_hashtable_has_key (redirect->cmd_filter, command))
        return;

    /* add message to output */
    if (redirect->output)
    {
        redirect->output_size += strlen("\n") + strlen (message);
        output2 = realloc (redirect->output, redirect->output_size);
        if (!output2)
        {
            free (redirect->output);
            redirect->output = NULL;
            redirect->output_size = 0;
            return;
        }
        redirect->output = output2;
        strcat (redirect->output, "\n");
    }
    else
    {
        redirect->output_size = strlen (message) + 1;
        redirect->output = malloc (redirect->output_size);
        if (redirect->output)
            redirect->output[0] = '\0';
    }
    if (redirect->output)
        strcat (redirect->output, message);
}