/* * call-seq: * join(string) -> nil * join(array) -> nil * * Join the specified group or Array of groups. If an error occurs * while attempting to join multiple groups, an exception will * immediately be raised, but joins that were processed prior to the * error will still take effect. */ static VALUE spconn_join(VALUE obj, VALUE group) { int i, n; struct SpreadConnection *sp; Data_Get_Struct(obj, struct SpreadConnection, sp); if (TYPE(group) == T_ARRAY) { for (i = 0; i < RARRAY(group)->len; i++) { VALUE tmp = RARRAY(group)->ptr[i]; if ((n = SP_join(sp->mbox, StringValuePtr(tmp))) < 0) raise_sp_error(n); } } else { /* Assume it's a string, raise type error if not */ if ((n = SP_join(sp->mbox, StringValuePtr(group))) < 0) raise_sp_error(n); } return Qnil; }