1
0
Fork 0

ui_incoming_private_msg takes ProfPrivateWin, added asserts

This commit is contained in:
James Booth 2015-11-08 22:01:51 +00:00
parent ebff1fc81e
commit 8a397263dd
4 changed files with 25 additions and 16 deletions

View File

@ -184,7 +184,23 @@ sv_ev_room_message(const char *const room_jid, const char *const nick,
void
sv_ev_incoming_private_message(const char *const fulljid, char *message)
{
ui_incoming_private_msg(fulljid, message, NULL);
ProfPrivateWin *privatewin = wins_get_private(fulljid);
if (privatewin == NULL) {
ProfWin *window = wins_new_private(fulljid);
privatewin = (ProfPrivateWin*)window;
}
ui_incoming_private_msg(privatewin, message, NULL);
}
void
sv_ev_delayed_private_message(const char *const fulljid, char *message, GDateTime *timestamp)
{
ProfPrivateWin *privatewin = wins_get_private(fulljid);
if (privatewin == NULL) {
ProfWin *window = wins_new_private(fulljid);
privatewin = (ProfPrivateWin*)window;
}
ui_incoming_private_msg(privatewin, message, timestamp);
}
void
@ -319,12 +335,6 @@ sv_ev_incoming_message(char *barejid, char *resource, char *message, char *pgp_m
#endif
}
void
sv_ev_delayed_private_message(const char *const fulljid, char *message, GDateTime *timestamp)
{
ui_incoming_private_msg(fulljid, message, timestamp);
}
void
sv_ev_message_receipt(char *barejid, char *id)
{

View File

@ -32,6 +32,7 @@
*
*/
#include <assert.h>
#include <glib.h>
#include "ui/win_types.h"
@ -41,18 +42,14 @@
#include "config/preferences.h"
void
ui_incoming_private_msg(const char *const fulljid, const char *const message, GDateTime *timestamp)
ui_incoming_private_msg(ProfPrivateWin *privatewin, const char *const message, GDateTime *timestamp)
{
ProfPrivateWin *privatewin = wins_get_private(fulljid);
if (privatewin == NULL) {
ProfWin *window = wins_new_private(fulljid);
privatewin = (ProfPrivateWin*)window;
}
assert(privatewin != NULL);
ProfWin *window = (ProfWin*) privatewin;
int num = wins_get_num(window);
char *display_from = get_nick_from_full_jid(fulljid);
char *display_from = get_nick_from_full_jid(privatewin->fulljid);
// currently viewing chat window with sender
if (wins_is_current(window)) {
@ -86,5 +83,7 @@ ui_incoming_private_msg(const char *const fulljid, const char *const message, GD
void
ui_outgoing_private_msg(ProfPrivateWin *privwin, const char *const message)
{
assert(privwin != NULL);
win_print((ProfWin*)privwin, '-', 0, NULL, 0, THEME_TEXT_ME, "me", message);
}

View File

@ -83,7 +83,7 @@ char* ui_get_line(void);
char* ui_ask_pgp_passphrase(const char *hint, int prev_fail);
void ui_contact_online(char *barejid, Resource *resource, GDateTime *last_activity);
void ui_contact_typing(const char *const barejid, const char *const resource);
void ui_incoming_private_msg(const char *const fulljid, const char *const message, GDateTime *timestamp);
void ui_incoming_private_msg(ProfPrivateWin *privatewin, const char *const message, GDateTime *timestamp);
void ui_disconnected(void);
void ui_outgoing_private_msg(ProfPrivateWin *privwin, const char *const message);
void ui_room_join(const char *const roomjid, gboolean focus);

View File

@ -159,7 +159,7 @@ void ui_contact_typing(const char * const barejid, const char * const resource)
void chatwin_incoming_msg(ProfChatWin *chatwin, const char * const resource, const char * const message, GDateTime *timestamp, gboolean win_created, prof_enc_t enc_mode) {}
void chatwin_receipt_received(ProfChatWin *chatwin, const char * const id) {}
void ui_incoming_private_msg(const char * const fulljid, const char * const message, GDateTime *timestamp) {}
void ui_incoming_private_msg(ProfPrivateWin *privatewin, const char * const message, GDateTime *timestamp) {}
void ui_disconnected(void) {}
void chatwin_recipient_gone(ProfChatWin *chatwin) {}