* Figure out how big a buffer we need to allocate
*/
for (nptr = sc->RNCfg->NetConfigs[digestrecp]; nptr != NULL; nptr = nptr->next) {
- recps_len = recps_len + StrLength(nptr->Value) + 2;
+ recps_len = recps_len + StrLength(nptr->Value[0]) + 2;
}
recps = NewStrBufPlain(NULL, recps_len);
if (nptr != sc->RNCfg->NetConfigs[digestrecp]) {
StrBufAppendBufPlain(recps, HKEY(","), 0);
}
- StrBufAppendBuf(recps, nptr->Value, 0);
+ StrBufAppendBuf(recps, nptr->Value[0], 0);
}
/* Where do we want bounces and other noise to be heard?
* Figure out how big a buffer we need to allocate
*/
for (nptr = sc->RNCfg->NetConfigs[listrecp]; nptr != NULL; nptr = nptr->next) {
- recps_len = recps_len + StrLength(nptr->Value) + 2;
+ recps_len = recps_len + StrLength(nptr->Value[0]) + 2;
}
recps = NewStrBufPlain(NULL, recps_len);
if (nptr != sc->RNCfg->NetConfigs[listrecp]) {
StrBufAppendBufPlain(recps, HKEY(","), 0);
}
- StrBufAppendBuf(recps, nptr->Value, 0);
+ StrBufAppendBuf(recps, nptr->Value[0], 0);
}
/* Where do we want bounces and other noise to be heard?
void network_spool_msg(long msgnum,
void *userdata)
{
+ RoomNetCfgLine* mptr;
struct CitContext *CCC = CC;
StrBuf *Buf = NULL;
SpoolControl *sc;
char *newpath = NULL;
struct CtdlMessage *msg = NULL;
RoomNetCfgLine *nptr;
- MapList *mptr;
struct ser_ret sermsg;
FILE *fp;
char filename[PATH_MAX];
free(msg->cm_fields['R']);
}
msg->cm_fields['R'] =
- strdup(ChrPtr(nptr->Value));
+ strdup(ChrPtr(nptr->Value[0]));
valid = validate_recipients(msg->cm_fields['R'],
NULL, 0);
}
}
- /*
- * Process IGnet push shares
- */
- msg = CtdlFetchMessage(msgnum, 1);
- if (msg != NULL) {
- size_t newpath_len;
-
- /* Prepend our node name to the Path field whenever
- * sending a message to another IGnet node
- */
- if (msg->cm_fields['P'] == NULL) {
- msg->cm_fields['P'] = strdup("username");
- }
- newpath_len = strlen(msg->cm_fields['P']) +
- strlen(config.c_nodename) + 2;
- newpath = malloc(newpath_len);
- snprintf(newpath, newpath_len, "%s!%s",
- config.c_nodename, msg->cm_fields['P']);
- free(msg->cm_fields['P']);
- msg->cm_fields['P'] = newpath;
-
+ if (sc->RNCfg->NetConfigs[ignet_push_share] != NULL)
+ {
/*
- * Determine if this message is set to be deleted
- * after sending out on the network
+ * Process IGnet push shares
*/
- if (msg->cm_fields['S'] != NULL) {
- if (!strcasecmp(msg->cm_fields['S'], "CANCEL")) {
- delete_after_send = 1;
- }
- }
-
- /* Now send it to every node */
- if (sc->RNCfg->NetConfigs[ignet_push_share] != NULL)
- for (mptr = (MapList*)sc->RNCfg->NetConfigs[ignet_push_share]; mptr != NULL;
- mptr = mptr->next) {
-
- send = 1;
- NewStrBufDupAppendFlush(&Buf, mptr->remote_nodename, NULL, 1);
-
- /* Check for valid node name */
- if (CtdlIsValidNode(NULL,
- NULL,
- Buf,
- sc->working_ignetcfg,
- sc->the_netmap) != 0)
- {
- QN_syslog(LOG_ERR,
- "Invalid node <%s>\n",
- ChrPtr(mptr->remote_nodename));
+ msg = CtdlFetchMessage(msgnum, 1);
+ if (msg != NULL) {
+ size_t newpath_len;
- send = 0;
+ /* Prepend our node name to the Path field whenever
+ * sending a message to another IGnet node
+ */
+ if (msg->cm_fields['P'] == NULL) {
+ msg->cm_fields['P'] = strdup("username");
}
-
- /* Check for split horizon */
- QN_syslog(LOG_DEBUG, "Path is %s\n", msg->cm_fields['P']);
- bang = num_tokens(msg->cm_fields['P'], '!');
- if (bang > 1) {
- for (i=0; i<(bang-1); ++i) {
- extract_token(buf,
- msg->cm_fields['P'],
- i, '!',
- sizeof buf);
-
- QN_syslog(LOG_DEBUG, "Compare <%s> to <%s>\n",
- buf, ChrPtr(mptr->remote_nodename)) ;
- if (!strcasecmp(buf, ChrPtr(mptr->remote_nodename))) {
- send = 0;
- break;
- }
+ newpath_len = strlen(msg->cm_fields['P']) +
+ strlen(config.c_nodename) + 2;
+ newpath = malloc(newpath_len);
+ snprintf(newpath, newpath_len, "%s!%s",
+ config.c_nodename, msg->cm_fields['P']);
+ free(msg->cm_fields['P']);
+ msg->cm_fields['P'] = newpath;
+
+ /*
+ * Determine if this message is set to be deleted
+ * after sending out on the network
+ */
+ if (msg->cm_fields['S'] != NULL) {
+ if (!strcasecmp(msg->cm_fields['S'], "CANCEL")) {
+ delete_after_send = 1;
}
-
- QN_syslog(LOG_INFO,
- "%sSending to %s\n",
- (send)?"":"Not ",
- ChrPtr(mptr->remote_nodename));
}
- /* Send the message */
- if (send == 1)
- {
- /*
- * Force the message to appear in the correct
- * room on the far end by setting the C field
- * correctly
- */
- if (msg->cm_fields['C'] != NULL) {
- free(msg->cm_fields['C']);
- }
- if (StrLength(mptr->remote_roomname) > 0) {
- msg->cm_fields['C'] =
- strdup(ChrPtr(mptr->remote_roomname));
- }
- else {
- msg->cm_fields['C'] =
- strdup(CC->room.QRname);
- }
+ /* Now send it to every node */
+ if (sc->RNCfg->NetConfigs[ignet_push_share] != NULL)
+ for (mptr = sc->RNCfg->NetConfigs[ignet_push_share]; mptr != NULL;
+ mptr = mptr->next) {
+
+ send = 1;
+ NewStrBufDupAppendFlush(&Buf, mptr->Value[0], NULL, 1);
+
+ /* Check for valid node name */
+ if (CtdlIsValidNode(NULL,
+ NULL,
+ Buf,
+ sc->working_ignetcfg,
+ sc->the_netmap) != 0)
+ {
+ QN_syslog(LOG_ERR,
+ "Invalid node <%s>\n",
+ ChrPtr(mptr->Value[0]));
- /* serialize it for transmission */
- serialize_message(&sermsg, msg);
- if (sermsg.len > 0) {
-
- /* write it to a spool file */
- snprintf(filename,
- sizeof(filename),
- "%s/%s@%lx%x",
- ctdl_netout_dir,
- ChrPtr(mptr->remote_nodename),
- time(NULL),
- rand()
- );
-
- QN_syslog(LOG_DEBUG,
- "Appending to %s\n",
- filename);
-
- fp = fopen(filename, "ab");
- if (fp != NULL) {
- fwrite(sermsg.ser,
- sermsg.len, 1, fp);
- fclose(fp);
+ send = 0;
}
- else {
- QN_syslog(LOG_ERR,
- "%s: %s\n",
- filename,
- strerror(errno));
+
+ /* Check for split horizon */
+ QN_syslog(LOG_DEBUG, "Path is %s\n", msg->cm_fields['P']);
+ bang = num_tokens(msg->cm_fields['P'], '!');
+ if (bang > 1) {
+ for (i=0; i<(bang-1); ++i) {
+ extract_token(buf,
+ msg->cm_fields['P'],
+ i, '!',
+ sizeof buf);
+
+ QN_syslog(LOG_DEBUG, "Compare <%s> to <%s>\n",
+ buf, ChrPtr(mptr->Value[0])) ;
+ if (!strcasecmp(buf, ChrPtr(mptr->Value[0]))) {
+ send = 0;
+ break;
+ }
+ }
+
+ QN_syslog(LOG_INFO,
+ "%sSending to %s\n",
+ (send)?"":"Not ",
+ ChrPtr(mptr->Value[0]));
}
- /* free the serialized version */
- free(sermsg.ser);
- }
+ /* Send the message */
+ if (send == 1)
+ {
+ /*
+ * Force the message to appear in the correct
+ * room on the far end by setting the C field
+ * correctly
+ */
+ if (msg->cm_fields['C'] != NULL) {
+ free(msg->cm_fields['C']);
+ }
+ if (StrLength(mptr->Value[0]) > 0) {
+ msg->cm_fields['C'] =
+ strdup(ChrPtr(mptr->Value[0]));
+ }
+ else {
+ msg->cm_fields['C'] =
+ strdup(CC->room.QRname);
+ }
+
+ /* serialize it for transmission */
+ serialize_message(&sermsg, msg);
+ if (sermsg.len > 0) {
+
+ /* write it to a spool file */
+ snprintf(filename,
+ sizeof(filename),
+ "%s/%s@%lx%x",
+ ctdl_netout_dir,
+ ChrPtr(mptr->Value[0]),
+ time(NULL),
+ rand()
+ );
+
+ QN_syslog(LOG_DEBUG,
+ "Appending to %s\n",
+ filename);
+
+ fp = fopen(filename, "ab");
+ if (fp != NULL) {
+ fwrite(sermsg.ser,
+ sermsg.len, 1, fp);
+ fclose(fp);
+ }
+ else {
+ QN_syslog(LOG_ERR,
+ "%s: %s\n",
+ filename,
+ strerror(errno));
+ }
+
+ /* free the serialized version */
+ free(sermsg.ser);
+ }
- }
+ }
+ }
+ CtdlFreeMessage(msg);
}
- CtdlFreeMessage(msg);
}
-
/* update lastsent */
- sc->RNCfg->lastsent = msgnum;
+ ///sc->lastsent = msgnum; ////// TODO
/* Delete this message if delete-after-send is set */
if (delete_after_send) {