comparison mcabber/src/jabglue.c @ 478:47cfa3779549

MUC: log join/nick/leave/topic if log_muc_conf is set
author Mikael Berthe <mikael@lilotux.net>
date Mon, 03 Oct 2005 22:12:24 +0200
parents fa49ac0bb8f3
children 2a6a8ebb813b
comparison
equal deleted inserted replaced
477:d11e5ce2582c 478:47cfa3779549
28 #include "screen.h" 28 #include "screen.h"
29 #include "hooks.h" 29 #include "hooks.h"
30 #include "utils.h" 30 #include "utils.h"
31 #include "settings.h" 31 #include "settings.h"
32 #include "hbuf.h" 32 #include "hbuf.h"
33 #include "histolog.h"
33 34
34 #define JABBERPORT 5222 35 #define JABBERPORT 5222
35 #define JABBERSSLPORT 5223 36 #define JABBERSSLPORT 5223
36 37
37 #define JABBER_AGENT_GROUP "Jabber Agents" 38 #define JABBER_AGENT_GROUP "Jabber Agents"
857 else r = s; 858 else r = s;
858 // Display inside the room window 859 // Display inside the room window
859 mbuf = g_strdup_printf("%s has set the topic to: %s", r, 860 mbuf = g_strdup_printf("%s has set the topic to: %s", r,
860 (subj_noutf8 ? subj_noutf8 : "(?)")); 861 (subj_noutf8 ? subj_noutf8 : "(?)"));
861 scr_WriteIncomingMessage(s, mbuf, 0, HBB_PREFIX_INFO); 862 scr_WriteIncomingMessage(s, mbuf, 0, HBB_PREFIX_INFO);
863 if (settings_opt_get_int("log_muc_conf"))
864 hlog_write_message(s, 0, FALSE, mbuf);
862 if (subj_noutf8) g_free(subj_noutf8); 865 if (subj_noutf8) g_free(subj_noutf8);
863 g_free(s); 866 g_free(s);
864 g_free(mbuf); 867 g_free(mbuf);
865 } else { // Chat message 868 } else { // Chat message
866 tmp = g_new(char, (body ? strlen(body) : 0) + strlen(p) + 4); 869 tmp = g_new(char, (body ? strlen(body) : 0) + strlen(p) + 4);
1095 if (x) { // This is a MUC presence message 1098 if (x) { // This is a MUC presence message
1096 enum imrole mbrole = role_none; 1099 enum imrole mbrole = role_none;
1097 const char *mbrjid = NULL; 1100 const char *mbrjid = NULL;
1098 const char *mbnewnick = NULL; 1101 const char *mbnewnick = NULL;
1099 GSList *room_elt; 1102 GSList *room_elt;
1103 int log_muc_conf = settings_opt_get_int("log_muc_conf");
1100 1104
1101 // Add room if it doesn't already exist 1105 // Add room if it doesn't already exist
1102 room_elt = roster_add_user(r, NULL, NULL, ROSTER_TYPE_ROOM); 1106 room_elt = roster_add_user(r, NULL, NULL, ROSTER_TYPE_ROOM);
1103 1107
1104 // Get room member's information 1108 // Get room member's information
1127 gchar *mbuf; 1131 gchar *mbuf;
1128 gchar *newname_noutf8 = from_utf8(mbnewnick); 1132 gchar *newname_noutf8 = from_utf8(mbnewnick);
1129 mbuf = g_strdup_printf("%s is now known as %s", rname, 1133 mbuf = g_strdup_printf("%s is now known as %s", rname,
1130 (newname_noutf8 ? newname_noutf8 : "(?)")); 1134 (newname_noutf8 ? newname_noutf8 : "(?)"));
1131 scr_WriteIncomingMessage(r, mbuf, 0, HBB_PREFIX_INFO); 1135 scr_WriteIncomingMessage(r, mbuf, 0, HBB_PREFIX_INFO);
1136 if (log_muc_conf) hlog_write_message(r, 0, FALSE, mbuf);
1132 g_free(mbuf); 1137 g_free(mbuf);
1133 if (newname_noutf8) { 1138 if (newname_noutf8) {
1134 buddy_resource_setname(room_elt->data, rname, newname_noutf8); 1139 buddy_resource_setname(room_elt->data, rname, newname_noutf8);
1135 m = buddy_getnickname(room_elt->data); 1140 m = buddy_getnickname(room_elt->data);
1136 if (m && !strcmp(rname, m)) 1141 if (m && !strcmp(rname, m))
1142 1147
1143 // Check for departure/arrival 1148 // Check for departure/arrival
1144 if (!mbnewnick && mbrole == role_none) { 1149 if (!mbnewnick && mbrole == role_none) {
1145 gchar *mbuf = g_strdup_printf("%s has left", rname); 1150 gchar *mbuf = g_strdup_printf("%s has left", rname);
1146 scr_WriteIncomingMessage(r, mbuf, 0, HBB_PREFIX_INFO); 1151 scr_WriteIncomingMessage(r, mbuf, 0, HBB_PREFIX_INFO);
1152 if (log_muc_conf) hlog_write_message(r, 0, FALSE, mbuf);
1147 g_free(mbuf); 1153 g_free(mbuf);
1148 } else if (buddy_getstatus(room_elt->data, rname) == offline && 1154 } else if (buddy_getstatus(room_elt->data, rname) == offline &&
1149 ust != offline) { 1155 ust != offline) {
1150 gchar *mbuf; 1156 gchar *mbuf;
1151 if (buddy_getnickname(room_elt->data) == NULL) { 1157 if (buddy_getnickname(room_elt->data) == NULL) {
1153 mbuf = g_strdup_printf("You have joined as \"%s\"", rname); 1159 mbuf = g_strdup_printf("You have joined as \"%s\"", rname);
1154 } else { 1160 } else {
1155 mbuf = g_strdup_printf("%s has joined", rname); 1161 mbuf = g_strdup_printf("%s has joined", rname);
1156 } 1162 }
1157 scr_WriteIncomingMessage(r, mbuf, 0, HBB_PREFIX_INFO); 1163 scr_WriteIncomingMessage(r, mbuf, 0, HBB_PREFIX_INFO);
1164 if (log_muc_conf) hlog_write_message(r, 0, FALSE, mbuf);
1158 g_free(mbuf); 1165 g_free(mbuf);
1159 } 1166 }
1160 1167
1161 // Update room member status 1168 // Update room member status
1162 if (rname) 1169 if (rname)