Changeset 96dd574
- Timestamp:
- 2012-11-25T13:11:19Z (12 years ago)
- Branches:
- master
- Children:
- 631ec80
- Parents:
- 2cd8540
- Location:
- protocols/twitter
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/twitter/twitter.c
r2cd8540 r96dd574 4 4 * Simple module to facilitate twitter functionality. * 5 5 * * 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 7 * Copyright 2010-2012 Wilmer van der Gaast <wilmer@gaast.net> * 8 8 * * … … 30 30 #include "url.h" 31 31 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 41 32 GSList *twitter_connections = NULL; 42 43 33 /** 44 34 * Main loop function … … 245 235 return TRUE; 246 236 247 imcb_error(ic, "Maximum message length exceeded: %d > %d", len, max);237 twitter_log(ic, "Maximum message length exceeded: %d > %d", len, max); 248 238 249 239 return FALSE; … … 561 551 twitter_status_destroy(ic, id); 562 552 } else 563 twitter_ msg(ic, "Could not undo last action");553 twitter_log(ic, "Could not undo last action"); 564 554 565 555 g_free(cmds); … … 570 560 twitter_favourite_tweet(ic, id); 571 561 } else { 572 twitter_ msg(ic, "Please provide a message ID or username.");562 twitter_log(ic, "Please provide a message ID or username."); 573 563 } 574 564 g_free(cmds); … … 607 597 twitter_status_retweet(ic, id); 608 598 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 " 610 600 "post any statuses recently", cmd[1]); 611 601 … … 638 628 639 629 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 " 641 631 "post any statuses recently", cmd[1]); 642 632 g_free(cmds); … … 684 674 g_free(cmds); 685 675 } 676 677 void 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 686 695 687 696 void twitter_initmodule() -
protocols/twitter/twitter.h
r2cd8540 r96dd574 4 4 * Simple module to facilitate twitter functionality. * 5 5 * * 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> * 7 8 * * 8 9 * This library is free software; you can redistribute it and/or * … … 35 36 typedef enum 36 37 { 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, 38 42 TWITTER_DOING_TIMELINE = 0x10000, 39 TWITTER_GOT_TIMELINE = 0x20000,40 TWITTER_GOT_MENTIONS = 0x40000,43 TWITTER_GOT_TIMELINE = 0x20000, 44 TWITTER_GOT_MENTIONS = 0x40000, 41 45 } twitter_flags_t; 42 46 … … 100 104 char *twitter_parse_error( struct http_request *req ); 101 105 106 void twitter_log(struct im_connection *ic, char *format, ... ); 107 102 108 #endif //_TWITTER_H -
protocols/twitter/twitter_lib.c
r2cd8540 r96dd574 220 220 // It didn't go well, output the error and return. 221 221 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)); 224 224 225 225 if (logging_in)
Note: See TracChangeset
for help on using the changeset viewer.