comparison mcabber/src/jabglue.c @ 645:d26a1c9611db

Small handle_presence_muc() update
author Mikael Berthe <mikael@lilotux.net>
date Thu, 05 Jan 2006 22:01:11 +0100
parents 68fb0c1dfb15
children 3ad6675caaf1
comparison
equal deleted inserted replaced
644:68fb0c1dfb15 645:d26a1c9611db
1124 } 1124 }
1125 g_free(mbuf); 1125 g_free(mbuf);
1126 } else if (buddy_getstatus(room_elt->data, rname) == offline && 1126 } else if (buddy_getstatus(room_elt->data, rname) == offline &&
1127 ust != offline) { 1127 ust != offline) {
1128 gchar *mbuf; 1128 gchar *mbuf;
1129 const char *ournick = buddy_getnickname(room_elt->data);
1130
1131 if (!ournick) {
1132 // I think it shouldn't happen, but let's put a warning for a while...
1133 mbuf = g_strdup_printf("MUC ERR: you have no nickname, "
1134 "please send a bug report!");
1135 scr_LogPrint(LPRINT_LOGNORM, mbuf);
1136 scr_WriteIncomingMessage(roomjid, mbuf, 0, HBB_PREFIX_INFO);
1137 g_free(mbuf);
1138 buddylist_build();
1139 scr_DrawRoster();
1140 return;
1141 }
1142
1129 if (!buddy_getinsideroom(room_elt->data)) { 1143 if (!buddy_getinsideroom(room_elt->data)) {
1130 const char *ournick = buddy_getnickname(room_elt->data);
1131 // We weren't inside the room yet. Now we are. 1144 // We weren't inside the room yet. Now we are.
1132 // However, this could be a presence packet from another room member 1145 // However, this could be a presence packet from another room member
1133
1134 if (!ournick) {
1135 // I think it shouldn't happen, but let's put a warning for a while...
1136 scr_LogPrint(LPRINT_LOGNORM, "MUC ERR: you have no nickname, "
1137 "please send a bug report!");
1138 ournick = "";
1139 buddylist_build();
1140 scr_DrawRoster();
1141 return;
1142 }
1143 1146
1144 buddy_setinsideroom(room_elt->data, TRUE); 1147 buddy_setinsideroom(room_elt->data, TRUE);
1145 // Add a message to the tracelog file 1148 // Add a message to the tracelog file
1146 mbuf = g_strdup_printf("You have joined %s as \"%s\"", roomjid, ournick); 1149 mbuf = g_strdup_printf("You have joined %s as \"%s\"", roomjid, ournick);
1147 scr_LogPrint(LPRINT_LOG, "%s", mbuf); 1150 scr_LogPrint(LPRINT_LOG, "%s", mbuf);
1156 if (log_muc_conf) hlog_write_message(roomjid, 0, FALSE, mbuf); 1159 if (log_muc_conf) hlog_write_message(roomjid, 0, FALSE, mbuf);
1157 g_free(mbuf); 1160 g_free(mbuf);
1158 mbuf = g_strdup_printf("%s has joined", rname); 1161 mbuf = g_strdup_printf("%s has joined", rname);
1159 } 1162 }
1160 } else { 1163 } else {
1161 mbuf = g_strdup_printf("%s has joined", rname); 1164 if (strcmp(ournick, rname))
1162 } 1165 mbuf = g_strdup_printf("%s has joined", rname);
1163 scr_WriteIncomingMessage(roomjid, mbuf, usttime, 1166 else
1164 HBB_PREFIX_INFO|HBB_PREFIX_NOFLAG); 1167 mbuf = NULL;
1165 if (log_muc_conf) hlog_write_message(roomjid, 0, FALSE, mbuf); 1168 }
1166 g_free(mbuf); 1169
1170 if (mbuf) {
1171 scr_WriteIncomingMessage(roomjid, mbuf, usttime,
1172 HBB_PREFIX_INFO|HBB_PREFIX_NOFLAG);
1173 if (log_muc_conf) hlog_write_message(roomjid, 0, FALSE, mbuf);
1174 g_free(mbuf);
1175 }
1167 } 1176 }
1168 1177
1169 // Update room member status 1178 // Update room member status
1170 if (rname) { 1179 if (rname) {
1171 gchar *mbrjid_noutf8 = from_utf8(mbjid); 1180 gchar *mbrjid_noutf8 = from_utf8(mbjid);