Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/jabglue.c @ 837:7c74eef1d0e0
New option "muc_auto_whois"
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Thu, 04 May 2006 18:39:25 +0200 |
parents | 6f913f4fbb2a |
children | f74c5c6d2c24 |
comparison
equal
deleted
inserted
replaced
836:cd011fe9f8a5 | 837:7c74eef1d0e0 |
---|---|
30 #include "hooks.h" | 30 #include "hooks.h" |
31 #include "utils.h" | 31 #include "utils.h" |
32 #include "settings.h" | 32 #include "settings.h" |
33 #include "hbuf.h" | 33 #include "hbuf.h" |
34 #include "histolog.h" | 34 #include "histolog.h" |
35 #include "commands.h" | |
35 | 36 |
36 #define JABBERPORT 5222 | 37 #define JABBERPORT 5222 |
37 #define JABBERSSLPORT 5223 | 38 #define JABBERSSLPORT 5223 |
38 | 39 |
39 jconn jc; | 40 jconn jc; |
970 const char *m; | 971 const char *m; |
971 enum imrole mbrole = role_none; | 972 enum imrole mbrole = role_none; |
972 enum imaffiliation mbaffil = affil_none; | 973 enum imaffiliation mbaffil = affil_none; |
973 const char *mbjid = NULL, *mbnick = NULL; | 974 const char *mbjid = NULL, *mbnick = NULL; |
974 const char *actorjid = NULL, *reason = NULL; | 975 const char *actorjid = NULL, *reason = NULL; |
976 bool new_member = FALSE; // True if somebody else joins the room (not us) | |
975 unsigned int statuscode = 0; | 977 unsigned int statuscode = 0; |
976 GSList *room_elt; | 978 GSList *room_elt; |
977 int log_muc_conf; | 979 int log_muc_conf; |
978 | 980 |
979 log_muc_conf = settings_opt_get_int("log_muc_conf"); | 981 log_muc_conf = settings_opt_get_int("log_muc_conf"); |
1163 scr_WriteIncomingMessage(roomjid, mbuf, 0, | 1165 scr_WriteIncomingMessage(roomjid, mbuf, 0, |
1164 HBB_PREFIX_INFO|HBB_PREFIX_NOFLAG); | 1166 HBB_PREFIX_INFO|HBB_PREFIX_NOFLAG); |
1165 if (log_muc_conf) hlog_write_message(roomjid, 0, FALSE, mbuf); | 1167 if (log_muc_conf) hlog_write_message(roomjid, 0, FALSE, mbuf); |
1166 g_free(mbuf); | 1168 g_free(mbuf); |
1167 mbuf = g_strdup_printf("%s has joined", rname); | 1169 mbuf = g_strdup_printf("%s has joined", rname); |
1170 new_member = TRUE; | |
1168 } | 1171 } |
1169 } else { | 1172 } else { |
1170 if (strcmp(ournick, rname)) | 1173 if (strcmp(ournick, rname)) { |
1171 mbuf = g_strdup_printf("%s has joined", rname); | 1174 mbuf = g_strdup_printf("%s has joined", rname); |
1172 else | 1175 new_member = TRUE; |
1176 } else | |
1173 mbuf = NULL; | 1177 mbuf = NULL; |
1174 } | 1178 } |
1175 | 1179 |
1176 if (mbuf) { | 1180 if (mbuf) { |
1177 scr_WriteIncomingMessage(roomjid, mbuf, usttime, | 1181 scr_WriteIncomingMessage(roomjid, mbuf, usttime, |
1183 | 1187 |
1184 // Update room member status | 1188 // Update room member status |
1185 if (rname) { | 1189 if (rname) { |
1186 roster_setstatus(roomjid, rname, bpprio, ust, ustmsg, usttime, | 1190 roster_setstatus(roomjid, rname, bpprio, ust, ustmsg, usttime, |
1187 mbrole, mbaffil, mbjid); | 1191 mbrole, mbaffil, mbjid); |
1192 if (new_member && settings_opt_get_int("muc_auto_whois")) { | |
1193 // FIXME: This will fail for some UTF-8 nicknames. | |
1194 gchar *joiner_nick = from_utf8(rname); | |
1195 room_whois(room_elt->data, joiner_nick); | |
1196 g_free(joiner_nick); | |
1197 } | |
1188 } else | 1198 } else |
1189 scr_LogPrint(LPRINT_LOGNORM, "MUC DBG: no rname!"); /* DBG */ | 1199 scr_LogPrint(LPRINT_LOGNORM, "MUC DBG: no rname!"); /* DBG */ |
1190 | 1200 |
1191 buddylist_build(); | 1201 buddylist_build(); |
1192 scr_DrawRoster(); | 1202 scr_DrawRoster(); |