GNU/Weeb Mailing List <[email protected]>
 help / color / mirror / Atom feed
* [PATCH pit v1 0/3] Add more contacts and bug fixes
@ 2022-03-05 17:36 Alviro Iskandar Setiawan
  2022-03-05 17:36 ` [PATCH pit v1 1/3] data: Add more GNU/Weeb contacts Alviro Iskandar Setiawan
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Alviro Iskandar Setiawan @ 2022-03-05 17:36 UTC (permalink / raw)
  To: Ammar Faizi
  Cc: Nugra, Alviro Iskandar Setiawan, Alviro Iskandar Setiawan,
	Faris Suryanto, Beru Shinsetsu, GNU/Weeb Mailing List

Hello sir,

This series adds more GNU/Weeb contacts and fixes some bugs.

There are 3 patches in this series.

1. Add more GNU/Weeb contacts
  - Ammar
  - Faris
  - Beru

2. Fix undefined variable `$content` that's introduced by
   commit def1707bd7768e ("bin/public-inbox-tg: Replace
   tab char with 8 spaces").

3. Fix `extractList()` function (by me and Nugra). We were
   discussing the reason of why the Chen Rong A. email was
   split into 2 CC address on the group, now fixed with a
   hacky code.

Signed-off-by: Nugra <[email protected]>
Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
---
Alviro Iskandar Setiawan (3):
  data: Add more GNU/Weeb contacts
  bin/public-inbox-tg: Fix undefined variable `$content`
  bin/public-inbox-tg: Fix `extractList()` function

 bin/public-inbox-tg.php        | 32 +++++++++++++++++++++++++-------
 data/tg/[email protected]  |  1 +
 data/tg/[email protected]  |  1 +
 data/tg/[email protected] |  1 +
 4 files changed, 28 insertions(+), 7 deletions(-)
 create mode 100644 data/tg/[email protected]
 create mode 100644 data/tg/[email protected]
 create mode 100644 data/tg/[email protected]


base-commit: def1707bd7768ed0f7f3a7fed6ddb8aa647f539b
-- 
2.32.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH pit v1 1/3] data: Add more GNU/Weeb contacts
  2022-03-05 17:36 [PATCH pit v1 0/3] Add more contacts and bug fixes Alviro Iskandar Setiawan
@ 2022-03-05 17:36 ` Alviro Iskandar Setiawan
  2022-03-05 17:36 ` [PATCH pit v1 2/3] bin/public-inbox-tg: Fix undefined variable `$content` Alviro Iskandar Setiawan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Alviro Iskandar Setiawan @ 2022-03-05 17:36 UTC (permalink / raw)
  To: Ammar Faizi
  Cc: Nugra, Alviro Iskandar Setiawan, Alviro Iskandar Setiawan,
	Faris Suryanto, Beru Shinsetsu, GNU/Weeb Mailing List,
	Ammar Faizi

This adds new 3 known emails:
  [email protected]
  [email protected]
  [email protected]

Cc: Ammar Faizi <[email protected]>
Cc: Faris Suryanto <[email protected]>
Cc: Beru Shinsetsu <[email protected]>
Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
---
 data/tg/[email protected]  | 1 +
 data/tg/[email protected]  | 1 +
 data/tg/[email protected] | 1 +
 3 files changed, 3 insertions(+)
 create mode 100644 data/tg/[email protected]
 create mode 100644 data/tg/[email protected]
 create mode 100644 data/tg/[email protected]

diff --git a/data/tg/[email protected] b/data/tg/[email protected]
new file mode 100644
index 0000000..8b94cbe
--- /dev/null
+++ b/data/tg/[email protected]
@@ -0,0 +1 @@
+@ammarfaizi2
diff --git a/data/tg/[email protected] b/data/tg/[email protected]
new file mode 100644
index 0000000..5bce23d
--- /dev/null
+++ b/data/tg/[email protected]
@@ -0,0 +1 @@
+@TITIT_KUDA
diff --git a/data/tg/[email protected] b/data/tg/[email protected]
new file mode 100644
index 0000000..85d3f3a
--- /dev/null
+++ b/data/tg/[email protected]
@@ -0,0 +1 @@
+@BeruShinsetsu
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH pit v1 2/3] bin/public-inbox-tg: Fix undefined variable `$content`
  2022-03-05 17:36 [PATCH pit v1 0/3] Add more contacts and bug fixes Alviro Iskandar Setiawan
  2022-03-05 17:36 ` [PATCH pit v1 1/3] data: Add more GNU/Weeb contacts Alviro Iskandar Setiawan
