aboutsummaryrefslogtreecommitdiff
path: root/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'command.c')
-rw-r--r--command.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/command.c b/command.c
index 53d65f5..3d406e1 100644
--- a/command.c
+++ b/command.c
@@ -250,7 +250,8 @@ static bool cmd_history(struct conn_data *data,const char *tag,const char **args
net_send_error(data->fd,tag,"Not logged in");
return false;
}
- i64 roomid=db_find_room(args[0]);
+ const char *roomname=args[0];
+ i64 roomid=db_find_room(roomname);
if(roomid==-1){
net_send_error(data->fd,tag,"Room not found");
return false;
@@ -273,8 +274,9 @@ static bool cmd_history(struct conn_data *data,const char *tag,const char **args
for(i64 i=ml.count-1;i>=0;i--){
char *username=db_get_username(ml.list[i].userid);
- len=asprintf(&buf,"%s history_message %" PRIi64 " %s %s %" PRIi64 " %s\n",
- tag,ml.count-1-i,args[0],username,ml.list[i].timestamp,ml.list[i].message);
+ len=asprintf(&buf,"%s history_message %" PRIi64 " %s %s %" PRIi64 " %" PRIi64 " %s\n",
+ tag,ml.count-1-i,roomname,username,ml.list[i].timestamp,
+ ml.list[i].msgid,ml.list[i].message);
closed=net_send_raw_text(data->fd,buf,len);
free(buf);
if(closed)break;