[ekg2-commit] r4129 - trunk/plugins/logs: trunk/plugins/logs/main.c
SVN commit
svn w toxygen.net
Pią, 18 Lip 2008, 13:31:34 CEST
Author: darkjames
Date: 2008-07-18 13:31:33 +0200 (Fri, 18 Jul 2008)
New Revision: 4129
Modified:
trunk/plugins/logs/main.c
Log:
lazy_bum ftw.
(i.e. fix conference logging)
Modified: trunk/plugins/logs/main.c
===================================================================
--- trunk/plugins/logs/main.c 2008-07-18 10:48:50 UTC (rev 4128)
+++ trunk/plugins/logs/main.c 2008-07-18 11:31:33 UTC (rev 4129)
@@ -933,16 +933,32 @@
session_t *s = session_find(session); // session pointer
log_window_t *lw;
- char *ruid;
+ char *conf_uid = NULL; /* conference-uid */
+ char *target_uid;
/* olewamy jesli to irc i ma formatke irssi like, czekajac na irc-protocol-message */
if (session_check(s, 0, "irc") && logs_log_format(s) == LOG_FORMAT_IRSSI)
return 0;
- class &= ~EKG_NO_THEMEBIT;
- ruid = (class >= EKG_MSGCLASS_SENT) ? rcpts[0] : uid;
+ class &= ~(EKG_NO_THEMEBIT | EKG_MSGCLASS_NOT2US);
- if (!(lw = logs_log_find(session, ruid, 1)->lw)) {
+ target_uid = (class >= EKG_MSGCLASS_SENT) ? rcpts[0] : uid;
+
+ /* XXX, think more about conferences-logging */
+ if (class < EKG_MSGCLASS_SENT) {
+ int recipients_count = array_count((char **) rcpts);
+
+ if (recipients_count > 0) {
+ struct conference *c;
+
+ if ((c = conference_find_by_uids(s, uid, (const char **) rcpts, recipients_count, 0)))
+ conf_uid = c->name;
+ else
+ debug_error("logs_handler() smth strange happen (c == NULL) && recipients_count > 0 [%d]\n", recipients_count);
+ }
+ }
+
+ if (!(lw = logs_log_find(session, conf_uid ? conf_uid : target_uid, 1)->lw)) {
debug_error("[LOGS:%d] logs_handler, shit happen\n", __LINE__);
return 0;
}
@@ -952,13 +968,13 @@
return 0;
}
- /* debug("[LOGS_MSG_HANDLER] %s : %s %d %x\n", ruid, lw->path, lw->logformat, lw->file); */
+ /* debug("[LOGS_MSG_HANDLER] %s : %s %d %x\n", target_uid, lw->path, lw->logformat, lw->file); */
- /* uid = uid | ruid ? */
+ /* uid = uid | target_uid ? */
switch (lw->logformat) {
case LOG_FORMAT_SIMPLE:
- logs_simple(lw->file, session, ruid, text, sent, class, (char*)NULL);
+ logs_simple(lw->file, session, target_uid, text, sent, class, (char*)NULL);
break;
case LOG_FORMAT_XML:
Więcej informacji o liście dyskusyjnej ekg2-commit