Skip to content

Commit 08fa5d4

Browse files
committed
+ resource distinction for the regular JIDs in roster
1 parent 7b490cd commit 08fa5d4

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

autotest.sh

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
#!/bin/bash
2-
rm -rf test/fs
2+
#rm -rf test/fs
33
mkdir -p test/fs
44
fusermount -u test/fs
55
cd test
66
../hatexmpp fs
7+
sleep 1;
8+
cp -r config/* fs/config/
79
sleep 3;
810
cd fs
911
mkdir roster
10-
sleep 6;
11-
mkdir 'roster/[email protected]'
12-
sleep 3;
13-
echo -n autotest >> roster/[email protected]/__chat
14-
sleep 3;
15-
rmdir 'roster/[email protected]'
16-
sleep 1;
17-
cd ..
18-
fusermount -u fs
19-
12+
#sleep 6;
13+
#mkdir 'roster/[email protected]'
14+
#sleep 3;
15+
#echo -n autotest >> roster/[email protected]/__chat
16+
#sleep 3;
17+
#rmdir 'roster/[email protected]'
18+
#sleep 1;
19+
#cd ..
20+
#fusermount -u fs
21+
#

common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include <string.h>
1818
#include <fuse.h>
1919
#include <time.h>
20+
#include <stdbool.h>
21+
#include <assert.h>
2022
#include <loudmouth/loudmouth.h>
2123

2224
#define PROGRAM_NAME "HateXMPP"

fuse.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static int fsgetattr(const char *path, struct stat *stbuf)
170170
path += 8;
171171
ri = getri(path);
172172
if (ri) {
173-
if ((ri->type == MUC) && (strlen(path) == strlen(get_jid(path)))) {
173+
if (strlen(path) == strlen(get_jid(path))) {
174174
stbuf->st_mode = S_IFDIR | 0755;
175175
stbuf->st_nlink = 2;
176176
return 0;
@@ -230,11 +230,12 @@ static int fsreaddir(const char *path, void *buf, fuse_fill_dir_t filler,
230230
rosteritem *ri;
231231

232232
ri = getri(path);
233-
if (ri && (ri->type == MUC)) {
233+
if (ri) {
234234
filler(buf, ".", NULL, 0);
235235
filler(buf, "..", NULL, 0);
236236
filler(buf, "__chat", NULL, 0);
237-
filler(buf, "__nick", NULL, 0);
237+
if (ri->type == MUC)
238+
filler(buf, "__nick", NULL, 0);
238239
GHashTableIter iter;
239240
gchar *res;
240241
g_hash_table_iter_init (&iter, ri->resources);
@@ -296,7 +297,7 @@ static int fsread(const char *path, char *buf, size_t size, off_t offset,
296297
path += 8;
297298
ri = getri(path);
298299
gchar *resource = get_resource(path);
299-
if(ri && ((strcmp(path, "__nick") == 0) || (resource && strcmp(resource, "__nick") == 0))) {
300+
if(ri && ((strcmp(path, "__nick") == 0) || (resource && strcmp(resource, "__nick") == 0)) && ri->type == MUC) {
300301
size_t len = strlen(ri->self_resource->name);
301302
if(offset + size < len) {
302303
memcpy(buf, ri->self_resource->name + offset, size);

0 commit comments

Comments
 (0)