comparison mcabber/mcabber/histolog.c @ 2224:736f9323d701

Update comments to hlog_get_log_jid()
author Mikael Berthe <mikael@lilotux.net>
date Sat, 07 Nov 2015 12:16:15 +0100
parents 1177b33d4550
children c06488852cdc
comparison
equal deleted inserted replaced
2223:965e0282c128 2224:736f9323d701
1 /* 1 /*
2 * histolog.c -- File history handling 2 * histolog.c -- File history handling
3 * 3 *
4 * Copyright (C) 2005-2010 Mikael Berthe <mikael@lilotux.net> 4 * Copyright (C) 2005-2015 Mikael Berthe <mikael@lilotux.net>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at 8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version. 9 * your option) any later version.
66 filename = g_strdup_printf("%s%s", RootDir, lowerid); 66 filename = g_strdup_printf("%s%s", RootDir, lowerid);
67 g_free(lowerid); 67 g_free(lowerid);
68 return filename; 68 return filename;
69 } 69 }
70 70
71 // hlog_get_log_jid(bare_jid)
72 // Returns the real JID used for a symlinked history log file,
73 // or NULL if there's no symbolic link.
71 char *hlog_get_log_jid(const char *bjid) 74 char *hlog_get_log_jid(const char *bjid)
72 { 75 {
73 struct stat bufstat; 76 struct stat bufstat;
74 char *path; 77 char *path;
75 char *log_jid = NULL; 78 char *log_jid = NULL;
82 g_free(log_jid); 85 g_free(log_jid);
83 log_jid = g_new0(char, bufstat.st_size+1); 86 log_jid = g_new0(char, bufstat.st_size+1);
84 if (readlink(path, log_jid, bufstat.st_size) < 0) return NULL; 87 if (readlink(path, log_jid, bufstat.st_size) < 0) return NULL;
85 g_free(path); 88 g_free(path);
86 path = user_histo_file(log_jid); 89 path = user_histo_file(log_jid);
87 } else 90 } else {
88 break; 91 break;
92 }
89 } 93 }
90 94
91 g_free(path); 95 g_free(path);
92 return log_jid; 96 return log_jid;
93 } 97 }