ejabberd - Comments for "custom mod_roster" https://www.ejabberd.im/node/3891 en Did you ever complete your https://www.ejabberd.im/node/3891#comment-56804 <p>Did you ever complete your custom mod_roster? I'm also making a similar change currently and need to add an attribute to the roster item as well as add an attribute to the that the items are within. I'm hoping to not have to make a copy of mod_roster but it looks like the only choice.</p> <p>Thanks.</p> Sat, 13 Nov 2010 01:55:27 +0000 wpK comment 56804 at https://www.ejabberd.im Oh I see https://www.ejabberd.im/node/3891#comment-55388 <p>Ah, yes that makes sense. The record isn't going to be a valid roster record since I changed the definition of the type so the record it was loading from the roster table didn't match. Turns out what I was trying before (recreating the DB and make clean) was individually insufficient, I had to do both a full rebuild with make clean and recreate the database, and now I've got a new column in the roster table I can change! Neat, though I still have a ways to go.</p> <p>I noticed that using xs, it tries to append the element as a whole new XML tag. Maybe I should have been more clear before, I'm actually trying to add some attributes to an item tag, e.g. &lt;item jid="bla" myattrib="nifty"&gt;...etc. I'm not sure if xs will work for that seems it to want a new element altogether. </p> <p>I'm hoping using a custom element in the "roster" record, and experimenting with item_to_xml will help, but I'll be posting back here if I run into more issues.</p> <p>Thanks for your help!</p> Tue, 09 Mar 2010 16:51:26 +0000 Tronman comment 55388 at https://www.ejabberd.im I isn't a valid roster record https://www.ejabberd.im/node/3891#comment-55382 <div class="quote-msg"> <div class="quote-author">Quote:</div> <p>the line "J = element(3, I#roster.usj)". If I understand my erlang (which I may not), this should just be assigning J the 3rd element of the tuple usj in I which is a roster. I don't see how adding an element to the roster would effect that. </p></div> <p>That line:<br /> 1. checks if I is a 'roster' valid record as defined in the module binary<br /> 2. gets the element 'usj' of the record<br /> 3. as usj is a tuple with three elements, then it gets the third element (the JID)</p> <p>If that line generates the error {badrecord,roster}, it means I isn't a valid 'roster' record. Maybe it is a string, or an atom, or an invalid 'roster' record (generated by a module that has a different definition of the record).</p> Tue, 09 Mar 2010 10:51:33 +0000 mfoss comment 55382 at https://www.ejabberd.im No Luck https://www.ejabberd.im/node/3891#comment-55377 <p>Hey,</p> <p>That was a good idea, especially after I noticed the error pops up in mod_shared_roster as well, unfortunately no luck. I'm still getting the same error message about bad records even after a total rebuild. </p> <p>It seems to be having a problem with fill_subscription_lists, specifically at the line "J = element(3, I#roster.usj)". If I understand my erlang (which I may not), this should just be assigning J the 3rd element of the tuple usj in I which is a roster. I don't see how adding an element to the roster would effect that.</p> <p>The other places it complains about bad elements seems to be in "mod_shared_roster/get_user_roster" and "get_in_pending_subscriptions", which do indeed do some alternations to roster records but nothing popping out at me that would cause an issue. </p> <p>Anything other suggestions, please let me know. I'll keep investigating in the meantime, and might try changing the xs field as you suggested. Thanks.</p> Mon, 08 Mar 2010 14:30:58 +0000 Tronman comment 55377 at https://www.ejabberd.im The 'roster' record is used https://www.ejabberd.im/node/3891#comment-55366 <p>The 'roster' record is used by several modules. When you modify the record definition, better you run "make clean; make" to ensure all the files are recompiled.</p> <p>Alternatively, maybe you can include your extended elements in the 'xs' field of the 'roster' record, which means you don't need to change the record definition, only to fill that field with your desired data.</p> Sat, 06 Mar 2010 09:40:11 +0000 mfoss comment 55366 at https://www.ejabberd.im