ejabberd - Comments for "Populate vjud with email address" https://www.ejabberd.im/node/311 en How do I use the Teo TCL Script https://www.ejabberd.im/node/311#comment-862 <p>I am new to ERLang. How do I use the TCL script? I am trying to populate all my users v_card info.</p> <p>Some simple instructions would be greatly appreciated</p> <p>Thanks,<br /> Brian C</p> Wed, 28 Sep 2005 19:02:16 +0000 bcorbet comment 862 at https://www.ejabberd.im I think I got it https://www.ejabberd.im/node/311#comment-648 <p>Changed the reference to the EMAIL element like this and it works:</p> <p>set vCard [xmlelement vCard \<br /> -attr {xmlns vcard-temp} \<br /> -subtag [xmlelement FN -cdata "$given $family"] \<br /> -subtag [xmlelement N \<br /> -subtag [xmlelement FAMILY -cdata $family] \<br /> -subtag [xmlelement GIVEN -cdata $given]] \<br /> -subtag [xmlelement EMAIL \<br /> -subtag [xmlelement INTERNET] \<br /> -subtag [xmlelement PREF] \<br /> -subtag [xmlelement USERID -cdata $email]]]</p> Tue, 19 Jul 2005 18:23:55 +0000 bbrazell comment 648 at https://www.ejabberd.im Getting close, but need some assistance https://www.ejabberd.im/node/311#comment-647 <p>I can't get the script to change the value of the email address field. Here is what I've tried.</p> <p>I modified the script to accept another argument on the command line : set email [lindex $argv 3]</p> <p>I then changed the following section as follows:</p> <p>set vCard [xmlelement vCard \<br /> -attr {xmlns vcard-temp} \<br /> -subtag [xmlelement FN -cdata "$given $family"] \<br /> -subtag [xmlelement N \<br /> -subtag [xmlelement FAMILY -cdata $family] \<br /> -subtag [xmlelement GIVEN -cdata $given]] \<br /> -subtag [xmlelement EMAIL \<br /> -subtag [xmlelement USERID -cdata $email]]]</p> <p>When I run the script with these values:<br /> ./vcard.tcl bbrazell Bill Brazell <noindex><a href="mailto:bill@home.com" rel="nofollow" >bill@home.com</a></noindex>, I can see the $query value equal to:</p> <p>{iq, "", set, "", "en", {xmlelement, "vCard", [{"xmlns", "vcard-temp"}], [{xmlelement, "FN", [], [{xmlcdata, "Bill Brazell"}]}, {xmlelement, "N", [], [{xmlelement, "FAMILY", [], [{xmlcdata, "Brazell"}]}, {xmlelement, "GIVEN", [], [{xmlcdata, "Bill"}]}]}, {xmlelement, "EMAIL", [], [{xmlelement, "USERID", [], [{xmlcdata, "bill@home.com"}]}]}]}}</p> <p>I know it must be something with the way I'm specifying the EMAIL element. If I change the reference to NICKNAME, it works fine. Here is a line from mod_vcard.erl that may lend a clue:</p> <p> EMail1 = xml:get_path_s(VCARD, [{elem, "EMAIL"}, {elem, "USERID"},cdata]),</p> <p>Any ideas how to get this to work?</p> Tue, 19 Jul 2005 17:59:07 +0000 bbrazell comment 647 at https://www.ejabberd.im You are right. There's a bug https://www.ejabberd.im/node/311#comment-643 <p>You are right. There's a bug in the script. I've put corrected version under the same link as above.</p> Mon, 18 Jul 2005 18:44:42 +0000 teo comment 643 at https://www.ejabberd.im Sorry. More details... https://www.ejabberd.im/node/311#comment-642 <p>Prior to running the script, I verified that I'm able to view/modify the vcard from a Jabber client.</p> <p>I modified the following lines in the script:</p> <p>set username [lindex $argv 0]<br /> set servername "jabbertest.wireless.attws.com"<br /> set given [lindex $argv 1]<br /> set family [lindex $argv 2]<br /> set orgname "Cingular"</p> <p>I also changed these lines, changing from -sname to -name and giving it the FQDN of the ejabberd host. If I leave it set to $hostname, it reports the following error: =ERROR REPORT==== 18-Jul-2005::09:47:18 ===<br /> ** System running to use fully qualified hostnames **<br /> ** Hostname localhost is illegal **</p> <p>set res [exec /usr/local/bin/erl -name vcards &lt;&lt; \<br /> "rpc:call('ejabberd@jabbertest.wireless.attws.com', mod_vcard, process_sm_iq, \[$jid, $jid, $query\])."]</p> <p>I then run the script giving it the following arguments:</p> <p>./vcard.tcl bbrazell Bill Brazell</p> <p>Script returns: bbrazell@jabbertest.wireless.attws.com: OK</p> <p>I then try to view the vcard for the modified record and the client is unable to retrieve it. Does that help? I can provide more information upon request. Thanks</p> Mon, 18 Jul 2005 16:56:22 +0000 bbrazell comment 642 at https://www.ejabberd.im You wrote: I modified it and https://www.ejabberd.im/node/311#comment-641 <p>You wrote: I modified it and got it to run. How then can I have an idea about its behavior?</p> Mon, 18 Jul 2005 16:33:23 +0000 teo comment 641 at https://www.ejabberd.im Corrupting the record?? https://www.ejabberd.im/node/311#comment-640 <p>Teo,</p> <p>Thanks for providing the script. I modified it and got it to run. It returns bbrazell@jabbertest.wireless.attws.com: OK. The problem is that I think it's corrupting the record since I'm unable to view it after running the script. Here is the command I entered:</p> <p>./vcard.tcl bbrazell Bill Brazell</p> <p>Does that look right? Any ideas why the record is getting corrupted?</p> Mon, 18 Jul 2005 15:04:50 +0000 bbrazell comment 640 at https://www.ejabberd.im I use this script for https://www.ejabberd.im/node/311#comment-636 <p>I use <noindex><a href="http://sgolovan.nes.ru/tmp/vcard.tcl" rel="nofollow" >this script</a></noindex> for modifying users' vCard data. You could modify it to suit your requirements.</p> Sun, 17 Jul 2005 08:16:05 +0000 teo comment 636 at https://www.ejabberd.im Modify vcard table via command line https://www.ejabberd.im/node/311#comment-634 <p>I'm still trying to populate the vjud automatically when a user signs up (registers) their account. I've looked at the code and have to admit that the mnesia commands have me stumped. Probably simple syntax errors.</p> <p>Anyhow, is there a way to populate the vcard table on the command line? Looks like the mod_vcard may be a possibility, but I can't tell if it is able accept arguments. At a minimum, I'd like to be able to write to the fn, family, and email fields. Any help is appreciated.</p> Sat, 16 Jul 2005 15:54:31 +0000 bbrazell comment 634 at https://www.ejabberd.im Reset user password https://www.ejabberd.im/node/311#comment-620 <p>OK. I figured out how to reset user passwords by modifying the ejabberdctl behavior. Here is what I did: </p> <p> Edited ejabberd_ctl.erl and inserted the following right before the line reading: process(Node, ["register", User, Server, Password]) -> (line 86) </p> <pre>process(Node, ["reset", User, Server, Password]) -> case rpc:call(Node, ejabberd_auth, set_password, [User, Server, Password]) of {atomic, ok} -> ?STATUS_SUCCESS; {error, Reason} -> io:format("Can't locate user ~p at node ~p: ~p~n", [User ++ "@" ++ Server, Node, Reason]), ?STATUS_ERROR; {badrpc, Reason} -> io:format("Can't locate user ~p at node ~p: ~p~n", [User ++ "@" ++ Server, Node, Reason]), ?STATUS_BADRPC end;</pre> <p>Next, I added the following right before the line reading: " register user server password\tregister a user~n" (line 261) <pre> " reset user server password\treset user's password~n"</pre> </p><p>Recompiled and it works fine.</p> <p>Now I just need to be able to populate the email address field in the database upon registration and I'll be set.</p> Mon, 11 Jul 2005 21:34:54 +0000 bbrazell comment 620 at https://www.ejabberd.im