Ignore:
Timestamp:
2012-11-25T13:11:19Z (11 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
631ec80
Parents:
2cd8540
Message:

s/twitter_msg/twitter_log/ and use it in a few more places.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter.c

    r2cd8540 r96dd574  
    44*  Simple module to facilitate twitter functionality.                       *
    55*                                                                           *
    6 *  Copyright 2009 Geert Mulders <g.c.w.m.mulders@gmail.com>                 *
     6*  Copyright 2009-2010 Geert Mulders <g.c.w.m.mulders@gmail.com>            *
    77*  Copyright 2010-2012 Wilmer van der Gaast <wilmer@gaast.net>              *
    88*                                                                           *
     
    3030#include "url.h"
    3131
    32 #define twitter_msg( ic, fmt... ) \
    33         do {                                            \
    34                 struct twitter_data *td = ic->proto_data;   \
    35                 if( td->timeline_gc )                       \
    36                         imcb_chat_log( td->timeline_gc, fmt );  \
    37                 else                                        \
    38                         imcb_log( ic, fmt );                    \
    39         } while( 0 );
    40 
    4132GSList *twitter_connections = NULL;
    42 
    4333/**
    4434 * Main loop function
     
    245235                return TRUE;
    246236
    247         imcb_error(ic, "Maximum message length exceeded: %d > %d", len, max);
     237        twitter_log(ic, "Maximum message length exceeded: %d > %d", len, max);
    248238
    249239        return FALSE;
     
    561551                        twitter_status_destroy(ic, id);
    562552                } else
    563                         twitter_msg(ic, "Could not undo last action");
     553                        twitter_log(ic, "Could not undo last action");
    564554
    565555                g_free(cmds);
     
    570560                        twitter_favourite_tweet(ic, id);
    571561                } else {
    572                         twitter_msg(ic, "Please provide a message ID or username.");
     562                        twitter_log(ic, "Please provide a message ID or username.");
    573563                }
    574564                g_free(cmds);
     
    607597                        twitter_status_retweet(ic, id);
    608598                else
    609                         twitter_msg(ic, "User `%s' does not exist or didn't "
     599                        twitter_log(ic, "User `%s' does not exist or didn't "
    610600                                    "post any statuses recently", cmd[1]);
    611601
     
    638628
    639629                if (!id || !bu) {
    640                         twitter_msg(ic, "User `%s' does not exist or didn't "
     630                        twitter_log(ic, "User `%s' does not exist or didn't "
    641631                                    "post any statuses recently", cmd[1]);
    642632                        g_free(cmds);
     
    684674        g_free(cmds);
    685675}
     676
     677void twitter_log(struct im_connection *ic, char *format, ... )
     678{
     679        struct twitter_data *td = ic->proto_data;
     680        va_list params;
     681        char *text;
     682       
     683        va_start(params, format);
     684        text = g_strdup_vprintf(format, params);
     685        va_end(params);
     686       
     687        if (td->timeline_gc)
     688                imcb_chat_log(td->timeline_gc, "%s", text);
     689        else
     690                imcb_log(ic, "%s", text);
     691       
     692        g_free(text);
     693}
     694
    686695
    687696void twitter_initmodule()
Note: See TracChangeset for help on using the changeset viewer.