Changeset 96dd574 for protocols/twitter


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.

Location:
protocols/twitter
Files:
3 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()
  • protocols/twitter/twitter.h

    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>            *
     7*  Copyright 2010-2012 Wilmer van der Gaast <wilmer@gaast.net>              *
    78*                                                                           *
    89*  This library is free software; you can redistribute it and/or            *
     
    3536typedef enum
    3637{
    37         TWITTER_HAVE_FRIENDS = 1,
     38        TWITTER_HAVE_FRIENDS   = 0x00001,
     39        TWITTER_MODE_ONE       = 0x00002,
     40        TWITTER_MODE_MANY      = 0x00004,
     41        TWITTER_MODE_CHAT      = 0x00008,
    3842        TWITTER_DOING_TIMELINE = 0x10000,
    39         TWITTER_GOT_TIMELINE = 0x20000,
    40         TWITTER_GOT_MENTIONS = 0x40000,
     43        TWITTER_GOT_TIMELINE   = 0x20000,
     44        TWITTER_GOT_MENTIONS   = 0x40000,
    4145} twitter_flags_t;
    4246
     
    100104char *twitter_parse_error( struct http_request *req );
    101105
     106void twitter_log(struct im_connection *ic, char *format, ... );
     107
    102108#endif //_TWITTER_H
  • protocols/twitter/twitter_lib.c

    r2cd8540 r96dd574  
    220220                // It didn't go well, output the error and return.
    221221                if (!periodic || logging_in || ++td->http_fails >= 5)
    222                         imcb_error(ic, "Could not retrieve %s: %s",
    223                                    path, twitter_parse_error(req));
     222                        twitter_log(ic, "Error: Could not retrieve %s: %s",
     223                                    path, twitter_parse_error(req));
    224224               
    225225                if (logging_in)
Note: See TracChangeset for help on using the changeset viewer.