FOSSology  4.4.0
Open Source License Compliance by Open Source Software
emailformatter.c
Go to the documentation of this file.
1 /*
2  SPDX-FileCopyrightText: © 2018 Siemens AG
3  Author: Gaurav Mishra <mishra.gaurav@siemens.com>
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
14 #include <agent.h>
15 #include <emailformatter.h>
16 
24 const gchar* email_format_text(GPtrArray *rows, gchar *fossy_url)
25 {
26  guint i;
27  GString* ret = g_string_new("");
28  if(rows == NULL)
29  {
30  return "";
31  }
32  g_string_append(ret, "Agents run:\n");
33  g_string_append(ret, " Job ID => Agent Name => Status => Link\n");
34  for (i = 0; i < rows->len; i++)
35  {
36  agent_info *data = (agent_info *)g_ptr_array_index(rows, i);
37  g_string_append_printf(ret, "%10d => %15s => ", data->id, data->agent->str);
38  if (data->status == TRUE)
39  {
40  g_string_append(ret, " COMPLETED\n");
41  }
42  else
43  {
44  g_string_append_printf(ret, "%10s => http://%s?mod=showjobs&job=%d\n",
45  "FAILED", fossy_url, data->id);
46  }
47  g_string_free(data->agent, TRUE);
48  }
49  return ret->str;
50 }
51 
Header file with agent related operations.
const gchar * email_format_text(GPtrArray *rows, gchar *fossy_url)
Format rows as plain text.
gboolean status
Agent status (Pass => true, fail => false)
guint id
Job queue id for the agent.
GString * agent
Agent name.