muc_log.vala
changeset 4 8785de25b6bd
parent 3 dd7a02c6d476
child 8 dfd274c668f9
equal deleted inserted replaced
3:dd7a02c6d476 4:8785de25b6bd
    23             filename = null;
    23             filename = null;
    24             write(Time.local(new time_t()), "logstart", "", "Log started");
    24             write(Time.local(new time_t()), "logstart", "", "Log started");
    25         }
    25         }
    26         ~RoomLog() {
    26         ~RoomLog() {
    27             write(Time.local(new time_t()), "logstop", "", "Log stopped");
    27             write(Time.local(new time_t()), "logstop", "", "Log stopped");
    28             file.flush();
       
    29         }
    28         }
    30         public void write(Time time, string _class, string nick, string str) {
    29         public void write(Time time, string _class, string nick, string str) {
    31 
    30 
    32             if ((lastday != time.day)||(lastmonth != time.month)||(lastyear!=time.year)) {
    31             if ((lastday != time.day)||(lastmonth != time.month)||(lastyear!=time.year)) {
    33                 var fname = time.format(logpath).replace("<muc>",jid);
    32                 var fname = time.format(logpath).replace("<muc>",jid);
    75             
    74             
    76             var id = getid(time);
    75             var id = getid(time);
    77             var times = time.format("%H:%M:%S");
    76             var times = time.format("%H:%M:%S");
    78             file.printf("<tr id='l_%s' class='%s'><td class='time'><a id='i_%s' href='#i_%s'>%s</a></td>", id, _class, id, id, times);
    77             file.printf("<tr id='l_%s' class='%s'><td class='time'><a id='i_%s' href='#i_%s'>%s</a></td>", id, _class, id, id, times);
    79             file.printf("<td class='nick'>%s</td><td class='text'>%s</td></tr>\n", nick, str);
    78             file.printf("<td class='nick'>%s</td><td class='text'>%s</td></tr>\n", nick, str);
       
    79             file.flush();
    80         }
    80         }
    81             
    81             
    82     }
    82     }
    83     public string getconf(string jid, string key, string? def) {
    83     public string getconf(string jid, string key, string? def) {
    84         var res = cfg["muc "+jid, key];
    84         var res = cfg["muc "+jid, key];