FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
emailformatter.c
Go to the documentation of this file.
1 /* **************************************************************
2  Copyright (C) 2018 Siemens AG
3  Author: Gaurav Mishra <mishra.gaurav@siemens.com>
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License
7  version 2 as published by the Free Software Foundation.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  ************************************************************** */
25 #include <agent.h>
26 #include <emailformatter.h>
27 
35 const gchar* email_format_text(GPtrArray *rows, gchar *fossy_url)
36 {
37  guint i;
38  GString* ret = g_string_new("");
39  if(rows == NULL)
40  {
41  return "";
42  }
43  g_string_append(ret, "Agents run:\n");
44  g_string_append(ret, " Job ID => Agent Name => Status => Link\n");
45  for (i = 0; i < rows->len; i++)
46  {
47  agent_info *data = (agent_info *)g_ptr_array_index(rows, i);
48  g_string_append_printf(ret, "%10d => %15s => ", data->id, data->agent->str);
49  if (data->status == TRUE)
50  {
51  g_string_append(ret, " COMPLETED\n");
52  }
53  else
54  {
55  g_string_append_printf(ret, "%10s => http://%s?mod=showjobs&job=%d\n",
56  "FAILED", fossy_url, data->id);
57  }
58  g_string_free(data->agent, TRUE);
59  }
60  return ret->str;
61 }
62 
gboolean status
Agent status (Pass => true, fail => false)
const gchar * email_format_text(GPtrArray *rows, gchar *fossy_url)
Format rows as plain text.
guint id
Job queue id for the agent.
GString * agent
Agent name.
Header file with agent related operations.