mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-15 05:23:02 +01:00
better format for private messages
This commit is contained in:
parent
05c05868c6
commit
59b90b1328
@ -686,6 +686,7 @@ static void send_group_prvt_message(ToxWindow *self, Tox *m, int groupnum, const
|
|||||||
size_t i;
|
size_t i;
|
||||||
int peernum = -1, len = 0;
|
int peernum = -1, len = 0;
|
||||||
const char *msg = NULL;
|
const char *msg = NULL;
|
||||||
|
char *nick = NULL;
|
||||||
|
|
||||||
for (i = 0; i < groupchats[groupnum].num_peers; ++i) {
|
for (i = 0; i < groupchats[groupnum].num_peers; ++i) {
|
||||||
if (memcmp((char *) &groupchats[groupnum].peer_names[i * TOX_MAX_NAME_LENGTH], data,
|
if (memcmp((char *) &groupchats[groupnum].peer_names[i * TOX_MAX_NAME_LENGTH], data,
|
||||||
@ -696,6 +697,7 @@ static void send_group_prvt_message(ToxWindow *self, Tox *m, int groupnum, const
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
msg = data + groupchats[groupnum].peer_name_lengths[i] + 1;
|
msg = data + groupchats[groupnum].peer_name_lengths[i] + 1;
|
||||||
|
nick = (char *) &groupchats[groupnum].peer_names[i * TOX_MAX_NAME_LENGTH];
|
||||||
peernum = i;
|
peernum = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -711,15 +713,17 @@ static void send_group_prvt_message(ToxWindow *self, Tox *m, int groupnum, const
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char selfname[TOX_MAX_NAME_LENGTH];
|
/* turn "peername" into ">peername<" to signify private message */
|
||||||
uint16_t slen = tox_group_get_self_name(m, groupnum, (uint8_t *) selfname);
|
char pm_nick[TOX_MAX_NAME_LENGTH + 2];
|
||||||
selfname[slen] = '\0';
|
strcpy(pm_nick, ">");
|
||||||
|
strcpy(pm_nick + 1, nick);
|
||||||
|
strcpy(pm_nick + 1 + groupchats[groupnum].peer_name_lengths[i], "<");
|
||||||
|
|
||||||
char timefrmt[TIME_STR_SIZE];
|
char timefrmt[TIME_STR_SIZE];
|
||||||
get_time_str(timefrmt, sizeof(timefrmt));
|
get_time_str(timefrmt, sizeof(timefrmt));
|
||||||
|
|
||||||
line_info_add(self, timefrmt, selfname, NULL, OUT_PRVT_MSG, 0, 0, "%s", msg);
|
line_info_add(self, timefrmt, pm_nick, NULL, OUT_PRVT_MSG, 0, 0, "%s", msg);
|
||||||
write_to_log(msg, selfname, ctx->log, false);
|
write_to_log(msg, pm_nick, ctx->log, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
||||||
|
Loading…
Reference in New Issue
Block a user