@ 2022-03-05 17:36 ` Alviro Iskandar Setiawan
  2022-03-05 17:36 ` [PATCH pit v1 3/3] bin/public-inbox-tg: Fix `extractList()` function Alviro Iskandar Setiawan
  2022-03-05 22:04 ` [PATCH pit v1 0/3] Add more contacts and bug fixes Ammar Faizi
  3 siblings, 0 replies; 5+ messages in thread
From: Alviro Iskandar Setiawan @ 2022-03-05 17:36 UTC (permalink / raw)
  To: Ammar Faizi
  Cc: Nugra, Alviro Iskandar Setiawan, Alviro Iskandar Setiawan,
	Faris Suryanto, Beru Shinsetsu, GNU/Weeb Mailing List

Fix the following warning:

  PHP Warning:  Undefined variable $content

It's introduced by commit def1707bd77 ("bin/public-inbox-tg: Replace
tab char with 8 spaces").

Fixes: def1707bd7768ed0f7f3a7fed6ddb8aa647f539b ("bin/public-inbox-tg: Replace tab char with 8 spaces")
Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
---
 bin/public-inbox-tg.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/public-inbox-tg.php b/bin/public-inbox-tg.php
index 87c5925..6dc07a3 100644
--- a/bin/public-inbox-tg.php
+++ b/bin/public-inbox-tg.php
@@ -178,8 +178,8 @@ function fx(string $input): int
 		$ccListStr = "";
 	}
 
-	$content = str_replace("\t", "        ", $content);
-	$content = trim(substr($body, 0, MAX_BODYLEN));
+	$content = str_replace("\t", "        ", $body);
+	$content = trim(substr($content, 0, MAX_BODYLEN));
 	$msg = "#ml\nFrom: {$from}\n";
 
 	if ($toListStr)
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH pit v1 3/3] bin/public-inbox-tg: Fix `extractList()` function
  2022-03-05 17:36 [PATCH pit v1 0/3] Add more contacts and bug fixes Alviro Iskandar Setiawan
  2022-03-05 17:36 ` [PATCH pit v1 1/3] data: Add more GNU/Weeb contacts Alviro Iskandar Setiawan
  2022-03-05 17:36 ` [PATCH pit v1 2/3] bin/public-inbox-tg: Fix undefined variable `$content` Alviro Iskandar Setiawan
@ 2022-03-05 17:36 ` Alviro Iskandar Setiawan
  2022-03-05 22:04 ` [PATCH pit v1 0/3] Add more contacts and bug fixes Ammar Faizi
  3 siblings, 0 replies; 5+ messages in thread
From: Alviro Iskandar Setiawan @ 2022-03-05 17:36 UTC (permalink / raw)
  To: Ammar Faizi
  Cc: Nugra, Alviro Iskandar Setiawan, Alviro Iskandar Setiawan,
	Faris Suryanto, Beru Shinsetsu, GNU/Weeb Mailing List

When the "To" or "CC" list contains an address that has "," character in
the name, the resulting array list is wrong because this function assumes
"," character as an address separator. For example, the email address
`"Chen, Rong A" <[email protected]>` is split into two addresses due
to the comma character that sits after the "Chen".

Fix this by enumerating the list with a loop and a state variable, parse
them manually.

Fixes: 962100a0051db717f4053ffe91a41e3cee3434be ("Initial commit for public inbox")
Co-authored-by: Nugra <[email protected]>
Signed-off-by: Nugra <[email protected]>
Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
---
 bin/public-inbox-tg.php | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/bin/public-inbox-tg.php b/bin/public-inbox-tg.php
index 6dc07a3..9d5771f 100644
--- a/bin/public-inbox-tg.php
+++ b/bin/public-inbox-tg.php
@@ -62,11 +62,29 @@ function tgMsgIdLookup(string $msgId): int
 
 function extractList(string $str): array
 {
-	$str = explode(",", $str);
-	foreach ($str as &$c)
-		$c = trim($c);
-
-	return $str;
+	$sz = strlen($str);
+	if (!$sz)
+		return [];
+
+	$tmp = "";
+	$container = [];
+	$is_in_quotes = false;
+	for ($i = 0; $i <= $sz; $i++) {
+		if ($i >= $sz)
+			goto g;
+		$c = $str[$i];
+		if ($c == '"')
+			$is_in_quotes = !$is_in_quotes;
+
+		if (($c == "," && !$is_in_quotes)) {
+	g:
+			$container[] = trim($tmp);
+			$tmp = "";
+			continue;
+		}
+		$tmp .= $c;
+	}
+	return $container;
 }
 
 function buildList(array $list, string $name): string
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH pit v1 0/3] Add more contacts and bug fixes
  2022-03-05 17:36 [PATCH pit v1 0/3] Add more contacts and bug fixes Alviro Iskandar Setiawan
                   ` (2 preceding siblings ...)
  2022-03-05 17:36 ` [PATCH pit v1 3/3] bin/public-inbox-tg: Fix `extractList()` function Alviro Iskandar Setiawan
@ 2022-03-05 22:04 ` Ammar Faizi
  3 siblings, 0 replies; 5+ messages in thread
