diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2015-05-03 18:47:19 +0200 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2015-05-03 18:47:19 +0200 | 
| commit | c43146d9308aea2025c0a0520c9e2d40758d9e8d (patch) | |
| tree | 78d6beb3ba68cf62d5cb7ba31d23cefca95dbdbe /protocols/twitter/twitter.c | |
| parent | cd607102faf6c6bfd1485a4a08d1ec70f9c22345 (diff) | |
Make replies to self work in Twitter.
Difficult because there's no bee_user struct pointing at the user themselves
so instead just fake one for very limited use.
Diffstat (limited to 'protocols/twitter/twitter.c')
| -rw-r--r-- | protocols/twitter/twitter.c | 16 | 
1 files changed, 12 insertions, 4 deletions
diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index 4dc1785e..421a0552 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -866,6 +866,8 @@ static gboolean twitter_parse_id(char *string, int base, guint64 *id)  	return TRUE;  } +bee_user_t twitter_log_local_user; +  /** Convert the given bitlbee tweet ID, bitlbee username, or twitter tweet ID   *  into a twitter tweet ID.   * @@ -896,10 +898,6 @@ static guint64 twitter_message_id_from_command_arg(struct im_connection *ic, cha  		if (twitter_parse_id(arg, 16, &id) && id < TWITTER_LOG_LENGTH) {  			bu = td->log[id].bu;  			id = td->log[id].id; -			/* Beware of dangling pointers! */ -			if (!g_slist_find(ic->bee->users, bu)) { -				bu = NULL; -			}  		} else if (twitter_parse_id(arg, 10, &id)) {  			/* Allow normal tweet IDs as well; not a very useful  			   feature but it's always been there. Just ignore @@ -910,6 +908,16 @@ static guint64 twitter_message_id_from_command_arg(struct im_connection *ic, cha  		}  	}  	if (bu_) { +		if (bu == &twitter_log_local_user) { +			/* HACK alert. There's no bee_user object for the local +			 * user so just fake one for the few cmds that need it. */ +			twitter_log_local_user.handle = td->user; +		} else { +			/* Beware of dangling pointers! */ +			if (!g_slist_find(ic->bee->users, bu)) { +				bu = NULL; +			} +		}  		*bu_ = bu;  	}  	return id;  | 
