Cnt.get members to notify by persid

From SDU
Jump to: navigation, search
To make corrections or additions to this article, select the edit tab above.
To discuss or ask questions about this article, select the discussion tab above.

Overview

This method gets a list of members with Notify flag set ON for specified group .

This action can be called in spell code in method send_wait (or send) using call_attr action.

Usage

<source lang="javascript"> void send_wait (int timeout, object top_object, "call_attr", "cnt", "get_members_to_notify_by_persid", contact_persid) </source>

  • timeout - how long (in seconds) should the method wait for finishing the method (0 means infinite [no timeout] and is generally the value used)
  • top_object - root object for the method (on which the method is called)
  • contact_persid - persistent ID of a group for which members you are looking for

Results

success or failure is tested with msg_error() (boolean function)

On success the resulted list is filled into a global array msg as follows:

  • msg[0] - the number of assigned groups
  • msg[1] - one string with a list of member persistent IDs separated by spaces (" ")

On failure

  • msg[0] - failure reason

Examples

<source lang="javascript"> int i; send_wait(0, top_object(), "call_attr", "cnt", "get_members_to_notify_by_persid", "cnt:776B094702EABB4B87F04A139E72D44B"); if( msg_error()) {

   logf (ERROR, "failure in send_wait ..... .Reason: %s",msg[0]);

} else {

   string member_persids[msg[0]];
   split(member_persids, msg[1], " ");
   for (i=0;i<msg[0];i++) {
       logf (SIGNIFICANT, "Notify %s", member_persids[i]);
   }

} </source> <source lang="javascript"> string notify_list; send_wait(0, top_object(), "call_attr", "cnt", "get_members_to_notify_by_persid", msg_target); if (msg_error()) {

   logf(ERROR, "%s: Error in get_members_to_notify_by_persid(%s)", method, msg_target);
   return 1;

} else {

   notify_list = msg[1] + " " + msg_target;

}

logf(TRACE, "%s: Going to notify these users: %s", method, notify_list); send_wait(0, top_object(), "call_attr", "cnt", "notify_list", notify_list, msg_level, msg_title, msg_body, "" /* msg_ack */,

         tran_pt, ticket, is_internal, 0 /* cmth_override */);

</source>