From: Ammar Faizi @ 2022-03-05 22:04 UTC (permalink / raw)
  To: Alviro Iskandar Setiawan
  Cc: Ammar Faizi, Faris Suryanto, Nugra, Alviro Iskandar Setiawan,
	GNU/Weeb Mailing List, Beru Shinsetsu

On Sat, 5 Mar 2022 17:36:14 +0000, Alviro Iskandar Setiawan wrote:
> This series adds more GNU/Weeb contacts and fixes some bugs.
> 
> There are 3 patches in this series.
> 
> 1. Add more GNU/Weeb contacts
>   - Ammar
>   - Faris
>   - Beru
> 
> [...]

Applied, thanks!

[1/3] data: Add more GNU/Weeb contacts
      commit: da7ed3db6f4940405b102592fb187ea3660c2ae4
[2/3] bin/public-inbox-tg: Fix undefined variable `$content`
      commit: 11f2f1096baee5589117c9ae5fc803cbccebee46
[3/3] bin/public-inbox-tg: Fix `extractList()` function
      commit: 667913decf1869fde55d8fd17d66b4a294670617

Best regards,
-- 
Ammar Faizi

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-05 22:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-05 17:36 [PATCH pit v1 0/3] Add more contacts and bug fixes Alviro Iskandar Setiawan
2022-03-05 17:36 ` [PATCH pit v1 1/3] data: Add more GNU/Weeb contacts Alviro Iskandar Setiawan
2022-03-05 17:36 ` [PATCH pit v1 2/3] bin/public-inbox-tg: Fix undefined variable `$content` Alviro Iskandar Setiawan
2022-03-05 17:36 ` [PATCH pit v1 3/3] bin/public-inbox-tg: Fix `extractList()` function Alviro Iskandar Setiawan
2022-03-05 22:04 ` [PATCH pit v1 0/3] Add more contacts and bug fixes Ammar Faizi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox