Index: doc/user-guide/commands.xml
===================================================================
--- doc/user-guide/commands.xml	(revision 70ec7ab33202b933a88e04122140a815a7d2081e)
+++ doc/user-guide/commands.xml	(revision 5ca141685d78cb372acd0e9aded36175cba957a3)
@@ -121,5 +121,5 @@
 			<description>
 				<para>
-					This commands deletes an account from your account list. You should signoff the account before deleting it.
+					This command deletes an account from your account list. You should signoff the account before deleting it.
 				</para>
 
@@ -853,4 +853,5 @@
 				<varlistentry><term>favourite &lt;screenname|#id&gt;</term><listitem><para>Favo<emphasis>u</emphasis>rite the given user's most recent tweet, or the given tweet ID.</para></listitem></varlistentry>
 				<varlistentry><term>post &lt;message&gt;</term><listitem><para>Post a tweet</para></listitem></varlistentry>
+				<varlistentry><term>url &lt;screenname|#id&gt;</term><listitem><para>Show URL for a tweet to open it in a browser (and see context)</para></listitem></varlistentry>
 			</variablelist>
 
Index: protocols/twitter/twitter.c
===================================================================
--- protocols/twitter/twitter.c	(revision 70ec7ab33202b933a88e04122140a815a7d2081e)
+++ protocols/twitter/twitter.c	(revision 5ca141685d78cb372acd0e9aded36175cba957a3)
@@ -867,4 +867,6 @@
 }
 
+bee_user_t twitter_log_local_user;
+
 /** Convert the given bitlbee tweet ID, bitlbee username, or twitter tweet ID
  *  into a twitter tweet ID.
@@ -897,8 +899,4 @@
 			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
@@ -911,4 +909,14 @@
 	}
 	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;
 	}
@@ -1003,4 +1011,17 @@
 		in_reply_to = id;
 		allow_post = TRUE;
+	} else if (g_strcasecmp(cmd[0], "url") == 0) {
+		id = twitter_message_id_from_command_arg(ic, cmd[1], &bu);
+		if (!id) {
+			twitter_log(ic, "Tweet `%s' does not exist", cmd[1]);
+		} else {
+			/* More common link is twitter.com/$UID/status/$ID (and that's
+			 * what this will 302 to) but can't generate that since for RTs,
+			 * bu here points at the retweeter while id contains the id of
+			 * the original message. */
+			twitter_log(ic, "https://twitter.com/statuses/%lld", id);
+		}
+		goto eof;
+
 	} else if (g_strcasecmp(cmd[0], "post") == 0) {
 		message += 5;
Index: protocols/twitter/twitter.h
===================================================================
--- protocols/twitter/twitter.h	(revision 70ec7ab33202b933a88e04122140a815a7d2081e)
+++ protocols/twitter/twitter.h	(revision 5ca141685d78cb372acd0e9aded36175cba957a3)
@@ -101,5 +101,7 @@
 struct twitter_log_data {
 	guint64 id;
-	struct bee_user *bu; /* DANGER: can be a dead pointer. Check it first. */
+	/* DANGER: bu can be a dead pointer. Check it first.
+	 * twitter_message_id_from_command_arg() will do this. */
+	struct bee_user *bu;
 };
 
@@ -110,4 +112,12 @@
  */
 extern GSList *twitter_connections;
+
+/**
+ * Evil hack: Fake bee_user which will always point at the local user.
+ * Sometimes used as a return value by twitter_message_id_from_command_arg.
+ * NOT thread safe but don't you dare to even think of ever making BitlBee
+ * threaded. :-)
+ */
+extern bee_user_t twitter_log_local_user;
 
 void twitter_login_finish(struct im_connection *ic);
Index: protocols/twitter/twitter_lib.c
===================================================================
--- protocols/twitter/twitter_lib.c	(revision 70ec7ab33202b933a88e04122140a815a7d2081e)
+++ protocols/twitter/twitter_lib.c	(revision 5ca141685d78cb372acd0e9aded36175cba957a3)
@@ -460,5 +460,5 @@
 #endif
 
-static char* expand_entities(char* text, const json_value *entities);
+static void expand_entities(char **text, const json_value *node);
 
 /**
@@ -473,5 +473,5 @@
 {
 	struct twitter_xml_status *txs;
-	const json_value *rt = NULL, *entities = NULL;
+	const json_value *rt = NULL;
 
 	if (node->type != json_object) {
@@ -501,6 +501,4 @@
 		} else if (strcmp("in_reply_to_status_id", k) == 0 && v->type == json_integer) {
 			txs->reply_to = v->u.integer;
-		} else if (strcmp("entities", k) == 0 && v->type == json_object) {
-			entities = v;
 		}
 	}
@@ -516,6 +514,6 @@
 			txs_free(rtxs);
 		}
-	} else if (entities) {
-		txs->text = expand_entities(txs->text, entities);
+	} else {
+		expand_entities(&txs->text, node);
 	}
 
@@ -534,5 +532,4 @@
 {
 	struct twitter_xml_status *txs;
-	const json_value *entities = NULL;
 
 	if (node->type != json_object) {
@@ -561,7 +558,5 @@
 	}
 
-	if (entities) {
-		txs->text = expand_entities(txs->text, entities);
-	}
+	expand_entities(&txs->text, node);
 
 	if (txs->text && txs->user && txs->id) {
@@ -573,6 +568,24 @@
 }
 
-static char* expand_entities(char* text, const json_value *entities)
-{
+static void expand_entities(char **text, const json_value *node)
+{
+	json_value *entities, *quoted;
+	char *quote_url = NULL, *quote_text = NULL;
+
+	if (!((entities = json_o_get(node, "entities")) && entities->type == json_object))
+		return;
+	if ((quoted = json_o_get(node, "quoted_status")) && quoted->type == json_object) {
+		/* New "retweets with comments" feature. Note that this info
+		 * seems to be included in the streaming API only! Grab the
+		 * full message and try to insert it when we run into the
+		 * Tweet entity. */
+		struct twitter_xml_status *txs = twitter_xt_get_status(quoted);
+		quote_text = g_strdup_printf("@%s: %s", txs->user->screen_name, txs->text);
+		quote_url = g_strdup_printf("%s/status/%" G_GUINT64_FORMAT, txs->user->screen_name, txs->id);
+		txs_free(txs);
+	} else {
+		quoted = NULL;
+	}
+
 	JSON_O_FOREACH(entities, k, v) {
 		int i;
@@ -586,4 +599,6 @@
 
 		for (i = 0; i < v->u.array.length; i++) {
+			const char *format = "%s%s <%s>%s";
+
 			if (v->u.array.values[i]->type != json_object) {
 				continue;
@@ -592,20 +607,25 @@
 			const char *kort = json_o_str(v->u.array.values[i], "url");
 			const char *disp = json_o_str(v->u.array.values[i], "display_url");
+			const char *full = json_o_str(v->u.array.values[i], "expanded_url");
 			char *pos, *new;
 
-			if (!kort || !disp || !(pos = strstr(text, kort))) {
+			if (!kort || !disp || !(pos = strstr(*text, kort))) {
 				continue;
 			}
+			if (quote_url && strstr(full, quote_url)) {
+				format = "%s<%s> [%s]%s";
+				disp = quote_text;
+			}
 
 			*pos = '\0';
-			new = g_strdup_printf("%s%s <%s>%s", text, kort,
+			new = g_strdup_printf(format, *text, kort,
 			                      disp, pos + strlen(kort));
 
-			g_free(text);
-			text = new;
-		}
-	}
-
-	return text;
+			g_free(*text);
+			*text = new;
+		}
+	}
+	g_free(quote_text);
+	g_free(quote_url);
 }
 
@@ -681,4 +701,6 @@
 	if (g_strcasecmp(txs->user->screen_name, td->user) == 0) {
 		td->log[td->log_id].id = txs->rt_id;
+		/* More useful than NULL. */
+		td->log[td->log_id].bu = &twitter_log_local_user;
 	}
 
